Add pix_fmt argument to ffmpeg decoder
This commit is contained in:
parent
8c6e604f26
commit
fede9f9005
|
@ -22,21 +22,34 @@ func NewDecoder(r io.Reader, settings map[string]any) (d *Decoder, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pixelFormat := utilities.GetSettingString(settings, "pix_fmt", "")
|
||||||
|
|
||||||
ffmpegBinary := "ffmpeg"
|
ffmpegBinary := "ffmpeg"
|
||||||
if p := os.Getenv("FFMPEG_PATH"); p != "" {
|
if p := os.Getenv("FFMPEG_PATH"); p != "" {
|
||||||
ffmpegBinary = p
|
ffmpegBinary = p
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(ffmpegBinary,
|
args := []string{
|
||||||
//"-v", "quiet",
|
"-v", "quiet",
|
||||||
"-probesize", "8192",
|
"-probesize", "8192",
|
||||||
"-strict", "experimental",
|
"-strict", "experimental",
|
||||||
"-i", "pipe:",
|
"-i", "pipe:",
|
||||||
"-map_metadata", "-1",
|
"-map_metadata", "-1",
|
||||||
"-map", fmt.Sprintf("0:v:%d", videoIndex),
|
"-map", fmt.Sprintf("0:v:%d", videoIndex),
|
||||||
|
}
|
||||||
|
|
||||||
|
if pixelFormat != "" {
|
||||||
|
args = append(args, "-pix_fmt:v", pixelFormat)
|
||||||
|
}
|
||||||
|
|
||||||
|
args = append(args, []string{
|
||||||
"-f", "yuv4mpegpipe",
|
"-f", "yuv4mpegpipe",
|
||||||
"-strict", "experimental",
|
"-strict", "experimental",
|
||||||
"pipe:",
|
"pipe:",
|
||||||
|
}...)
|
||||||
|
|
||||||
|
cmd := exec.Command(ffmpegBinary,
|
||||||
|
args...,
|
||||||
)
|
)
|
||||||
|
|
||||||
cmdIn, err := cmd.StdinPipe()
|
cmdIn, err := cmd.StdinPipe()
|
||||||
|
|
Loading…
Reference in a new issue