[英]ffmpeg concat makes video longer
I have 2 video files that I want to concat using ffmpeg 我有两个视频文件,我想使用ffmpeg连接
initial.mp4 Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 720x720, 1077 kb/s, 15.98 fps, 16 tbr, 600 tbn, 1200 tbc (default) initial.mp4视频:h264(高)(avc1 / 0x31637661),yuv420p(tv),720x720,1077 kb / s,15.98 fps,16 tbr,600 tbn,1200 tbc(默认)
ending.mp4 Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg), 720x720 [SAR 1:1 DAR 1:1], 1287 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default ending.mp4视频:h264(高)(avc1 / 0x31637661),yuv420p(tv,bt470bg),720x720 [SAR 1:1 DAR 1:1],1287 kb / s,25 fps,25 tbr,25k tbn,50 tbc (默认
video_instructions_with_ending.txt video_instructions_with_ending.txt
file initial.mp4
file initial.mp4
file initial.mp4
file ending.mp4
FFmpeg command FFmpeg命令
ffmpeg -f concat -i video_instructions_with_ending.txt -c copy output.mp4 -y
output.mp4 Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 720x720, 27 kb/s, 0.43 fps, 48 tbr, 19200 tbn, 38400 tbc (default) output.mp4视频:h264(高)(avc1 / 0x31637661),yuv420p(tv),720x720,27 kb / s,0.43 fps,48 tbr,19200 tbn,38400 tbc(默认)
The output file is supposed to be 6 seconds. 输出文件应该是6秒。 But the output file is 3min and 32 seconds. 但输出文件是3分32秒。
Any help will be appreciated 任何帮助将不胜感激
For the files that I used, you can get it from: HERE 对于我使用的文件,您可以从以下处获取: HERE
Run this command on ending.mp4
and then concat with the new file: 在ending.mp4
上运行此命令,然后使用新文件连接:
ffmpeg -i ending.mp4 -c copy -video_track_timescale 600 newending.mp4
Long story short, timebases are different so the ending video is prolonged. 长话短说,时基是不同的,所以结束视频延长。 See https://stackoverflow.com/a/43337235/5726027 for context on timestamps & bases. 有关时间戳和基数的上下文,请参阅https://stackoverflow.com/a/43337235/5726027 。
I tried the following command and it worked for me 我尝试了以下命令,它对我有用
ffmpeg -i initial.mp4 -i initial.mp4 -i initial.mp4 -i ending.mp4 -filter_complex concat=n=4:v=1:a=0 -f MOV output.mp4 -y
Explanation: FFmpeg has three concat methods 说明: FFmpeg有三个concat方法
The 3rd options fits the scenario, as we need to re-encode the files. 第3个选项适合场景,因为我们需要重新编码文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.