-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProResProfile.kt
50 lines (41 loc) · 1.58 KB
/
ProResProfile.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package org.openrndr.ffmpeg
fun ScreenRecorder.prores(configure: ProResProfile.()->Unit) {
profile = ProResProfile().apply(configure)
}
// https://ottverse.com/ffmpeg-convert-to-apple-prores-422-4444-hq/
class ProResProfile : VideoWriterProfile() {
override var fileExtension = "mkv"
val CODEC_PRORES_KS = "prores_ks"
val CODEC_PRORES_AS = "prores_as"
var videoCodec = CODEC_PRORES_KS as String?
var vendor = "apl0" as String?
var profile = "3" as String? // 422 HQ
var bitsPerMb = "8000" as String? // How many bits to allot for coding one macroblock. Different profiles use between 200 and 2400 bits per macroblock, the maximum is 8000.
var pixelFormat = "yuv422p10le" as String?
var userArguments = emptyArray<String>()
override fun arguments(): Array<String> {
val pixelFormatArguments = pixelFormat?.let {
arrayOf("-pix_fmt", it)
} ?: emptyArray()
val profileArguments = profile?.let {
arrayOf("-profile:v", it)
} ?: emptyArray()
val videoCodecArguments = videoCodec?.let {
arrayOf("-c:v", it)
} ?: emptyArray()
val vendorArguments = vendor?.let {
arrayOf("-vendor", it)
} ?: emptyArray()
val bitsPerMbArguments = bitsPerMb?.let {
arrayOf("-bits_per_mb", it)
} ?: emptyArray()
val arguments =
videoCodecArguments +
profileArguments +
vendorArguments +
bitsPerMbArguments +
pixelFormatArguments +
userArguments
return arguments
}
}