ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

How to use "copy" for some audio, and transcode some others?

Open tbarbette opened this issue 1 year ago • 0 comments

Hi all,

I'm trying to re-encode only some of the audio tracks. My system support DTS and AC3, so I just need to re-encode the ones that are above that.

allstreams = ffmpeg.input(sys.argv[1])
# Select some of the streams through probe(), the following is a resulting example
stream_to_keep=['0:v', '0:a:0', '0:a:2']
ff = ffmpeg.output(*[allstreams[o] for o in stream_to_keep],filename=of+'-reenc.mkv', acodec="ac3")

The above will reencode all audio stream to ac3. But one of them is dts and can be copied without transcoding.

Any solution?

tbarbette avatar Oct 16 '24 18:10 tbarbette