Concat creates a still image before the video

2020-04-20 08:39发布

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
...

and I use it like this

ffmpeg -y -f concat -safe 0 -i list.txt -c:v libx264 -c:a aac -af aresample=async=1 -pix_fmt yuv420p output.mp4

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.

How do I solve this?

1条回答
戒情不戒烟
2楼-- · 2020-04-20 09:16

The concat demuxer is outputting more packets than that specified in the ranges, since video will need earlier frames to decode.

Try

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

查看更多
登录 后发表回答