Mesclando quatro vídeos com resolução diferente em uma grade com ffmpeg

1

Quero marcar quatro vídeos em um, como mostrado abaixo. Consegui a saída correta, pois todos os vídeos têm a mesma resolução. Mas obtenho um resultado indesejável com resolução diferente. Veja abaixo para mais detalhes.

eu preciso do código ffmpeg para mesclar 4 vídeos de diferentes resoluções em um formato de grade

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"

O código acima fornece a saída a seguir.

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

Masoproblemasurgequandoeurotacionoumdosvídeoseosmesclo.

ffmpeg-i1.avi(480x640)Onlychange

Input#0,avi,from'1.avi':Metadata:encoder:Lavf55.44.100Duration:00:00:03.10,start:0.000000,bitrate:961kb/sStream#0:0:Video:mpeg4(SimpleProfile)(xvid/0x64697678),yuv420p,480x640[SAR1:1DAR3:4],976kb/s,10fps,10tbr,10tbn,10tbcAtleastoneoutputfilemustbespecified

.

Por favor, diga-me o que preciso alterar para obter o resultado desejado (Mostrado abaixo) . obrigado

    
por Taufiq 06.07.2015 / 04:56

1 resposta

0

Descobri que os vídeos são 640X480 e os rodados são 480X640. Aqui estão quatro cenários. Espero que ajude alguém no futuro. :)

{filenumber} = {angle}

1 = 90 2 = 0 3 = 0 4 = 0

ffmpeg.exe -i "1.avi" -vf "[in] scale=0:480 , pad=width=640+640:height=480:x=(640-480)/2:y=0:color=red [left];movie=2.avi, scale=640:480, pad=width=640:height=480:x=0:y=0:color=red [right]; [left][right] overlay=640:0 [out]" -b:v 768k "Output1.mp4"
ffmpeg.exe -i "3.avi" -vf "[in] scale=0:0 , pad=width=640+640:height=480:x=0:y=0:color=red [left];movie=4.avi, scale=0:0, pad=width=640:height=480:x=0:y=0:color=red [right]; [left][right] overlay=640: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"
Pause

2 = 0 1 = 90 3 = 0 4 = 0

ffmpeg.exe -i "2.avi" -vf "[in] scale=0:0 , pad=width=640+640:height=480:x=0:y=0:color=red [left];movie=1.avi, scale=0:480 , pad=width=640:height=480:x=(640-480)/2:y=0:color=red [right]; [left][right] overlay=640: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"
Pause

90 90 0 0

ffmpeg.exe -i "2.avi" -vf "[in] scale=0:480 , pad=width=640+640:height=480:x=(640-480)/2:y=0:color=red [left];movie=1.avi, scale=0:480 , pad=width=640:height=480:x=(640-480)/2:y=0:color=red [right]; [left][right] overlay=640: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"
Pause
<90> 90 90 90

ffmpeg.exe -i "1.avi" -vf "[in] scale=0:0 , pad=width=480+480:height=640:x=0:y=0:color=red [left];movie=2.avi, scale=0:0 , pad=width=480:height=640:x=0:y=0:color=red [right]; [left][right] overlay=480:0 [out]" -b:v 768k "Output1.mp4"
ffmpeg.exe -i "3.avi" -vf "[in] scale=0:0 , pad=width=480+480:height=640:x=0:y=0:color=red [left];movie=4.avi, scale=0:0 , pad=width=480:height=640:x=0:y=0:color=red [right]; [left][right] overlay=480: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"
Pause

90 90 0 90

ffmpeg.exe -i "1.avi" -vf "[in] scale=0:0 , pad=width=480+480:height=640:x=0:y=0:color=red [left];movie=2.avi, scale=0:0 , pad=width=480:height=640:x=0:y=0:color=red [right]; [left][right] overlay=480:0 [out]" -b:v 768k "Output1.mp4"
ffmpeg.exe -i "3.avi" -vf "[in] scale=480:0 , pad=width=480+480:height=640:x=0:y=(640-480)/2:color=red [left];movie=4.avi, scale=0:0 , pad=width=480:height=640:x=0:y=0:color=red [right]; [left][right] overlay=480: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"
Pause
    
por 07.07.2015 / 05:17