[FFmpeg-user] How to make IDR cuts

Mark Filipak markfilipak.imdb at gmail.com
Wed Apr 3 15:02:27 EEST 2024


Is there more to this? If there is, it's not evident to me.

If there are several B-frames in a row, then adjust your mind to 'see' larger shifts across the 
multiple B-frames and adjust PTSs & DTSs to match.


Cutting off a leading open GOP:
                 <————open GOP————>  <—————closed GOP——————>
PTS order      [_I_][_B_][_P_][_B_][_I_][_B_][_P_][_B_][_P_][_I_]
               __/  ___¦___/  ___¦___/  ___¦___/  ___¦___/  __/
              /    /   ¦     /   ¦     /   ¦     /   ¦     /
DTS order [_I_][_P_][_B_][_I_][_B_][_P_][_B_][_P_][_B_][_I_]
             X    X    X         X

PTS order                          [_I_][_B_][_P_][_B_][_P_][_I_]
                                   __/  ___¦___/  ___¦___/  __/
                                  /    /   ¦     /   ¦     /
DTS order                     [_I_][_P_][_B_][_P_][_B_][_I_]

Cut on PTS, then fix up the 1st DTS & packet SCRs.

Or, I don't think it's going to hurt anything to leave this:
PTS order                          [_I_][_B_][_P_][_B_][_P_][_I_]
                              _______/  ___¦___/  ___¦___/  __/
                             /         /   ¦     /   ¦     /
DTS order                [_I_]     [_P_][_B_][_P_][_B_][_I_]
and just fix-up the packet SCRs.

=====
Cutting off a leading closed GOP:
                 <—————closed GOP——————>  <————open GOP————>
PTS order      [_I_][_B_][_P_][_B_][_P_][_I_][_B_][_P_][_B_][_I_]
               __/  ___¦___/  ___¦___/  __/  ___¦___/  ___¦___/
              /    /   ¦     /   ¦     /    /   ¦     /   ¦
DTS order [_I_][_P_][_B_][_P_][_B_][_I_][_P_][_B_][_I_][_B_]
             X    X    X    X    X

PTS order                               [_I_][_B_][_P_][_B_][_I_]
                                        __/  ___¦___/  ___¦___/
                                       /    /   ¦     /   ¦
DTS order                          [_I_][_P_][_B_][_I_][_B_]

Just cut it and fix-up the packet SCRs.

=====
Cutting off a trailing GOP from a closed GOP:
                 <—————closed GOP——————>
PTS order      [_I_][_B_][_P_][_B_][_P_][_I_]..
               __/  ___¦___/  ___¦___/
              /    /   ¦     /   ¦
DTS order [_I_][_P_][_B_][_P_][_B_]

Just cut at the end of the closed GOP.

=====
Cutting off a trailing GOP from an open GOP:
                 <————open GOP————>
PTS order      [_I_][_B_][_P_][_B_][_I_]..
               __/  ___¦___/  ___¦___/
              /    /   ¦     /   ¦
DTS order [_I_][_P_][_B_][_I_][_B_]

PTS order      [_I_][_B_][_P_][_B_][_I_]
               __/  ___¦___/  ___¦___/
              /    /   ¦     /   ¦
DTS order [_I_][_P_][_B_][_I_][_B_]

Cut retaining an ending I-frame, only.


Honestly, I don't know why the MPEG folks don't supply illustrations instead of their torturous text.

This isn't magic, it's Legos.


More information about the ffmpeg-user mailing list