[FFmpeg-devel] mpegvideo_parser outputs incomplete frames [with rough patch]

Wolfram Gloger wmglo
Wed Aug 29 19:23:39 CEST 2007


Looking for a sample for the effect of my last patch, I got
sidetracked on the following more easily reproducible issue
(I found this with many DVB files):

1. Run "make test"

2. "dd if=tests/data/b-libav.ts of=x.ts ibs=188 skip=100"
   (this cuts off the initial packets and in particular the
   initial video frame)

3. ./ffmpeg_g -y -acodec copy -vcodec copy  -i x.ts x1.vob
   this will result in the following error:
Press [q] to stop encoding
error, non monotone timestamps 39600 >= 39600
frame=   25 fps=  0 q=0.1 Lsize=     344kB time=1.0 bitrate=2935.5kbits/s    

4. Apply the appended patch and rebuild, then 3. won't show
   the error any more.

The reason is that mpegvideo_parser only looks for the end of a frame,
so if we, for example, start somewhere within a transport stream, it
will return a partial (initial) frame, _and_ this will always (often
wrongly) be considered as an I-frame.  Therefore, the timing
calculations go wrong.

First I tried to fix this in ff_mpeg1_find_frame_end(), but that
doesn't give the possibility to drop parsed data.  So it really needs
to be fixed in the parser with some additional state.  The appended
patch is mainly for demonstration, maybe there is an even cleaner


P.S. Actually there is another issue here (not investigated) --
"./ffmpeg_g -y -acodec copy -vcodec copy -i tests/data/b-libav.ts x1.vob"
will _also_ show the timestamp error.  But I don't see that with
DVB files.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 1935 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070829/d3121303/attachment.obj>

More information about the ffmpeg-devel mailing list