[MPlayer-dev-eng] [BUG][PATCH] in ffmpeg12 MPEG1 decoding + mencoder

Michael Niedermayer michaelni at gmx.at
Fri Sep 6 12:22:46 CEST 2002


Hi

On Friday 06 September 2002 11:33, Arpi wrote:
[...]
> > end of frame (0x1FF) startcodes are not added for mpeg in avi though they
> > are added for real mpeg, i attached a possible fix, can someone who
> > understands video.c (arpi, alex, ?) check, if its ok then ill commit it
>
> hmm.
> the 0x1ff is not standard thing, ffmpeg12 should not rely on that.
> it was added by me long time ago as a hack to get libmpeg2's builtin
> mpeg-ps demuxer out. maybe it should be moved to vd_libmpeg2.c now, or can
> be removed, as i've replaced decode.c of libmpeg2 so it has no any use now.
> i'll check this.
>
> the patch looks ok, but again: imho it isn't the right fix.
ok

well, the problem is:
ffmpegs mpeg1/2 decoder can handle partial packets & multiple packets 
(multiple pictures) as input so it will only decode a packet if there is a 
startcode at the end, otherwise it will buffer it and decode it as soon as it 
sees a new startcode, but it will stop decoding after it has completed 
decoding of 1 picture

what currently happens is:
ffmpeg decodes the headers but doesnt decode the 1. frame, this is decoded 
during the second call but afterthat nothing else from the second call is 
decoded as it has a complete frame, so the 2. frame is lost as mplayer doesnt 
pass it again on the 3. call -> every 2nd frame is lost (its faster ;) but 
looks messed up)

the solutions:
1. add some dummy startcode at the end 0x1FF or whatever (could be done in 
vd_ffmpeg.c too)
2. tell mplayer that only part of the input was parsed and that the rest must 
be sended again on the next call (dunno if thats possible)
3. add some not_truncated_stream flag to AVCodecContext and decode the last 
part immedeatly even if no startcode is at the end

i suggest 3.

[...]

Michael



More information about the MPlayer-dev-eng mailing list