FFMPEG:寻求使用txt文件 [英] FFMPEG: seeking using a txt file
问题描述
我有40个需要修剪的视频,所以它们将从第6秒开始,然后将它们合并为一个视频.我还有一个 list_of_movies.txt
,其中包含我需要修剪的所有文件的名称.
I have 40 videos that I need to trim, so they would start at the 6th second and then combine them into a single video.
I also have a list_of_movies.txt
that contains the name of all the files I need to trim.
这是我的问题:
将视频串联到单个文件时,ffmpeg接受:
This is my problem:
When concatenating the videos to a single file, ffmpeg accepts:
ffmpeg -f concat -i list_of_movies.txt -c copy output.mp4
但是修整时,它不会接受:
but when trimming, it would not accept:
ffmpeg -ss 00:00:06 -i list_of_movies.txt trimmed .mp4
我在做什么错了?
推荐答案
如果要修剪每个视频以使其从第6秒开始,则必须为文本文件中的每个文件指定它,因此
If you want to trim each video to start from its 6th second, you'll have to specify it for each file within the text file, so
file first.mp4
inpoint 5
file second.mp4
inpoint 5
file third.mp4
inpoint 5
[...]
然后运行
ffmpeg -f concat -i list_of_movies.txt -c copy output.mp4
但是,在 copy
模式下,ffmpeg只能从视频关键帧开始提取,因此,希望有额外的帧,并且可能会破坏音频同步.
However, in copy
mode, ffmpeg can only extract, starting at a video keyframe, so expect extra frames and maybe broken audio sync.
最好重新编码
ffmpeg -f concat -segment_time_metadata 1 -i list_of_movies.txt -vf select=concatdec_select,setpts=N/FRAME_RATE/TB -af aselect=concatdec_select,asetpts=N/SR/TB output.mp4
这篇关于FFMPEG:寻求使用txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!