[orx-video-profiles] Add video profile extension functions

This commit is contained in:
Edwin Jakobs
2022-07-14 12:54:37 +02:00
parent 5b7327eda1
commit a6de46d71c
7 changed files with 64 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
package org.openrndr.extra.videoprofiles
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoWriterProfile
class GIFProfile : VideoWriterProfile() {
@@ -8,3 +9,10 @@ class GIFProfile : VideoWriterProfile() {
return arrayOf("-vf", "split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse=dither=none:diff_mode=rectangle,vflip")
}
}
/**
* Configure an animated GIF video profile
*/
fun ScreenRecorder.gif(configure : GIFProfile.() -> Unit = {}) {
profile = GIFProfile().apply(configure)
}

View File

@@ -1,7 +1,11 @@
package org.openrndr.extra.videoprofiles
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoWriterProfile
class X265Profile : VideoWriterProfile() {
@Deprecated("use h265 profile", replaceWith = ReplaceWith("H265Profile"))
typealias X265Profile = H265Profile
class H265Profile : VideoWriterProfile() {
internal var mode = WriterMode.Normal
internal var constantRateFactor = 28
var hlg = false
@@ -57,4 +61,11 @@ class X265Profile : VideoWriterProfile() {
}
}
}
}
}
/**
* Configure a h265 video profile
*/
fun ScreenRecorder.h265(configure : H265Profile.() -> Unit = {}) {
profile = H265Profile().apply(configure)
}

View File

@@ -1,4 +1,5 @@
package org.openrndr.extra.videoprofiles
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoWriterProfile
/**
@@ -13,4 +14,11 @@ class PNGProfile : VideoWriterProfile() {
override fun arguments(): Array<String> {
return arrayOf("-vf", "vflip")
}
}
/**
* Configure a png sequence profile
*/
fun ScreenRecorder.pngSequence(configure : PNGProfile.() -> Unit = {}) {
profile = PNGProfile().apply(configure)
}

View File

@@ -1,5 +1,6 @@
package org.openrndr.extra.videoprofiles
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoWriterProfile
class ProresProfile : VideoWriterProfile() {
@@ -22,4 +23,11 @@ class ProresProfile : VideoWriterProfile() {
val audio = arrayOf("-an")
return vcodec + profile + filters + audio
}
}
/**
* Configure a Prores video profile
*/
fun ScreenRecorder.prores(configure : ProresProfile.() -> Unit = {}) {
profile = ProresProfile().apply(configure)
}

View File

@@ -1,4 +1,5 @@
package org.openrndr.extra.videoprofiles
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoWriterProfile
/**
@@ -14,3 +15,10 @@ class TIFFProfile : VideoWriterProfile() {
return arrayOf("-vf", "vflip")
}
}
/**
* Configure a tiff sequence profile
*/
fun ScreenRecorder.tiffSequence(configure : TIFFProfile.() -> Unit = {}) {
profile = TIFFProfile().apply(configure)
}

View File

@@ -1,4 +1,5 @@
package org.openrndr.extra.videoprofiles
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoWriterProfile
class WebpProfile : VideoWriterProfile() {
@@ -8,3 +9,11 @@ class WebpProfile : VideoWriterProfile() {
return arrayOf("-vf", "vflip")
}
}
/**
* Configure a webp video profile
*/
fun ScreenRecorder.webp(configure : WebpProfile.() -> Unit) {
profile = WebpProfile().apply(configure)
}