On Fri, 25 Jul 2008, Vladimir Eremeev wrote:
> If I load the resulting video in the avidemux program ( http://avidemux.org/
> ) and have it show frames step by step, it appears that two B-frames which
> follow the first I-frame in the second fragment (as av_read_frame gives
> them) are displayed before that I-frame.
That is perfectly normal. That is why MPEG has separate DTS (decode time
stamp) and PTS (presentation time stamp). Here is a typical sequence of
MPEG video frames showing the order in which they are received and played:
IPBBPBBPBBIBBPBBPBBIBBPBBPBB Receive Order
IBBPBBPBBPBBIBBPBBPBBIBBPBBP Display Order
Note the offset of one frame (each I or P frame is displayed while the
next I or P frame is being decoded), and see also that although the two B
frames are received after the I-frame, they are displayed before it. So I
think you need to drop those two B-frames from your stream completely. And
it may also help to set the "broken GOP" {GOP = Group of Pictures} flag in
the GOP header, although I'm not sure how to do that with FFmpeg. In fact
there is probably a very simple way to do this with FFmpeg that hides
these complexities? I'm not experienced enough to know. See
http://outflux.net/unix/software/GOPchop/ for a useful discussion however
(scroll down to "KNOWN ISSUES" for the most relevant part).
Paul
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user