[FFmpeg-user] Packet corrupt on cut, notice on concat
Gyan Doshi
ffmpeg at gyani.pro
Sun Feb 18 12:09:55 EET 2024
On 2024-02-18 01:52 pm, Mark Filipak wrote:
> I don't know how "DTS" became "000". Sorry. It's 3AM and I'm a little
> punchy.
>
> I found the problem. FFmpeg is corrupting the last B-frame at the end
> of cuts. It shows up during subsequent concatenation. Why it's
> happening is unknown of course.
>
> There is no workaround that I can conceive of.
>
> --Mark.
>
> DTS PTS video 1 video 2
> < 504197456 504204963 N=133560 _B[P]B_B_P_B_I_ _I_B_P_ <== 3
> < 504201210 504201210 N=133559 [B]P_B_B_P_B_I_ _I_B_P_
> < 504204963 504216225 N=133563 _B_P_B_B[P]B_I_ _I_B_P_ <== 2
> < 504208717 504208717 N=133561 _B_P[B]B_P_B_I_ _I_B_P_
> < 504212471 504212471 N=133562 _B_P_B[B]P_B_I_ _I_B_P_
> < 504216225 504223732 N=133565 _B_P_B_B_P_B[I] _I_B_P_ <== 1
> < 504219978 504219978 N=133564 _B_P_B_B_P[B]I_ _I_B_P_
> join here
> > 504219979 504227486 N=133566 _B_P_B_B_P_B_I_ [I]B_P_
> > 504227486 504234994 N=133568 _B_P_B_B_P_B_I_ _I_B[P]
> > 504231240 504231240 N=133567 _B_P_B_B_P_B_I_ _I[B]P_
>
> 1 - If I trim the end of video 1 at the I-frame at N=133565
> ffmpeg -copyts -i this.m2ts -map 0 -bsf:v
> noise=drop='lt(pts\,2854113)+gt(pts\,504223732)' -bsf:a
> noise=drop='lt(pts\,2854113)+gt(pts\,504223732)' -bsf:s
> noise=drop='lt(pts\,2854113)+gt(pts\,504223732)' %CODE% -muxdelay 0
> "%TARGET%"
> I get "Packet corrupt (stream = 0, dts = 504219978)" and there's a
> glitch during play.
>
> 2 - If I back up and trim the end of video 1 at the P-frame at N=133563
> ffmpeg -copyts -i this.m2ts -map 0 -bsf:v
> noise=drop='lt(pts\,2854113)+gt(pts\,504216225)' -bsf:a
> noise=drop='lt(pts\,2854113)+gt(pts\,504216225)' -bsf:s
> noise=drop='lt(pts\,2854113)+gt(pts\,504216225)' %CODE% -muxdelay 0
> "%TARGET%"
> I get "Packet corrupt (stream = 0, dts = 504208717)" and there's a
> glitch during play.
>
> 3 - If I back up again and trim the end of video 1 at the P-frame at
> N=133560
> ffmpeg -copyts -i this.m2ts -map 0 -bsf:v
> noise=drop='lt(pts\,2854113)+gt(pts\,504204963)' -bsf:a
> noise=drop='lt(pts\,2854113)+gt(pts\,504204963)' -bsf:s
> noise=drop='lt(pts\,2854113)+gt(pts\,504204963)' %CODE% -muxdelay 0
> "%TARGET%"
> I get "Packet corrupt (stream = 0, dts = 504201210)" and there's a
> glitch during play.
Add -mpegts_flags +initial_discontinuity to get rid of the corrupt
packet messages. This may or may not get rid of the glitches.
Regards,
Gyan
More information about the ffmpeg-user
mailing list