u2takey / ffmpeg-go

golang binding for ffmpeg
Apache License 2.0
1.66k stars 167 forks source link

When creating a new node, the 'ffmpeg path' is not propagated to the next node. #107

Closed qcgzxw closed 7 months ago

qcgzxw commented 7 months ago

When setting the global 'ffmpeg path' through func (s Stream) SetFfmpegPath(path string) Stream, the FFmpeg path is currently only set for the current node. When making sequential calls, the value of the FFmpeg path is lost.

// ffmpeg -i ./sample_data/in1.mp4 -c:v libx265 ./sample_data/out1.mp4 -y
err := ffmpeg.Input("./sample_data/in1.mp4").
        SetFfmpegPath("/usr/bin/ffmpeg").
        Output("./sample_data/out1.mp4", ffmpeg.KwArgs{"c:v": "libx265"}). // a new node without FfmpegPath variable
        OverWriteOutput().ErrorToStdOut().Run()

// /usr/bin/ffmpeg -i ./sample_data/in1.mp4 -c:v libx265 ./sample_data/out1.mp4 -y
err := ffmpeg.Input("./sample_data/in1.mp4").
        Output("./sample_data/out1.mp4", ffmpeg.KwArgs{"c:v": "libx265"}).
        SetFfmpegPath("/usr/bin/ffmpeg").
        OverWriteOutput().ErrorToStdOut().Run()