[FFmpeg-user] ffmpeg & MPEG-2 GOP structure
nichot20 at yahoo.com
Fri Jan 9 15:29:37 CET 2015
On 09/01/15 12:24, Valentin NOEL wrote:
> Thanks for your answer,
Please do not top post on this forum
> but actually the ITU-T recommendation for H.262 (ISO/IEC 13818-2, CODING OF
> MOVING PICTURES AND ASSOCIATED AUDIO, 1995) specifies B-frames definition :
>> *B-picture; bidirectionally predictive-coded picture: A picture that is
>> coded using motion compensated prediction from past and/or future reference
>> fields or frames.*
> The "and/or" means that a only backward reference is possible.
> The same document also specifies that, for closed GOP :
>> *closed_gop -- This is a one-bit flag which indicates the nature of the
>> predictions uses in the B-pictures (if any) immediately following the first
>> coded I-frame following the group of picture header .closed_gop is set to
>> “1” to indicate that these B-pictures have been encoded using only backward
> It also means that B-frame may use backward prediction only.
> So, does that mean that FFmpeg does not allow only backward prediction for
> B-frame, and that a patch is needed ?
It means that I was making a pragmatic suggestion for something you
could try immediately to solve your issue, rather than trying to get
bogged down in technical details too early.
> 2015-01-09 12:56 GMT+01:00 tim nicholson <nichot20-at-yahoo.com at ffmpeg.org>:
>> On 09/01/15 10:06, Valentin NOEL wrote:
>>> Hi to all,
>>> I would like to encode MPEG-2 video with closed GOP of 12 frames, and a
>>> structure like IBBPBBPBBPBB.
>>> For doing this, I am using these options :
>>> *-g 12* to set the GOP size
>>> *-bf 2* to set the max B frames between reference frames
>>> *-flags +cgop* to use Closed GOP
>>> *-sc_threshold 1000000000* to disable scene change detection
>>> *-b_strategy 0 *to disable adaptive number of B-frames
>>> *-mpv_flags +strict_gop* to enforce GOP size (mpegvideo private flag)
>>> The resulting command is :
>>> ffmpeg -i input.mxf -vcodec mpeg2video -g 12 -bf 2 -flags +cgop
>>> 0 -mpv_flags +strict_gop -sc_threshold 1000000000 -map 0:0 -y output.mxf
>>> However, the result is a GOP of 12 frames IBBPBBPBBPB*P*, with an ending
>>> It seems the problem comes from these lines :
>>> How can I do to fix this ? Is there a way to enforce GOP finishing by a
>>> B-frame ? Is there something missing ?
>> Consider the last GOP of the file, you cannot end on a B frame as there
>> is no forward frame to interpolate from.
>> I wonder therefore if you need to add " -flags +cgop "
>> Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
More information about the ffmpeg-user