[FFmpeg-user] MPEG 'broken_link' flag -- How do I set it?

Mark Thompson sw at jkqxz.net
Mon Mar 25 22:45:44 EET 2024


On 24/03/2024 15:48, Mark Filipak wrote:
> I cut at the end of an open GOP. When I did that, FFmpeg did not set the MPEG 'broken_link' flag to '1'.
> 
> The frame following the cut has to be flagged:
> 'closed_gop' = '0' because it's an open GOP, also, and
> 'broken_link' = '1'.
> 
> 
> How do I do that? I searched but did not find.

The ffmpeg utility does not edit the internals of the bitstream when cutting (packets are effectively opaque to it); you would need a BSF to make this change.

Making such a BSF should be straightforward: use CBS BSF with a single update_fragment function which edits the GOP header on any I frame with a discontinuity before it.

- Mark


More information about the ffmpeg-user mailing list