[FFmpeg-user] Wanted: Easy way to delete PES packets

Mark Filipak markfilipak.imdb at gmail.com
Wed Feb 7 00:43:32 EET 2024


ffmpeg -ss 20.061708333 -copyts -i %SOURCE% -map 0 -c copy -sn -dn -muxdelay 0 "%TARGET%"
left behind 59 PES packets that should have been trimmed off.

Short of researching the number of 2048 byte sectors in each offending PES and then deleting the 
sectors, can anyone suggest a better/easier way to delete the marked (<==) packets below?

Pre trim, the first PTS is 1048560. Post trim, the first PTS is 2798640. It should be 2854113.

   0: video, 1: audio
  /      DTS         PTS        ticks    bytes  packet_CRC
1,    2798640,    2798640,      960,       60, 0xec16103f <==
: 48 more                                                 <==
1,    2845680,    2845680,      960,     1084, 0xe54d2b6f <==
0,    2846606,    2854113,     3753,   640646, 0x3a5a0c45
1,    2846640,    2846640,      960,     1084, 0xe54d2b6f <==
1,    2847600,    2847600,      960,     1084, 0xe54d2b6f <==
1,    2848560,    2848560,      960,     1084, 0xe54d2b6f <==
1,    2849520,    2849520,      960,     1084, 0xe54d2b6f <==
0,    2850360,    2850360,     3753,   640646, 0xfed1d09a <==
1,    2850480,    2850480,      960,     1084, 0xe54d2b6f <==
1,    2851440,    2851440,      960,     1084, 0xe54d2b6f <==
1,    2852400,    2852400,      960,     1084, 0xe54d2b6f <==
1,    2853360,    2853360,      960,     1084, 0xe54d2b6f <==
0,    2854113,    2861621,     3753,   640646, 0x02208727

There is additional strangeness:
- If the frames are I B P, why do they all have 640646 bytes? Do they _really_ have 640646 bytes?
- Why were some leading audio PES packets trimmed off but not the ones shown?
- Why does 'showinfo' show n=0..133566 but 'framecrc' shows 133568 (by physical count)?
- The audio PES at PTS=2798640 was 1084 bytes before the trim
   1,    2798640,    2798640,      960,     1084, 0xe54d2b6f
   but is only 60 bytes after the trim. How is that possible if only remuxing?

I'm investigating the additional strangeness and I have expert help, but any thoughts on the 
strangeness would be much appreciated.

--Mark.




More information about the ffmpeg-user mailing list