On Sat, Jan 13, 2024 at 10:27 PM Mark Filipak <[email protected]> wrote: > > On 13/01/2024 12.50, Andrew Randrianasulu wrote: > > On Sat, Jan 13, 2024 at 8:57 PM Def Etienne <[email protected]> wrote: > -snip- > >> ffmpeg -i ~/6029.mp4 -copyts c:v copy -c:acopy -t 64.600 > >> dev/shm/6029_cut.mp4 > > According to Devon Heitmueller -- thanks again, Devon -- '-copyts' and > '-muxdelay 0' are _both_ needed. > > '-copyts' -- before the input -- bypasses a routine that apparently is named > "tsfixup". > > '-muxdelay 0' -- after the input -- bypasses another ts fixup that defaults > to adding 0.7 seconds to > the timestamps. > > Exactly why ffmpeg does those fixups is a mystery. > > I can confirm that when cutting off the beginning: > ffmpeg -copyts -ss ... -i ... -c copy -muxdelay 0 ... > works. It preserves the timestamps (DTS, PTS). > > > Regarding cutting off the ending: > ffmpeg -to ... -i ... -c copy ... > I am trying to determine the behavior of '-to'. Is it PTS? Or is it ticks > (i.e., duration in > timebase units)? And does ffmpeg do fixups for '-to' clauses, also? It > appears there are such '-to' > fixups. > > > Also be aware that MPV rounds time, and rounds to milliseconds whereas ffmpeg > truncates time and > truncates frame numbers, DTSs, and PTSs. So times from MPV may miss an > I-frame in ffmpeg. What I do > is use MPV times to find approximate frame number. Then I use '-vf showinfo' > to find exact frame > number. Then I compute exact DTS and exact PTS from exact frame number. Then > I convert DTS and PTS > to nanoseconds in the '-ss' clause.
I added ticket about ffprobe/vf_showinfo displaying truncated duration: https://trac.ffmpeg.org/ticket/10799#ticket > > Why does 'ffmpeg -ss' use times instead of relative timebase ticks (i.e. > durations) or absolute DTSs > and PTSs? Your guess is as good as mine, but it is a super PITA. > > Why does ffmpeg apply ts fixups? Your guess is as good as mine, but it is a > super PITA. > > > Also, be aware that in this listing: > > > [Parsed_showinfo_0 @ 0xee202580] n:1612 pts:5803200 ... > > the reported PTS is _not_ PTS. It is ticks (i.e., duration in timebase units) > that is marked "pts" > but isn't -- another super PITA. > > > Also, remuxing from M2TS to MP4 for example, applies more unknown fixups even > when they have the > exact same timebase -- another super PITA -- so don't change packet type > until the very end of your > timming and concatenating. > > --Mark. > > _______________________________________________ > ffmpeg-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". _______________________________________________ ffmpeg-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
