[Libav-user] Efficient ignoring of video packets

Dave Craig davecraig at unbalancedaudio.com
Tue Jun 16 11:12:28 EEST 2020


In my application, I want to be able to play just a single audio track
from a file which also has loads of high bitrate video. Is there a way
to configure an AVFormatContext such that av_read_frame only returns
frames for the audio that I'm interested in? Apologies if I'm missing
something obvious I'm fairly new to libav.
For some container formats like transport stream the underlying code
would still have to trawl through all of the packets inspecting them
at some level, but with a MOV/MP4 container the code could just seek
through to each audio block in turn ignoring the video track
altogether. My current code skips past any packets with a stream_index
that isn't the one I'm interested in which works fine, but there are
100 times more video than audio packets which makes this inefficient.

Thanks for your help,

Dave Craig

More information about the Libav-user mailing list