本文介绍了FFmpeg从视频中间删除2秒钟,并合并各个部分.单线解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个22秒长的视频文件.
我要将片段从10秒删除到12秒.
然后返回1-10秒和12-22秒的级联视频文件.
I have a video file that is 22 seconds long.
I want to remove the segment from 10 seconds to 12 seconds.
Then return a concatenated video file of seconds 1-10 and 12-22.
我想在一个FFmpeg命令中执行此操作.
这是简单的方法
来源 https://www.labnol.org/internet/useful-ffmpeg-commands/28490/
ffmpeg -i input.mp4 -ss 00:00:00.0 -codec copy -t 10 output_1.mp4
和
ffmpeg -i input.mp4 -ss 00:00:12.0 -codec copy -t 10 output_2.mp4
然后使用所有源文件名创建一个输入文件并运行
then create an input file with all the source file names and run
ffmpeg -f concat -i file-list.txt -c copy output.mp4
但我正在寻找一种解决方案
But I'm looking for a one line solution
任何帮助将不胜感激.
推荐答案
要进行精确修整,您必须重新编码
For exact trimming, you'll have to re-encode
使用
ffmpeg -i input.mp4 -vf select='not(between(t,10,12))',setpts=N/FRAME_RATE/TB -af aselect='not(between(t,10,12))',asetpts=N/SR/TB out.mp4
这篇关于FFmpeg从视频中间删除2秒钟,并合并各个部分.单线解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!