Interested and knowledgeable folks, please confirm my results prior to trac submission. I'd like to
know what happens in other use-cases. If you want this video, I could make a shortened version that
would allow testing of the front trim, and we could figure out how to get it to you.
Thanks
--Mark.
set SOURCE=h:\BDMV\STREAM\00305.m2ts
set TARGET=c:\FANNY AND ALEXANDER [1982(1983)] 1of4.m2ts
: This is the Windows cmd script that made the target.
: Issues:
: 1.
: 59 bogus packets are made in the target preceding frame 481: 58 audio
: and frame 480, plus one that follows frame 134046: frame 134048. Note:
: Even if I made a mistake placing the trim, bogus packets shouldn't be
: there. Note that video timebase == audio timebase.
: Clue: The bogus end frame's DTS == the valid end frame's PTS.
: 2.
: Something actually changes this bogus audio packet:
: 1, 2798640, 2798640, 960, 1084, 0xe54d2b6f
: to this:
: 1, 2798640, 2798640, 960, 60, 0xec16103f
: Granted, it's silent audio, but how could a remux delete 1024 bytes?
: Note: That's exactly 1 disc sector.
: -Begin-
: Determine '-ss' and '-to'
: start -- MPV says to start at 0:20.062 sec -- MPV rounds.
: (20.062 sec)*(24/1.001 fps) = 481.[006993..] frames, i.e., 0..480
: (frame 481)/(24/1.001 fps) = 20.061708[3..] sec
: end -- MPV says to end at 1:33:10.835 (i.e., 5590.835 sec) -- MPV rounds.
: (5590.835 sec)*(24/1.001 fps) = 134045.[994005..] frames, i.e., 481..134046
: (frame 134046)/(24/1.001 fps) = 5590.83525[0..] sec
set TRIM=-framespan 481..134046 ...gee, this would be simple
set TRIM=-ss 20.061708333 -to 5590.83525
: PTS = 2854113.75[0..]..504223732.5[0..]
set CODE=-c copy -sn -dn
ffmpeg %TRIM% -copyts -i %SOURCE% -map 0 %CODE% -muxdelay 0 "%TARGET%"
pause
exit
Tip: Highlight the 6 fields and search on them to switch back-n-forth.
The source.
ffmpeg -i %SOURCE% -map 0 -copyts -c copy -f framecrc -
starts-
in this video, '0': video, '1': audio, '2': subtitles
/ DTSPTS dur bytes crc
0, 1044806, 1048560, 3753, 640646, 0x900a1a7a 0
0, 1048560, 1056067, 3753, 640646, 0xe5c6cd7c 2
1, 1048560, 1048560, 960, 1084, 0xe54d2b6f
1, 1049520, 1049520, 960, 1084, 0xe54d2b6f
1, 1050480, 1050480, 960, 1084, 0xe54d2b6f
1, 1051440, 1051440, 960, 1084, 0xe54d2b6f
0, 1052313, 1052313, 3753, 640646, 0xe7f0c204 1
463 more video & 1815 more audio packets here 3..465
0, 2794053, 2801561, 3753, 73475, 0x95247b28 467
1, 2794800, 2794800, 960, 1084, 0xe54d2b6f
1, 2795760, 2795760, 960, 1084, 0xe54d2b6f
1, 2796720, 2796720, 960, 1084, 0xe54d2b6f
1, 2797680, 2797680, 960, 1084, 0xe54d2b6f
0, 2797807, 2797807, 3753, 66185, 0xffbb475c 466
1, 2798640, 2798640, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2799600, 2799600, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2800560, 2800560, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2801520, 2801520, 960, 1084, 0xe54d2b6f <== makes bogus
0, 2801561, 2809068, 3753, 68631, 0x23461eb7 469
1, 2802480, 2802480, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2803440, 2803440, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2804400, 2804400, 960, 1084, 0xe54d2b6f <== makes bogus
0, 2805315, 2805315, 3753, 60778, 0x9e687e73 468
1, 2805360, 2805360, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2806320, 2806320, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2807280, 2807280, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2808240, 2808240, 960, 1084, 0xe54d2b6f <== makes bogus
0, 2809068, 2816576, 3753, 61104, 0x2eda8064 471
1, 2809200, 2809200, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2810160, 2810160, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2811120, 2811120, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2812080, 2812080, 960, 1084, 0xe54d2b6f <== makes bogus
0, 2812822, 2812822, 3753, 56227, 0xdea54c0e 470
1, 2813040, 2813040, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2814000, 2814000, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2814960, 2814960, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2815920, 2815920, 960, 1084, 0xe54d2b6f <== makes bogus
0, 2816576, 2824083, 3753, 51687, 0xcace633b 473
1, 2816880, 2816880, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2817840, 2817840, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2818800, 2818800, 960, 1084, 0xe54d2b6f <== makes bogus
1, 2819760, 2819760, 960, 1084, 0xe54d2b6f <== makes bogus
0, 2820330, 2820330, 3753, 50741, 0x3f745fcc 472
1, 2820720, 2820720, 960, 1084, 0xe54d2b6f <== makes bogus