I want to marge four videos in to one as show below. I have achieve the correct output given all the videos have the same resolution. But I get an undesirable result with different resolution. See below for more details.
i need ffmpeg code to get to merge 4 videos of different resolution in a grid format
ffmpeg.exe -i "1.avi" -vf "[in] scale=iw:ih, pad=2*iw:ih [left];movie=2.avi, scale=iw:ih [right]; [left][right] overlay=main_w/2:0 [out]" -b:v 768k "Output1.mp4"
ffmpeg.exe -i "3.avi" -vf "[in] scale=iw:ih, pad=2*iw:ih [left];movie=4.avi, scale=iw:ih [right]; [left][right] overlay=main_w/2:0 [out]" -b:v 768k "Output2.mp4"
ffmpeg.exe -i "Output1.mp4" -vf "pad=iw:2*ih [top]; movie=Output2.mp4 [bottom]; [top][bottom] overlay=0:main_h/2" "Output_Stacked.mp4"
Code above gives the follow output.
ffmpeg -i 1.avi
Input #0, avi, from '1.avi':
Metadata:
encoder : Lavf55.44.100
Duration: 00:00:03.10, start: 0.000000, bitrate: 773 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p, 640
x480 [SAR 1:1 DAR 4:3], 782 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
At least one output file must be specified
ffmpeg -i 2.avi
Input #0, avi, from '2.avi':
Metadata:
encoder : Lavf55.44.100
Duration: 00:00:03.10, start: 0.000000, bitrate: 773 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p, 640
x480 [SAR 1:1 DAR 4:3], 782 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
At least one output file must be specified
ffmpeg -i 3.avi
Input #0, avi, from '3.avi':
Metadata:
encoder : Lavf55.44.100
Duration: 00:00:03.10, start: 0.000000, bitrate: 699 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p, 640
x480 [SAR 1:1 DAR 4:3], 705 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
At least one output file must be specified
ffmpeg -i 4.avi
Input #0, avi, from '4.avi':
Metadata:
encoder : Lavf55.44.100
Duration: 00:00:03.10, start: 0.000000, bitrate: 724 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p,
640x480 [SAR 1:1 DAR 4:3], 731 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
At least one output file must be specified
But the problem arises when I rotate one of the videos and merge them.
ffmpeg -i 1.avi (480x640) Only change
Input #0, avi, from '1.avi':
Metadata:
encoder : Lavf55.44.100
Duration: 00:00:03.10, start: 0.000000, bitrate: 961 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p,
480x640 [SAR 1:1 DAR 3:4], 976 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
At least one output file must be specified
.
Please tell me what I need to change to get the desired result(Shown Below). Thanks