首页 > 解决方案 > 如何组合这些 FFMPEG 命令?

问题描述

添加徽标

ffmpeg -i mainVideo.mp4 -i logo.mov -filter_complex "[0:v]setpts=PTS-STARTPTS[v0];[1:v]setpts=PTS-STARTPTS+36/TB[v1];[v0][v1]overlay=eof_action=pass[out1]" -map [out1] -threads 5 -y main_with_logo.mp4

删除语音

ffmpeg -i main_with_logo.mp4 -c:v copy -an main_with_logo_s.mp4 -y

添加扬声器声音

ffmpeg -i main_with_logo_s.mp4 -i voice.mp3 -filter:a "volume=2.5" -vsync vfr -pix_fmt yuv420p -b:v 4400k -vf fps=25 -c:a aac -strict experimental main_with_logo_voice.mp4 -y -threads 5

添加背景音乐

ffmpeg -i main_with_logo_voice.mp4 -i bgm.mp3 -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -y -threads 5 main_with_logo_voice_bgm.mp4

添加字幕

ffmpeg -i main_with_logo_voice_bgm.mp4 -vf "subtitles=main.srt:force_style='Fontname=jx,Fontsize=16'" -threads 5 -y main_with_logo_voice_bgm_srt.mp4

所有这些步骤都需要很长时间,我怎样才能将这些 cmd 组合成一两个?

标签: ffmpeg

解决方案


组合命令:

ffmpeg -i mainVideo.mp4 -i logo.mov -i voice.mp3 -i bgm.mp3 -filter_complex "[0:v]setpts=PTS-STARTPTS[v0];[1:v]setpts=PTS-STARTPTS+36/TB[v1];[v0][v1]overlay=eof_action=pass,subtitles=main.srt:force_style='Fontname=jx,Fontsize=16',format=yuv420p;[2:a]volume=2.5[voice];[voice][3:a]amix=inputs=2:duration=first:dropout_transition=2" output.mp4

推荐阅读