Hi all, I've googled a bit for my next problem and this question has been asked here before, but no answers were given for the post I found.
What would be the best way to read packets only from specific streams? I could imagine these two solutions, but they both have problems, more on that later: 1) Use av_read_frame() as advertised and buffer the packets for the streams I currently don't want myself, for when I need them later. 2) Open the same file several times (once for each contained stream), setting up completely independent AVFormatContext objects. Then use av_read_frame() with each respective context and discard the packets for the other streams. Solution 1) has the problem that it is valid (in AVI for example) to write all the video chunks in the beginning of the file and all the audio chunks in the end. I have no idea how libavformat even handles these files and if it will detect the need to read packets from far later in the file to return some audio packets even before all the video has played. Solution 2) obviously has more overhead. Though it does sound tempting since it is so straight forward. Also, while I would certainly avoid having to buffer all the video until I get some audio for the situation above, I still have to read and discard all these video packets until I get to the audio. Any other ideas or useful insights? How have others solved this problem? Thanks very much for any help and best regards, -Stephan _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
