Issue trying to concatinate two videos using ffmpeg
I have two files file1.mp4
and file2.mp4
.
I am trying to concatinate them with following approach,
First I write to inputs.txt
:
file file1.mp4
file file2.mp4
then executed:
ffmpeg -y -f concat -safe 0 -i inputs.txt -c:v copy -c:a aac output.mp4
I get the following warnings:
[vost#0:0/copy @ 0x7fc9dbc10b00] Non-monotonic DTS; previous: 60261, current: 32215; changing to 60262. This may result in incorrect timestamps in the output file.
output.mp4
got generated but it has indeed caused timestamp mismatch as I see a long static video introduced at the end (ie still video but has audio)
So checking encoding I found
file1.mp4:
Duration: 00:00:04.02, start: 0.000000, bitrate: 184 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 864x504, 46 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
file2.mp4:
Duration: 00:04:30.97, start: 0.000000, bitrate: 166 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 864x504, 35 kb/s, 2.41 fps, 2.41 tbr, 10k tbn (default)
Is it because of difference in encoding format ie yuv420p(tv, bt709, progressive)
vs yuv420p(progressive)
or do I need to match the fps
as well?
Read more here: Source link