Support passing FFmpeg options as env variable
This commit is contained in:
parent
9f552b2c59
commit
50d2ed3b68
|
@ -12,13 +12,16 @@ class CLI {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
val envOptions = System.getenv("FFMPEG_OPTIONS")?.split(" ")?.toTypedArray()
|
||||||
|
val argOptions = args.drop(1).toTypedArray()
|
||||||
|
val options = envOptions ?: argOptions
|
||||||
if (args[0].endsWith("ffmpeg")) {
|
if (args[0].endsWith("ffmpeg")) {
|
||||||
FFmpegKitConfig.enableLogCallback { handleLog(it) }
|
FFmpegKitConfig.enableLogCallback { handleLog(it) }
|
||||||
val session = FFmpegKit.executeWithArguments(args.drop(1).toTypedArray())
|
val session = FFmpegKit.executeWithArguments(options)
|
||||||
Thread.sleep(200)
|
Thread.sleep(200)
|
||||||
exitProcess(session.returnCode.value)
|
exitProcess(session.returnCode.value)
|
||||||
} else if (args[0].endsWith("ffprobe")) {
|
} else if (args[0].endsWith("ffprobe")) {
|
||||||
val session = FFprobeKit.executeWithArguments(args.drop(1).toTypedArray())
|
val session = FFprobeKit.executeWithArguments(options)
|
||||||
print(session.output)
|
print(session.output)
|
||||||
exitProcess(session.returnCode.value)
|
exitProcess(session.returnCode.value)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user