Having an issue with an hstack FFmpeg command that has stumped me.
input1 and input2 are both vertical 360x640 videos. I am cropping input1 to a square, merging it vertically with input2, then cropping a vertical strip off each side of the resulting video and horizontally merging these three videos (left strip, middle vertically-stacked video, right strip).
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex [0:v]crop=360:360:0:140,fps=30[v0],[1:v]fps=30[v1],[v0][v1]vstack=inputs=2[m],[m]crop=101:ih:0:0[l],[m]crop=101:ih:259:0[r],[l][m][r]hstack=inputs=3[v];[0:a][1:a]amix[a] -map [v] -map [a] -preset ultrafast ./stackedOutput.mp4
When I run this, I get an error:
[Parsed_hstack_6 @ 0x7ff5394482c0] Input 1 height 640 does not match input 0 height 1000. [Parsed_hstack_6 @ 0x7ff5394482c0] Failed to configure output pad on Parsed_hstack_6
(Full FFmpeg output here.)
But the height of [m] (Input 1 in hstack) is not 640, it's 1000. I have verified this when the commands are run independently.
Why is FFmpeg not recognizing the correct height of [m]? Any help or pointers greatly appreciated! Thanks in advance!
Use:
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v]crop=360:360:0:140,fps=30[v0];[1:v]fps=30[v1];[v0][v1]vstack=inputs=2,split=3[lc][m][rc];[lc]crop=101:ih:0:0[l];[rc]crop=101:ih:259:0[r];[l][m][r]hstack=inputs=3[v];[0:a][1:a]amix[a]" -map "[v]" -map "[a]" -preset ultrafast ./stackedOutput.mp4
Two problems:
Your syntax is incorrect. Filters in the same linear chain are separated by commas, and distinct linear chains of filters are separated by semicolons. See filtering introduction.
You can't re-use the output from a filter multiple times. In your command [m] was already consumed by the first crop, so it is no longer available for the following crop and hstack. The split filter can be used to make multiple copies of a filter output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With