ffmpeg seek and concat without discontinuity
I have a very simple usecase:
I want to seek mpeg videos from a camera (h264 (High) (HDMV / 0x564D4448), yuv420p(top first), 1920×1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 50 tbr, 90k tbn)
Then I want to concat them in one file
I want to do it automatically from a script (that is why I use ffmpeg)
I do not want to re-encode the videos
Then I get an issue:
The output file gets huge discontinuities in timestamps (for instance 10seconds) that make the file impossible to read.
Here are my command lines in Linux, ffmpeg version n6.1.1-16-g33efa50fa4:
ffmpeg -y -i 00071.MTS -ss 2.000 -to 10.000 -c copy -f mpegts 00071_cut.MTS
ffmpeg -y -i 00072.MTS -ss 0.000 -to 10.000 -c copy -f mpegts 00072_cut.MTS
ffmpeg -y -i 00073.MTS -ss 15.000 -to 25.000 -c copy -f mpegts 00073_cut.MTS
ffmpeg -y -i 00074.MTS -ss 28.000 -to 38.000 -c copy -f mpegts 00074_cut.MTS
ffmpeg -y -f mpegts -i "concat:00071_cut.MTS|00072_cut.MTS|00073_cut.MTS|00074_cut.MTS" -c copy output.MTS
During the concat command, I have this error when I use the *_cut.MTS files, but not when I use the raw files:
timestamp discontinuity (stream id=257): -9976000, new offset= 25480000
All my *_cut.MTS files have a first pts_time between 1.4 and 2.0 seconds.
What I just realized is that the issue is only there when I use the -to ou -t option to cut the end of the file
I know that this kind of issue appears many times in the web, I looked for hours but did not find any clear answer.
Thank you i advance for your help!
Read more here: Source link
