英文:
FFMPEG - merge 2 videos side by side
问题
I have 2 videos, same video and audio quality but different length.
Lets say the video resolution is 1920x1080 pixel
What I found so far, but it is not what I need
On internet I found many examples which gives me the outcome of 3840x1080 pixel.
What I want:
Outcome: Video with 1920x1080 pixel
use from video1: left part, such Pixel 1 to 960
use from video2: right part, such Pixel 961 to 1920
audio is merged, i.e. I can hear both audios simultaneously as available
What I want - optional:
Between 2 videos, there is a visible split like |
Is there a single ffmpeg command line I can use?
Many Thanks,
BM
英文:
I have 2 videos, same video and audio quality but different length.
Lets say the video resolution is 1920x1080 pixel
I want to merge both videos side by side, considering the longest length.
What I found so far, but it is not what I need
On internet I found many examples which gives me the outcome of 3840x1080 pixel.
What I want:
Outcome: Video with 1920x1080 pixel
use from video1: left part, such Pixel 1 to 960
use from video2: right part, such Pixel 961 to 1920
audio is merged, i.e. I can hear both audios simultaneously as available
What I want - optional:
Between 2 videos, there is a visible split like |
Is there a single ffmpeg command line I can use?
Many Thanks,
BM
答案1
得分: 1
使用剪裁和堆叠:
ffmpeg -i test10.mkv -i test06.mkv -filter_complex "
color=red:2x1080:24000/1001:1[c];
[0]crop=iw/2-1:ih:0:0[v0];
[1]crop=iw/2+1:ih:iw-ow:0[v1];
[v0][c][v1]xstack=inputs=3:grid=3x1;
[0][1]amix
" output.mkv
或者
[v0][c][v1]hstack=inputs=3;
如果输入有不同的帧速率等,可以尝试使用叠加:
ffmpeg -i test10.mkv -i test06.mkv -filter_complex "
[0]crop=iw/2-1:ih:0:0[v0];
[1]crop=iw/2+1:ih:iw-ow:0[v1];
color=red:1920x1080[bg];
[bg][v0]overlay=shortest=1[b0];
[b0][v1]overlay=x=W-w;
[0][1]amix
" output.mkv
英文:
using crop and stack:
ffmpeg -i test10.mkv -i test06.mkv -filter_complex "
color=red:2x1080:24000/1001:1[c];
[0]crop=iw/2-1:ih:0:0[v0];
[1]crop=iw/2+1:ih:iw-ow:0[v1];
[v0][c][v1]xstack=inputs=3:grid=3x1;
[0][1]amix
" output.mkv
or
[v0][c][v1]hstack=inputs=3;
if inputs have different framerates etc, you can try to use overlay:
ffmpeg -i test10.mkv -i test06.mkv -filter_complex "
[0]crop=iw/2-1:ih:0:0[v0];
[1]crop=iw/2+1:ih:iw-ow:0[v1];
color=red:1920x1080[bg];
[bg][v0]overlay=shortest=1[b0];
[b0][v1]overlay=x=W-w;
[0][1]amix
" output.mkv
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论