[FFmpeg-devel] [PATCH] make DV muxer not forget about audio remaining in buffer

Corey Hickey bugfood-ml
Sun May 13 00:45:10 CEST 2007


Hello,

When the DV muxer receives a video frame, it copies it to the output DV
frame. If the DV frame already has a video frame, it outputs a warning:

[NULL @ 0xe866a0]Can't process DV frame #137. Insufficient audio data or
severe sync problem.

When the muxer receives audio data, it buffers the data, checks to see
if it has enough to fill a DV frame, and stores the result in a variable.

When the muxer has a video frame and sufficient audio data, it builds a
DV frame. It extracts as much audio data as it needs from the audio
buffer and clears the variables that store whether there is a video
frame and enough audio data. This creates a problem when the audio
buffer still has enough data for a full DV frame and the next data the
muxer receives is a video frame, as in:

<video frame 1>
<large chunk of audio>
<video frame 2>
<video frame 3>
<video frame 4>

In this sequence, video frame 1 and a portion of the large chunk of
audio make a complete DV frame. Video frame 2 is stored for the next DV
frame, but it gets overwritten by video frame 3 and video frame 4 (with
accompanying "Can't process DV frame" messages. The muxer has enough
audio for several more DV frames, but it doesn't know it, so only one in
several video frames actually get written to the output file.

This is exactly what happens with mencoder. For some reason, ffmpeg is
not affected.

The attached patch simply makes the DV muxer check to see if there is
sufficient buffered audio after making a DV frame. In my tests, ffmpeg
is unaffected by the patch; regression tests pass.

Is this the right approach? Can I apply the patch? ...or is it a
horrible hack?

Thanks,
Corey
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dv_audio.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070512/c497f693/attachment.txt>



More information about the ffmpeg-devel mailing list