How do I use ffmpeg to concatenate 5 videos side by side? And could someone also kindly explain the command please. I only know how to write python and have an extremely hard time trying to understand the more complicated ffmpeg commands. For example, this script below concats the videos from left to right and top to bottom but how do I read the command?
ffmpeg -i input0 -i input1 -i input2 -i input3 -filter_complex \
"[0:v][1:v]hstack[top]; \ [2:v][3:v]hstack[bottom]; \ [top][bottom]vstack,format=yuv420p[v]; \ [0:a][1:a][2:a][3:a]amerge=inputs=4[a]" \
-map "[v]" -map "[a]" -ac 2 output.mp4does [0:v] mean the 0th row to v-1'th row?
what variables are the hstack command applied to for the line [0:v][1:v]hstack[top]? Why is it not hstack(input0,input1)?
1 Answer
5 videos side-by-side
ffmpeg -i input0 -i input1 -i input2 -i input3 -i input4 -filter_complex \
"[0:v][1:v][2:v][3:v][4:v]hstack=inputs=5[v] [0:a][1:a][2:a][3:a][4:a]amix=inputs=5[a]" \
-map "[v]" -map "[a]" output.mp4Questions
does
[0:v]mean the 0th row to v-1'th row?
[0:v]refers to[input0:video].[3:a]refers to[input3:audio]. This is how you tell a filter which input and stream types you want to use as an input. The order of inputs given to hstack dictates the order that they are arranged.[v]is the arbitrary name given to the output from the hstack filter. You can choose almost any name. Same for[a].-map "[v]"instructsffmpegto put the output from the hstack filter ([v]) intooutput.mp4.
what variables are the
hstackcommand applied to for the line[0:v][1:v]hstack[top]?
Two inputs ([0:v][1:v]), the filter name (hstack), and an output label ([top]).
Why is it not
hstack(input0,input1)?
Why would it be? The current syntax [input0][input1]filer=option0=value0:option1=value1[output] makes more sense to me.