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