簡體   English   中英

FFMPEG-將多個視頻合並到一個視頻中,輸出視頻沒有音頻

[英]FFMPEG - Merge multiple video in to one video, the output video has no audio

我的輸入文件有5個視頻和1張圖片。 我想將所有視頻合並為一個視頻,同時播放視頻。 輸出視頻的布局如下: 在此處輸入圖片說明

我正在使用ffmpeg合並視頻。 這是我的ffmpeg命令:

ffmpeg 
-i C:\VID\test1.mp4 
-i C:\VID\test2.mp4 
-i C:\VID\test3.mp4 
-i C:\VID\test4.mp4 
-i C:\VID\test5.mp4 
-i C:\VID\background.jpg 
-filter_complex 
" nullsrc=size=1280x720 [base]; 
[0] setpts=PTS-STARTPTS, scale=560x360 [video0];
 [1] setpts=PTS-STARTPTS, scale=280x180 [video1]; 
[2] setpts=PTS-STARTPTS, scale=280x180 [video2];
 [3] setpts=PTS-STARTPTS, scale=280x180 [video3];
 [4] setpts=PTS-STARTPTS, scale=280x180 [video4]; 
[5:v] scale=700x700 [image]; 
[base][video0] overlay=shortest=1 [tmp1]; 
[tmp1][video1] overlay=shortest=1:y=360 [tmp2];
 [tmp2][video2] overlay=shortest=1:x=280:y=360 [tmp3]; 
[tmp3][video3] overlay=shortest=1:y=540 [tmp4]; 
[tmp4][video4] overlay=shortest=1:x=280:y=540 [tmp5];
 [tmp5][image] overlay=570:10:enable='between(t,0,30)'"
 -t 30 -c:v libx264 output.mkv

輸出視頻布局工作正常,但輸出視頻中沒有音頻。 我希望每個視頻的所有音頻都保留在輸出視頻中。 同時播放音頻。 我在此鏈接上使用教程: 從多個輸入視頻中創建馬賽克感謝您的閱讀

您可以使用混合合並音頻過濾器。 假設每個MP4輸入文件還包含音頻:

ffmpeg 
-i C:\VID\test1.mp4 
-i C:\VID\test2.mp4 
-i C:\VID\test3.mp4 
-i C:\VID\test4.mp4 
-i C:\VID\test5.mp4 
-i C:\VID\background.jpg 
-filter_complex 
"nullsrc=size=1280x720 [base]; 
[0] setpts=PTS-STARTPTS, scale=560x360 [video0];
[1] setpts=PTS-STARTPTS, scale=280x180 [video1]; 
[2] setpts=PTS-STARTPTS, scale=280x180 [video2];
[3] setpts=PTS-STARTPTS, scale=280x180 [video3];
[4] setpts=PTS-STARTPTS, scale=280x180 [video4]; 
[5:v] scale=700x700 [image]; 
[base][video0] overlay=shortest=1 [tmp1]; 
[tmp1][video1] overlay=shortest=1:y=360 [tmp2];
[tmp2][video2] overlay=shortest=1:x=280:y=360 [tmp3]; 
[tmp3][video3] overlay=shortest=1:y=540 [tmp4]; 
[tmp4][video4] overlay=shortest=1:x=280:y=540 [tmp5];
[tmp5][image] overlay=570:10:enable='between(t,0,30)'[v];
[0:a][1:a][2:a][3:a][4:a]amix=inputs=5[a]"
-map "[v]" -map "[a]" -t 30 -c:v libx264 output.mkv

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM