剪切多个视频并与ffmpeg合并 [英] Cut multiple videos and merge with ffmpeg
问题描述
我如何将视频切成多个部分,然后将它们结合在一起以使用ffmpeg制作新视频?
How can I cut a video into multiple parts and then join them together to make a new video with ffmpeg?
推荐答案
您的问题很安静...
以下示例可能会对您有所帮助,但可能无法解决您的特定问题.
You question is quiet general...
The following example may help you, but it might not solve your specific issues.
该示例适用于三个阶段:
The example applies three stages:
-
创建合成视频(无音频):
Create synthetic video (with no audio):
ffmpeg -f lavfi -i testsrc=duration=3:size=160x120:rate=10 -c:v rawvideo -pix_fmt rgb24 testsrc.avi
(创建的视频未压缩).
参考: https://trac.ffmpeg.org/wiki/FilteringGuide
(The created video is uncompressed).
Reference: https://trac.ffmpeg.org/wiki/FilteringGuide
将视频分为3部分(创建3个视频文件):
Cut video into 3 parts (creating 3 video files):
ffmpeg -i testsrc.avi -ss 00:00:00 -c copy -t 00:00:01 sec0.avi
ffmpeg -i testsrc.avi -ss 00:00:01 -c copy -t 00:00:01 sec1.avi
ffmpeg -i testsrc.avi -ss 00:00:02 -c copy -t 00:00:01 sec2.avi
参考: https://superuser.com/questions/138331/using-ffmpeg剪辑视频
以相反的顺序串联(合并)3个部分:
Concatenate (merge) 3 parts in reverse order:
ffmpeg -i "concat:sec2.avi|sec1.avi|sec0.avi" -codec copy output.avi
注意:对于Linux,请使用单引号'
参考:使用ffmpeg连接两个mp4文件
Note: for Linux use single quotes '
Reference: Concatenate two mp4 files using ffmpeg
合成视频如下图所示:
Synthetic video looks as the following image:
这篇关于剪切多个视频并与ffmpeg合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!