[Libav-user] Effective demuxing single stream of multiple-stream file

rolaoo Gazeta.pl rolaoo at gazeta.pl
Wed Sep 11 12:17:37 CEST 2013


I want to demux only one stream (e.g. some selected audio stream) from a
file which contains video and multiple audio streams. I use standard
demuxing procedue: open the file using avformat_open_input and
avformat_find_stream_info, then read packets using av_read_frame. But I am
interested for packets from only one stream so I am ignoring all packets
from remaining streams. However it introduces a big and unnecessary
overhead as all streams are processed and e.g. video packets bandwitch is
way bigger than audio which I am interested only. How to tell demuxer to
process packets for stream which I am interested and do not process others?
At this moment I am iterating all AVFormatContext::stream streams and
setting discard = AVDISCARD_ALL for streams which I don't want and I see
that disk I/O is way lower. The question is: is it right way to do so?
Maybe some additional parameters for avformat_open_input can select only
one stream in a better way?

best regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130911/fdab9248/attachment.html>

More information about the Libav-user mailing list