package main import ( ffmpeg "github.com/u2takey/ffmpeg-go" "github.com/charmbracelet/log" ) func mergeStreams(path1 string, path2 string, format string, output string) (err error) { log.Debugf("Merging \"%s\" and \"%s\" to \"%s\" using format \"%s\"", path1, path2, output, format) input := []*ffmpeg.Stream{ffmpeg.Input(path1), ffmpeg.Input(path2)} defaultArgs := ffmpeg.KwArgs{"c:v": "copy", "c:a": "copy", "format": format} var ffmpegLogLevel ffmpeg.KwArgs var silent bool if Flags.Verbose { ffmpegLogLevel = ffmpeg.KwArgs{"v": "info"} silent = false } else if Flags.Quiet { ffmpegLogLevel = ffmpeg.KwArgs{"v": "quiet"} silent = true } else { ffmpegLogLevel = ffmpeg.KwArgs{"v": "error"} silent = true } kwArgs := ffmpeg.MergeKwArgs([]ffmpeg.KwArgs{ffmpegLogLevel, defaultArgs}) return ffmpeg.Output(input, output, kwArgs).OverWriteOutput().ErrorToStdOut().Silent(silent).Run() }