[Ffmpeg-devel] Buffering audio data in case of overflow
Cyril Zorin
cyril.zorin
Sat May 6 17:58:46 CEST 2006
On 6-May-06, at 11:40 AM, Mike Melanson wrote:
> Cyril Zorin wrote:
>> Hullo,
>> I'm working on a decoder where the source media format provides
>> more than a frame's worth of audio with a frame chunk. In other
>> words, an incoming "frame", which is composed of audio and video,
>> will have __one__ video frame's worth of data, but potentially N
>> audio frames' worth of audio. This means that I can't quite push
>> it all to ffmpeg, because ffmpeg defines
>> AVCODEC_MAX_AUDIO_FRAME_SIZE.
>> How is this situation generally handled? Are there any existing
>> codecs that need to solve this problem? Right now I'm thinking to
>> manually buffer the audio, but perhaps there's a better way?
>
> Does the first decoded audio frame contain more than 192000 bytes
> (AVCODEC_MAX_AUDIO_FRAME_SIZE) in total? That can handle more than
> 2 seconds of CD-
Yes, at least the stereo streams. A common "first audio frame"
payload is about 294,000 bytes (for both channels).
> standard audio. But if so, that requires special handling.
>
> It is not uncommon for a file to contain a prebuffer for 0.5-1
> second of audio data to correspond to the first video frame. The
> way to handle this is to set the frame timestamps correctly and
> send them to the playback engine. The playback engine worries about
> keeping the sync. Note that ffplay is not the most reliable program
> for keeping sync, though.
>
> --
> -Mike Melanson
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list