Reputation: 105
I have a folder containing multiple video clips (including the Outro, which is an mp4 video). I'm running this code to concatenate the videos :
os.system("(for %i in (*.mp4) do @echo file '%i') > mylist.txt")
os.system('more +1 "mylist.txt" > "Final_List.txt"')
os.system("echo file 'Outro.mp4' >> Final_List.txt") #Final_list.txt will contain all the videos' paths, and will have the outro's path on its last line.
os.system("ffmpeg -f concat -i Final_List.txt -c copy output.mp4")
After executing that, I get a video named output.mp4 containing all the clips I concatenated, but the outro is very buggy : The original outro.mp4 video lasts 9 seconds but on the final video, it only lasts 2 seconds and the sound is accelerated a lot.
https://gofile.io/d/zqadc2 #You'll find the outro.mp4 file here, as well as some of the clips that were correctly concatenated
https://gofile.io/d/G9Zbjo #You'll find the output.mp4 video here
Input file info:
ffmpeg -i Ready_clip7.mp4 -i Ready_clip15.mp4 -i Outro.mp4
...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Ready_clip7.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.51.101
Duration: 00:00:06.40, start: 0.000000, bitrate: 1476 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1339 kb/s, SAR 24251:24253 DAR 388016:218277, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Ready_clip15.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.51.101
Duration: 00:00:18.11, start: 0.000000, bitrate: 1125 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 2043:2048 DAR 227:128], 1009 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 108 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'Outro.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.51.101
Duration: 00:00:32.02, start: 0.000000, bitrate: 188 kb/s
Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 52 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
Upvotes: 0
Views: 255
Reputation: 133803
All inputs must have the same attributes for best results.
Yours vary in width, height, frame rate, and audio sample rate.
Conform Outro.mp4
so it matches the other files:
ffmpeg -i Outro.mp4 -vf "scale=1280:720,fps=30" -ar 48000 Outro2.mp4
Upvotes: 2