[FFmpeg-user] Why cuts & concats sometimes don't work

Mark Filipak markfilipak.imdb at gmail.com
Wed May 8 06:16:59 EEST 2024


Hi All,

I'm still investigating why cuts & concats sometimes don't work. I've found that sometimes open GOPs 
are physically in PTS order & sometimes in DTS order. I reckon that's part/all of the problem.

I have some questions.

Command #1:
ffmpeg -i y:\VIDEO_TS\VTS_03_2.VOB -map 0 -copyts -c copy -f framecrc ->>"%TEMP%\framecrc.txt"

Command #2:
ffmpeg -i y:\VIDEO_TS\VTS_03_2.VOB -map 0:v -copyts -vf showinfo -c:v rawvideo -f null - 
2>>"%TEMP%\showinfo.txt"

===== OUTPUT FOR THE FIRST FOUR FRAMES =====

        packet_dts  packet_pts           packet_duration
       /           /                    /     packet_size
      /           /                    /     /     __0xCRC___ //_(actual)_
#1: 126110985,  126118492,           4504, 77348, 0x3748adeb // 38 packs
     126115489,  126115489,           3003, 18060, 0x6843df67 //  9 packs
     126118492, -9223372036854775808, 4504, 37184, 0xc96165d5 // 18 packs
     126122996,  126122996,           3003, 19440, 0x2b57fd37 // 10 packs

#2: n: 0  pts: 126118492  duration: 4504  type:I
     n: 1  pts: 126122996  duration: 3003  type:B
     n: 2  pts: 126125999  duration: 4504  type:P
     n: 3  pts: 126130503  duration: 3003  type:B

===== QUESTIONS =====

The PTSes of #1 & #2 don't match. Why is that?

In #1, 'duration' is the duration of what? There are 3003 ticks per frame,
so where does a number like 4504 come from?

#1 & https://ffmpeg.org/ffmpeg-all.html#framecrc-1 claims there are 4
packets but there's actually 75, so what is meant by the word "packet"?

And the biggest question of all: DTSes & PTSes only exist in MPEG PESes
for I-frames. So, where/how is FFmpeg getting TSes for B- & P-frames?

===== END NOTES =====

Physically, there is the end of a P followed by B P B P B B, then I B P B
                                                                  / / / /
         frame type: I _PTS 126118492__DTS 126110985_____________/ / / /
                                                                  / / /
         frame type: B __________________________________________/ / /
                                                                  / /
         frame type: P __________________________________________/ /
                                                                  /
         frame type: B __________________________________________/

FFmpeg reports only the I B P B and the frames that follow them.

--Mark.


More information about the ffmpeg-user mailing list