On Tue, Jun 11, 2024 at 6:20 PM Mark Filipak <markfilipak.i...@gmail.com> wrote:
> This is a spliced video. > > The Good: > VLC and PowerDVD play it flawlessly. The splice is technically perfect. > An MPEG-2 TS packet analyser says so. I trust what it says because what > it says matches my cuts and it matches what '-f framecrc' says. The > commands that made the segments and the splice are at the bottom of this > message but you probably don't need to look at them. I include them for > completeness. When the cuts were made, FFmpeg had no complaints > whatsoever. When the concatenation was made, FFmpeg had no complaints > whatsoever. > > what -c copy -f framecrc shows ? Also note that 1.5 is rounded to 2.0 not 1.0, so make sure that set pts/dts rounding is actually correct. You can round inside expressions, using round/floor/ceil/etc. > The Bad: > Below is proof that some common code has bugs that's affecting showinfo > and show_frames. MPV must also use the bad code that showinfo uses > because MPV screws up at the same place. I expect that '-ss' & '-to' > also use the bad code, and that the checker that is responsible for the > commonly seen discontinuous DTS error messages also uses the bad code. > The show_frames and showinfo PTSes are wrong, all of them are wrong. And > show_frames and showinfo are dropping 44 frames as shown below. MPV > shows by a dip in its estimated FPS that it's also dropping frames even > though its decoder is not dropping frames. > > '-f framecrc' apparently does not use the bad code. > > Request: > I need someone (Paul? Gyan?) to look at the video and at my work in > order to confirm what I've found. > > I've attached a copy of this message in case your email client buggers > line lengths and makes a mess of it. > > MPEG-2_TS_packet_analyser_says framecrc_says > ______show_frames_says_______ showinfo_says_[note] > TS_packet ___DTS___ ___PTS___ _DTS__ _PTS__ __N___ ___DTS___ > ___PTS___ __N___ ___PTS____ > 75957480 504148657 504156165 same same I 133542 504148657 > 504137396 I 133542 504137396 > 75958088 504152411 same same B 133543 504152411 > 504141150 B 133543 504141150 > 75958829 504156165 504167426 same same B 133544 504156165 > 504144903 B 133544 504144903 > 75959524 504159918 same same P 133545 504159918 > 504148657 P 133545 504148657 > 75960201 504163672 same same B 133546 504163672 > 504152411 B 133546 504152411 > 75961071 504167426 504174933 same same P 133547 504167426 > 504156165 P 133547 504156165 > 75961601 504171180 same same B 133548 504171180 > 504159918 B 133548 504159918 > 75962207 504174933 504186195 same same B 133549 504174933 > 504163672 B 133549 504163672 > 75962686 504178687 same same P 133550 504178687 > 504167426 P 133550 504167426 > 75963061 504182441 same same B 133551 504182441 > 504171180 B 133551 504171180 > 75963489 504186195 504197456 same same P 133552 504186195 > 504174933 P 133552 504174933 > 75963537 504189948 same same B 133553 504189948 > 504178687 B 133553 504178687 > 75963974 504193702 same same B 133554 504193702 > 504182441 B 133554 504182441 > 75964428 504197456 504204963 same same P 133555 504197456 > 504186195 P 133555 504186195 > 75964466 504201210 same same B 133556 504201210 > 504189948 B 133556 504189948 > 75964504 504204963 504216225 same same B 133557 504204963 > 504193702 B 133557 504193702 > 75964540 504208717 same same P 133558 504208717 > 504197456 P 133558 504197456 > 75964578 504212471 same same B 133559 504212471 > 504201210 B 133559 504201210 > 75964608 504216225 504223732 same same P 133560 504216225 > 504204963 P 133560 504204963 > 75968122 504219978 same same B 133561 504219978 > 504208717 B 133561 504208717 > ======================================= splice is here > ======================================== > 75971638 504223731 504227485 same same > 75972614 504227485 504234993 same same > 75973360 504231239 same same > 75973927 504234993 504246254 same same > 75974464 504238746 same same > 75975245 504242500 same same > 75976029 504246254 504257515 same same > 75976791 504250008 same same > 75977574 504253761 same same > 75978134 504257515 504265023 same same > 75978886 504261269 same same > 75979456 504265023 504276284 same same > 75979999 504268776 same same > 75980791 504272530 same same > 75981589 504276284 504287545 same same > 75982373 504280038 same same > 75983175 504283791 same same > 75983764 504287545 504295053 same same > 75984557 504291299 same same > 75985154 504295053 504306314 same same > 75985935 504298806 same same > 75986543 504302560 same same > 75987370 504306314 504317575 same same > 75990770 504310068 same same > 75991073 504313821 same same > 75991289 504317575 504325083 same same > 75991646 504321329 same same > 75991899 504325083 504332590 same same > 75992305 504328836 same same > 75992602 504332590 504340098 same same > 75993103 504336344 same same > 75993466 504340098 504347605 same same > 75994062 504343851 same same > 75994518 504347605 504355113 same same > 75995169 504351359 same same > 75995706 504355113 504362620 same same > 75996401 504358866 same same > 75996985 504362620 504370128 same same > 75997736 504366374 same same > 75998352 504370128 504377635 same same > 75999178 504373881 same same > 75999828 504377635 504385143 same same > 76000803 504381389 same same > 76001612 504385143 504396404 same same B 133562 504385143 > 504212471 B 133562 504212471 > 76002590 504388896 same same > 76003513 504392650 same same B 133563 504392650 > 504392650 B 133563 504392650 > 76004477 504396404 504407665 same same P 133564 504396404 > 504216225 P 133564 504396404 > 76005257 504400158 same same P 133565 504400158 > 504396404 P 133565 504400158 > 76005921 504403911 same same B 133566 504403911 > 504219978 B 133566 504403911 > 76006590 504407665 504418926 same same B 133567 504407665 > 504400158 B 133567 504407665 > 76007287 504411419 same same I 133568 504411419 > 504223732 I 133568 504411419 > 76007972 504415173 same same B 133569 504415173 > 504403911 B 133569 504415173 > 76008665 504418926 504426434 same same I 133570 504418926 > 504407665 I 133570 504418926 > > Comment regarding what showinfo says: > framecrc is in DTS-order and doesn't show frame numbers. showinfo > is in PTS-order and doesn't show DTSes. Those deficiencies greatly > complicate this sort of work and makes correlations impossible when > showinfo's PTSes are wrong. The 'N' frame numbers are actual. The > PTSes are actual. The correlations (i.e., the frame ordering) of > the starred Ns & PTSes are best guesses. > > > ===== here is '00305+00306.cmd' ===== > set SEGMENT1=00305 cut preserving ending open GOP > set SEGMENT2=00306 cut > call "%SEGMENT1%.cmd" > call "%SEGMENT2%.cmd" > ffmpeg -copyts -i "concat:g:\%SEGMENT1%.m2ts|g:\%SEGMENT2%.m2ts" -map 0 > -c copy -muxdelay 0 > "g:\00305+00306.m2ts" > pause > > > ===== here is '00305 cut preserving ending open GOP.cmd' ===== > : This cuts 00305.m2ts and makes > : '00305 cut preserving ending open GOP.m2ts'. > : > : The beginning is at 0:20.062, which is the "Svensk Filmindustri" logo. > : 0:20.062 is N = seconds*ticks-per-second/ticks-per-frame > : = 20.062*90000/3753.75 = 481. > : check '00305 showinfo.txt' to confirm that N = 481 is an I-frame. > : It is, and it has PTS = 481*90090/24+1048560 = 2854113.75 = 2854113. > : > : FFmpeg's '-f framecrc' reports: > : ________00305.m2ts________ 00305 cut preserving ending open GOP.m2ts > : DTS PTS > : 0, 2835345, 2846606, [P] > : 0, 2839098, 2839098, [B] > : 0, 2842852, 2842852, [B] > : 0, 2846606, 2854113, 0, 2850360, 2854113, [I] <<---+ > : 0, 2850360, 2850360, [B] ¦ > : ¦ > : Here's a PTS- DTS-ordered diagram of the report [note]: ¦ > : open GOP ———————————————————————————>: ¦ > : 2839098 2842852 2846606 : 2854113 ¦ > : / / / : / ¦ > : PTS P B B P B I.. ¦ > : _______¦________¦_______/ _______¦_______/ ¦ > : / ¦ ¦ / ¦ ¦ > : DTS P B B I B P.. ¦ > : \ \ \ ¦ > : 2835345 2846606 2850360 ¦ > : ¦ > : I.. ¦ > : _______________/ ¦ > : / ¦ > : I P.. ¦ > : ¦ > : I.. <<---------+ > : ______/ ¦ > : / ¦ > : I —————> I P.. <<---------+ > : \ > : 2850360 > : > : [note] The group of pictures (GOP) is shown as though it has PTS & DTS > : streams, but that's just to make time and physical frame order easier > : to visualize. It is actually one stream of course, and PTSes and DTSes > : are actually just numbers. > > set CUT1=lt(pts\,2854113) > set FIX1=if(eq(DTS\,2846606)\,2850360\,DTS) > > : The ending cut is at 1:33:10.835, which is a few black frames after > : fadeout & just before the credits. > : 1:33:10.835 is N = (3600+33*60+10.835)*90000/3753.75 = 134046. > : Check '-vf showinfo' to confirm that N = 134046 is an I-frame. It is, > : and it has PTS = 134046*90090/24+1048560 = 504223732.5 = 504223732. > : > : FFmpeg's '-f framecrc' reports: > : ________00305.m2ts________ 00305 cut preserving ending open GOP.m2ts > : DTS PTS DTS PTS > : 0, 504204963, 504216225, 0, 504204963, 504216225, [P] > : 0, 504208717, 504208717, 0, 504208717, 504208717, [B] > : 0, 504212471, 504212471, 0, 504212471, 504212471, [B] > : 0, 504216225, 504223732, 0, 504216225, 504223732, [I] > : 0, 504219978, 504219978, 0, 504219978, 504219978, [B] > : > : Here's a PTS- DTS-ordered diagram of the report: > : open GOP ————————————————————————————————>: > : 504208717 504212471 504216225 : 504223732 > : / / / : / > : ..P B B P B I > : ________¦_________¦_________/ ________¦________/ > : / ¦ ¦ / ¦ > : ..P B B I B > : \ \ \ > : 504204963 504216225 504219978 > > set CUT2=gte(dts\,504223732) > > : Because there's only one open B, discarding it would change the open > : GOP to a closed GOP. But FFmpeg provides no way to set 'closed_gop' > : to '1'. So, this procedure must add one frame to what would otherwise > : be perfect length. > > ffmpeg -copyts -i "g:\00305.m2ts" -map 0 -bsf > noise=drop='%CUT1%+%CUT2%',setts=dts='%FIX1%':pts=PTS -c copy -sn -dn > -muxdelay 0 "g:\00305 cut > preserving ending open GOP.m2ts" > pause > > > ===== here is '00306 cut.cmd' ===== > : This cuts 00306.m2ts and makes '00306 cut.m2ts'. > : > : '00305 cut preserving ending open GOP.m2ts' ends on PTS = 504223732. > : '00306.m2ts' begins on PTS = 2317327. > : '00306 cut.m2ts' needs to begin on PTS = 504227485. > > set ADD=501910158 > > : The beginning is at 0:14.097 following the "Svensk Filmindustri" logo. > : 0:14.097 is N = seconds*ticks-per-second/ticks-per-frame > : = 14.097*90000/3753.75 = 338. > : check '-vf showinfo' to confirm that N = 338 is an I-frame. It is, > : and it has PTS = 338*90090/24+1048560 = 2317327.5 = 2317327. > : > : FFmpeg's '-f framecrc' reports: > : ________00306.m2ts________ ______00306 cut.m2ts______ > : DTS PTS > : 0, 2294805, 2306066, [P] > : 0, 2298558, 2298558, [B] > : 0, 2302312, 2302312, [B] > : 0, 2306066, 2317327, 0, 504223731, 504227485, [I] <<---+ > : 0, 2309820, 2309820, [B] ¦ > : 0, 2313573, 2313573, [B] ¦ > : ¦ > : Here's a PTS- DTS-ordered diagram of 00306.m2ts [note]: ¦ > : open GOP ———————————————————————————————>: ¦ > : 2298558 2302312 2306066 : 2317327 ¦ > : / / / : / ¦ > : PTS B B P B B I.. ¦ > : ______¦_______¦______/ ______¦_______¦______/ ¦ > : / ¦ ¦ / ¦ ¦ ¦ > : DTS P B B I B B P.. ¦ > : \ \ \ \ ¦ > : 2294805 2306066 2309820 2313573 ¦ > : ¦ > : I.. ¦ > : _____________________/ ¦ > : / ¦ > : I P.. ¦ > : ¦ > : I.. <<--------+ > : _____/ ¦ > : / ¦ > : I —————————————>I P.. <<--------+ > : \ \ > : 2306066 2313573 > > set CUT1=lt(pts\,2317327) > set FIX1=if(eq(DTS\,2306066)\,2313573+%ADD%\,DTS+%ADD%) > > : [note] The group of pictures (GOP) is shown as though it has PTS & DTS > : streams, but that's just to make time and physical frame order easier > : to visualize. It is actually one stream of course, and PTSes and DTSes > : are actually just numbers. > : > : The ending is at 1:15:17.471, which is a few black frames after > : fadeout & before the credits. > : 1:15:17.471 is N = (3600+15*60+17.471)*90000/3753.75 = 108311. > : Check '00306 showinfo.txt' to confirm that N = 108311 is an I-frame. > : It is, and it has PTS = 108311*90090/24+1048560 = 407620976.25 = > 407620976. > : > : FFmpeg's '-f framecrc' reports: > : ________00306.m2ts________ ______00306 cut.m2ts______ > : DTS PTS DTS PTS > : 0, 407602207, 407602207, 0, 909512365, 909512365, [B] > : 0, 407605961, 407605961, 0, 909516119, 909516119, [B] > : 0, 407609715, 407620976, 0, 909519873, 909531134, [I] <<---+ > : 0, 407613468, 407613468, 0, 909523626, 909523626, [B] ¦ > : 0, 407617222, 407617222, 0, 909527380, 909527380, [B] ¦ > : ¦ > : Here's a PTS- DTS-ordered diagram of 00306.m2ts: ¦ > : open GOP —————————————————————————————————————————>: ¦ > : 407602207 407605961 407609715 : 407620976 ¦ > : / / / : / ¦ > : ..B B P B B I ¦ > : _¦_________¦________/ ________¦_________¦________/ ¦ > : ¦ ¦ / ¦ ¦ ¦ > : ..B B I B B ¦ > : \ \ \ ¦ > : 407609715 407613468 407617222 ¦ > : ¦ > : 407617222 407620976 ¦ > : / / ¦ > : ..B B P B I<————————I <<--------+ > : _¦_________¦________/ ________¦________/ ¦ > : ¦ ¦ / ¦ ¦ > : ..B B I B <<--------+ > > set CUT2=gte(dts\,407617222) > set FIX2=if(eq(PTS\,407620976)\,407617222+%ADD%\,PTS+%ADD%) > ffmpeg -copyts -i "g:\00306.m2ts" -map 0 -bsf > noise=drop='%CUT1%+%CUT2%',setts=dts='%FIX1%':pts='%FIX2%' -c copy -sn -dn > -muxdelay 0 "g:\00306 > cut.m2ts" > pause_______________________________________________ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".