I am trying to merge 5 parts of a continuous video using ffmpeg.
For some reason, the 1st part is encoded at 29.97 FPS, while all the others are at 30 FPS.
- part #1 : 29.97 fps, 29.97 tbr, 19200 tbn, 38400 tbc
- part #2 : 30 fps, 30 tbr, 15360 tbn, 60 tbc
So before the concat
operation, I tried converting Part #1 to 30 FPS, two different ways :
ffmpeg -i 1.mp4 -filter:v fps=fps=30 output.mp4
(based on the example at https://trac.ffmpeg.org/wiki/ChangingFrameRate)ffmpeg -i 1.mp4 -framerate 29.97 -r 30 output.mp4
Both operations passed and I was able to verify the new FPS just by doing ffmpeg -i output.mp4
However, after the concat
operation I realised that the video is now shorter than the audio in Part #1, resulting in a short blackout at the end of the Part, while the audio continues uninterrupted.
Why is that, and how to fix it ?
tbn
equal.ffmpeg -i 1.mp4 -c copy -video_track_timescale 15360 output.mp4
ffmpeg -f concat -safe 0 -i list.txt -codec copy output.mp4
, I get the following messageNon-monotonous DTS in output stream 0:1; previous: 660480, current: 660114; changing to 660481. This may result in incorrect timestamps in the output file.
and there's still a blank at the end of the video stream of Part 1.