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

Arpi arpi at thot.banki.hu
Sat Sep 7 03:18:12 CEST 2002


Hi,

> > > 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
> >
> > 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

> 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 
what a speedup ;))))

> looks messed up)
yes i see :(

> 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.
agree. best is 3.

2. is not possibe atm.
1. is possible, as demuxer overallocates the buffer so vd_ffmpeg can just
put that 0x1ff at buffer[buffer_size], but is an ugly hack


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu




More information about the MPlayer-dev-eng mailing list