FFmpeg concatenation, no Audio in Final Output

房东的猫 提交于 2019-12-05 19:15:53

You need to generate or add audio to be associated with the black video because each concatenated section needs the same number of video and audio streams.

ffmpeg \
-i originalvideo \
-f lavfi -i color=c=black:s=1920x1080:r=25:sar=1/1:d=1 \
-t 1 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 \
-filter_complex \
"[0:v]setpts=PTS-STARTPTS[mainv]; \
 [0:a]asetpts=PTS-STARTPTS[maina]; \
 [1:v][2:a][mainv][maina]concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" -movflags +faststart output.mp4
  • You can eliminate the (a)setpts filters for the color and anullsrc source filters since their timestamps start at 0.

  • You can avoid the trim filter because you can set the duration for each filter.

  • The -t value for the anullsrc duration only needs to be less than or equal to the duration of the black video: the concat filter will automatically pad the rest with silence.

  • With anullsrc ensure that you match the proper channel layout and audio sample rate of your main video; otherwise concat may automatically choose a "common" layout and rate that may not be what you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!