[FFmpeg-user] key frame

Mark Filipak markfilipak.imdb at gmail.com
Fri Jun 28 08:44:48 EEST 2024


On 27/06/2024 19.27, Phil Rhodes via ffmpeg-user wrote:
>   Mark,
> One thing about getting software to analyse what ffmpeg is doing with regard to cuts and splices - what're you thinking of?

Hey Phil,

I'm doing trimming and splicing of open GOPs.

I trimmed both ends of two m2ts segments and spliced them. The two GOPs are shown below as though 
they have PTS & DTS streams, but that's just to make time and physical frame order easier to 
visualize. There's actually one stream of course, and PTSes and DTSes are actually just numbers. 
I've left out the values of the PTSes and DTSes to keep the diagrams tidy.

                                 splice
                                  here
                                   ::
PTS order    ..I  B  B  P  B  B  I  I  B  B  P..
               /  ______/  ______/: /  ______/
              /  /        /       :/  /
DTS order ..I  P  B  B  I  B  B  I  P  B  B..
                                  :
                                  :
Part 1 is from 00305.m2ts -------------------
                                  :
PTS order    ..I  B  B  P  B  B  :
               /  ______/         :
              /  /                :
DTS order ..I  P  B  B     B  B  :
                                  :
                                  :
Part 2 is also from 00305.m2ts.  :
                                  :
PTS order                        I
                           ______/
                          /
DTS order               I

Carrying over part 2's I-frame keeps the end of part 1 as an open GOP. That's important because 
FFmpeg provides no means to set the 'closed_gop' MPEG tag to '1', so the end of the 1st segment has 
to remain an open GOP.


Part 3 is from 00306.m2ts -------------------

PTS order                           I  B  B  P..
                                    /  ______/
                                   /  /
DTS order                        I  P  B  B..

but before I moved the I's DTS, it used to look like this:

PTS order                           I  B  B  P..
                              ______/  ______/
                             /        /
DTS order                  I        P  B  B..

All the DTSes and PTSes and PCRs are correct, perfect in fact. All source GOPs are open GOPs. After 
the cuts and splice they are still open GOPs, including at the splice.


> For the purpose of being able to look at frame sequences easily, you can probably just use something like Resolve. The free version might have all you need and it's not particularly complicated. The full version is relatively inexpensive.
> P

There are also other MPEG tags that I'm not changing but maybe should, that is, if FFmpeg provides a 
way to change them (which it doesn't seem to do). To determine what other MPEG tags need changing, 
if any, I need to analyze the existing frames around the splice and get a report on their MPEG 
compliance.

Can Resolve do that kind of analysis?

--Mark.



More information about the ffmpeg-user mailing list