ffmpeg-python
ffmpeg-python copied to clipboard
How to use "copy" for some audio, and transcode some others?
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?