FFMPEG背景音乐

时间:2018-04-12 17:10:56

标签: video ffmpeg

我在将背景音乐添加到concat视频时遇到问题,我使用amerge在线阅读并且loop功能是可行的,但我不知道如何实现这一点。

我的ffmpeg命令,正在运行,加入视频,添加水印,添加介绍和outro。

/usr/bin/ffmpeg -i "/home/main/1515b7e4471944edce419f8e24f5c1a8::13.mp4" -i "/home/demo/intro.mp4" -i "/home/main/2b011d97e633049ec3c4605470cd8306::8.mp4" -i "/home/main/5ee6a1869d4f072a796b9d10b1426c2e::14.mp4" -i "/home/main/6a145097d70ce2e95ed65d910f882f98::12.mp4" -i "/home/main/74b95c9f4dfa1a1f966877ded19972a0::10.mp4" -i "/home/main/74b95c9f4dfa1a1f966877ded19972a0::8.mp4" -i "/home/main/82ed61e0a749292e16f3ccab83b61c94::4.mp4" -i "/home/main/834866595d3851712ebbdb414a34b5e8::19.mp4" -i "/home/main/ac89029161cf7da85d93abaa2fa339cc::11.mp4" -i "/home/main/c68e5394ab5028ee2ae57f298430ffba.mp4" -i "/home/main/c6c54226713e5b4f24a985d4f7454658::17.mp4" -i "/home/main/c6c54226713e5b4f24a985d4f7454658::8.mp4" -i "/home/main/da08388ba6e1ccde8874fb2cd46e19ac::11.mp4" -i "/home/main/e35ee0ecf24fce797573c646f3f86619::13.mp4" -i "/home/main/e7619cd3c171ead78db385371e84b3d1::15.mp4" -i "/home/main/e8a0c3954ba0e7e8c51583c680fd993d::15.mp4" -i "/home/main/e8a0c3954ba0e7e8c51583c680fd993d::9.mp4" -i "/home/main/f3f5182bb7867b79b1b59ade1704b016::5.mp4" -i "/home/main/fcb874d27ddf453743cb8a8f1b55e0bd::21.mp4" -i "/home/main/feb7f5bfe15f350a3ff28894226932cd::14.mp4" -i "/home/outro.mp4" -i "/home/watermark.png" -filter_complex "[0:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=13,setpts=PTS-STARTPTS[v10];[v10][22:v]overlay=30:30 [v0];[0:a]aresample=44100,atrim=start=0:end=13,asetpts=PTS-STARTPTS[a0];[1:v]fps=30,scale=1280:720,setsar=1/1,setpts=PTS-STARTPTS[v1];[1:a]aresample=44100[a1];[2:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=8,setpts=PTS-STARTPTS[v20];[v20][22:v]overlay=30:30 [v2];[2:a]aresample=44100,atrim=start=0:end=8,asetpts=PTS-STARTPTS[a2];[3:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=14,setpts=PTS-STARTPTS[v30];[v30][22:v]overlay=30:30 [v3];[3:a]aresample=44100,atrim=start=0:end=14,asetpts=PTS-STARTPTS[a3];[4:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=12,setpts=PTS-STARTPTS[v40];[v40][22:v]overlay=30:30 [v4];[4:a]aresample=44100,atrim=start=0:end=12,asetpts=PTS-STARTPTS[a4];[5:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=10,setpts=PTS-STARTPTS[v50];[v50][22:v]overlay=30:30 [v5];[5:a]aresample=44100,atrim=start=0:end=10,asetpts=PTS-STARTPTS[a5];[6:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=8,setpts=PTS-STARTPTS[v60];[v60][22:v]overlay=30:30 [v6];[6:a]aresample=44100,atrim=start=0:end=8,asetpts=PTS-STARTPTS[a6];[7:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=4,setpts=PTS-STARTPTS[v70];[v70][22:v]overlay=30:30 [v7];[7:a]aresample=44100,atrim=start=0:end=4,asetpts=PTS-STARTPTS[a7];[8:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=19,setpts=PTS-STARTPTS[v80];[v80][22:v]overlay=30:30 [v8];[8:a]aresample=44100,atrim=start=0:end=19,asetpts=PTS-STARTPTS[a8];[9:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=11,setpts=PTS-STARTPTS[v90];[v90][22:v]overlay=30:30 [v9];[9:a]aresample=44100,atrim=start=0:end=11,asetpts=PTS-STARTPTS[a9];[10:v]fps=30,scale=1280:720,setsar=1/1,setpts=PTS-STARTPTS[v100];[v100][22:v]overlay=30:30 [v10];[10:a]aresample=44100[a10];[11:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=17,setpts=PTS-STARTPTS[v110];[v110][22:v]overlay=30:30 [v11];[11:a]aresample=44100,atrim=start=0:end=17,asetpts=PTS-STARTPTS[a11];[12:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=8,setpts=PTS-STARTPTS[v120];[v120][22:v]overlay=30:30 [v12];[12:a]aresample=44100,atrim=start=0:end=8,asetpts=PTS-STARTPTS[a12];[13:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=11,setpts=PTS-STARTPTS[v130];[v130][22:v]overlay=30:30 [v13];[13:a]aresample=44100,atrim=start=0:end=11,asetpts=PTS-STARTPTS[a13];[14:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=13,setpts=PTS-STARTPTS[v140];[v140][22:v]overlay=30:30 [v14];[14:a]aresample=44100,atrim=start=0:end=13,asetpts=PTS-STARTPTS[a14];[15:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=15,setpts=PTS-STARTPTS[v150];[v150][22:v]overlay=30:30 [v15];[15:a]aresample=44100,atrim=start=0:end=15,asetpts=PTS-STARTPTS[a15];[16:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=15,setpts=PTS-STARTPTS[v160];[v160][22:v]overlay=30:30 [v16];[16:a]aresample=44100,atrim=start=0:end=15,asetpts=PTS-STARTPTS[a16];[17:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=9,setpts=PTS-STARTPTS[v170];[v170][22:v]overlay=30:30 [v17];[17:a]aresample=44100,atrim=start=0:end=9,asetpts=PTS-STARTPTS[a17];[18:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=5,setpts=PTS-STARTPTS[v180];[v180][22:v]overlay=30:30 [v18];[18:a]aresample=44100,atrim=start=0:end=5,asetpts=PTS-STARTPTS[a18];[19:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=21,setpts=PTS-STARTPTS[v190];[v190][22:v]overlay=30:30 [v19];[19:a]aresample=44100,atrim=start=0:end=21,asetpts=PTS-STARTPTS[a19];[20:v]fps=30,scale=1280:720,setsar=1/1,trim=start=0:end=14,setpts=PTS-STARTPTS[v200];[v200][22:v]overlay=30:30 [v20];[20:a]aresample=44100,atrim=start=0:end=14,asetpts=PTS-STARTPTS[a20];[21:v]fps=30,scale=1280:720,setsar=1/1,setpts=PTS-STARTPTS[v210];[v210][22:v]overlay=30:30 [v21];[21:a]aresample=44100[a21];[v0] [a0] [v1] [a1] [v2] [a2] [v3] [a3] [v4] [a4] [v5] [a5] [v6] [a6] [v7] [a7] [v8] [a8] [v9] [a9] [v10] [a10] [v11] [a11] [v12] [a12] [v13] [a13] [v14] [a14] [v15] [a15] [v16] [a16] [v17] [a17] [v18] [a18] [v19] [a19] [v20] [a20] [v21] [a21] concat=n=22:v=1:a=1: [v] [a]" -map "[v]" -map "[a]" -preset ultrafast -y -vcodec libx264 -f mp4 -b:v 4500k -aspect 1280/720 -acodec ac3 "/home/final.mp4"

1 个答案:

答案 0 :(得分:2)

连续后,通过源过滤器添加音乐并混合。

DBUG = True