FFMPEG-将多个视频合并到一个视频中,输出视频没有音频 [英] FFMPEG - Merge multiple video in to one video, the output video has no audio

查看:110
本文介绍了FFMPEG-将多个视频合并到一个视频中,输出视频没有音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的输入文件有5个视频和1张图片.我想将所有视频合并为一个视频,同时播放视频.输出视频的布局如下:

My input file has 5 video and 1 picture. I want to merge all video to one video, play video at the same time. The layout of the output video like this:

我使用ffmpeg合并视频.这是我的ffmpeg命令:

Im using ffmpeg to merge video. this is my ffmpeg command:

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

输出视频布局正常,但输出视频中没有音频.我希望每个视频的所有音频都保留在输出视频中.同时播放音频.我正在此链接上使用教程:创建几个输入视频中的一个马赛克感谢您的阅读

The output video layout is working fine but no audio in the output video. I want all audio off each video will be keep on the output video. play audio at the same time together. I'm using tutorial on this link: Create a mosaic out of several input videos Thanks for reading

推荐答案

您可以使用 amix合并音频过滤器.假设每个MP4输入文件还包含音频:

You can use the amix or amerge audio filters. Assuming each MP4 input file also contains audio:

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

这篇关于FFMPEG-将多个视频合并到一个视频中,输出视频没有音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆