[Ffmpeg-devel] Re: [PATCH] PKT_FLAG_B

Baptiste Coudurier baptiste.coudurier
Tue Aug 8 18:19:09 CEST 2006


Michael Niedermayer wrote:
> (dts==pts && has_b_frames) -> frame is a b frame, alternatively you
> can just extract it out of the video packet, this is very easy, it
> just requires searching for a byte sequence and then looking at the
> following byte and gxf has a special case for mpeg1/2 anyway so i see
> no big problem with that ...

That is ugly. Frame is already parsed earlier, code will be duplicated.
Also assuming b frame regarding pts/dts difference is not exact, and
has_b_frames is not set when stream copying.

> furthermore
> gxf spec: -------------- NOTE on MPEG GoP structure target values
> The parameters (I-pictures per GoP, P-pictures per I-picture and B- 
> pictures per I-picture) are target values provided to the MPEG
> encoder. The result stream may not meet this cadence at the
> discretion of the encoder. These values are provided for information
> purposes only. --------------
> -> the relate code is wrong, values should be set to 
> AVCodecContext.max_b_frames and AVCodecContext.gop_size and for the
> stream copy case they are 0 or random either is fine

I do not agree with that. Stream copy is exactly like if it was encoded.
It is muxer/parser job to parse the stream and gather infos and to SET
them if they can be known, and they can and parsed, I just need access
to the parser from the muxer. I don't get your point here.

Players (broadcast servers) does not behave correctly if B and P values
are 0, random will be just wrong.

> and the media field number should be set to dts and time line field
> number to pts, not a random +=2 every frame variable

That is right. media field number is actually dts, computed correctly
internally since lavf does not readjust/correct timestamps when stream

"The media field number is a 32-bit unsigned number representing the
media field location on a virtual time
line within the current media file. In all cases the virtual time line
is measured in units of video fields with the
origin of the time line at field zero."

Time line is not pts:
"Time line field numbers shall be assigned consecutively from the start
of the material. The first time line field
number shall be 0. Only even field numbers shall be used for frame-based
compression systems."

My +2 is right here.

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312

More information about the ffmpeg-devel mailing list