[FFmpeg-user] help filtering an audio stream from mpegts
Brian Fallik
bfallik at bamboom.com
Thu Aug 11 21:45:42 CEST 2011
Hi,
I'm trying to use lib(avcodec|format) to discard one audio stream
(PID) from an input mpegts file. Using ffmpeg, the command line:
$ ffmpeg -y -i infile.ts -vcodec copy -acodec copy outfile.ts -map
0.0 -map 0.2
does exactly what I want, but I want to avoid the fork&exec of ffmpeg
and use the library interface directly.
I can't figure out how to setup the input and output contexts. If I
don't add the filtered stream to the output context,
av_interleaved_write_frame() will segfault since it accesses stream[n]
with n == 2, but the output context only contains a list of streams
for ids 0 and 1. If I add the input stream to the output context, the
PMT contains both audio PIDs, which isn't right.
Does the 'discard' attribute of AVStream help? I tried setting it to
AVDISCARD_ALL for the stream I want to remove but it doesn't seem to
do much of anything.
Can anyone shed some light on this? The ffmpeg binary does the right
thing so I know it's possible.
Thanks,
brian
More information about the ffmpeg-user
mailing list