问题描述
我正在创建这样的一份切割清单
I am creating a cutlist like this
file 't1.MP4'
inpoint 1.45067
outpoint 3.18133
file 't2.MP4'
inpoint 3.45067
outpoint 6.18133
...
我这样使用它
ffmpeg -y -f concat -safe 0 -i list.txt -c:v libx264 -c:a aac -af aresample=async=1 -pix_fmt yuv420p output.mp4
输出几乎总是在开始时包含静止图像,有时是视频时间的一半,有时更少,显示的是第一帧,然后是最后的视频.我注意到,inpoint
和outpoint
之间的距离越少,开始时的静止图像就越长.也许它也与inpoint
和outpoint
的数量有关.
The output almost always contains a still image at the start, sometimes half the video time, sometimes less, showing the first frame then the final video starts. I noticed, the less inpoint
and outpoint
are apart, the longer the still image at the start. Maybe its also connected to the amount of inpoint
and outpoint
.
我该如何解决?
推荐答案
由于视频将需要更早的帧进行解码,因此concat多路分配器输出的数据包超出了范围内指定的数据包.
The concat demuxer is outputting more packets than that specified in the ranges, since video will need earlier frames to decode.
尝试
ffmpeg -y -f concat -safe 0 -copyts -segment_time_metadata 1 -i list.txt -vf select=concatdec_select,setpts=N/FRAME_RATE/TB,format=yuv420p -c:v libx264 -af aselect=concatdec_select,asetpts=N/SR/TB -c:a aac output.mp4
我假设所有文件的视频和音频都具有相同的属性,例如帧率,分辨率,音频采样率,通道等.
I assume all files have videos and audios with same properties i.e. framerate, resolution, audio sampling rate, channels..etc
这篇关于Concat在视频之前创建静止图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!