[Ffmpeg-devel] How to retrieve audio or video stream at same timestamp using av_read_frame

Martin Boehme boehme
Mon May 23 10:42:37 CEST 2005

Keith Mok wrote:
> But some encoder  create movie file, with several seconds of movie data, 
> then video data.

I assume you mean "audio", not "video"?

> If buffer excess data, will require a lot of memory specially if you 
> need to buffer several seconds of the video data in a frame rate of 30 fps.
> Any comment?

Yes, it's going to require some memory... but what else could you do?


P.S. Please don't top-post...

> M?ns Rullg?rd wrote:
>> Keith Mok <ek9852 at yahoo.com.hk> writes:
>>> Hi
>>> When I use av_read_frame, I cannot select whether I want audio stream
>>> or video stream data.
>>> It will determine automatically.
>>> And application need to check the stream type after output.
>>> For some movie files, the video data may not be followed immediately
>>> by the audio data. It may hold few tens seconds of video data followed
>>> by audio data.
>>> During real time playback of a movie file, I want to demux the audio
>>> portion data and video portion data at about the same timestamp. The
>>> only way I can get it is to create two seperate instances of
>>> AVFormatContext on the same movie file. This can waste some
>>> resource. Any better idea ?
>> The usual solution is to buffer whatever excess audio or video frames
>> you get until it's time to decode them.

Martin B?hme
Inst. f. Neuro- and Bioinformatics
Ratzeburger Allee 160, D-23538 Luebeck
Phone: +49 451 500 5514
Fax:   +49 451 500 5502
boehme at inb.uni-luebeck.de

More information about the ffmpeg-devel mailing list