ffmpeg how to vertically rotate and concat/stack two videos in one command?

250 views Asked by At

I have two recordings inside.MOV and outside.MOV recorded with two cameras (the same settings and the same model).


I want to do something like that:

ffmpeg -i inside.MOV -vf "transpose=2,transpose=2" inside_rotated180degree.MOV # rotate 180 degree
ffmpeg -i outside.MOV -i inside_rotated180degree.MOV \
  -filter_complex "[0:v]scale=640:-1[v0];[v0][1:v]vstack=inputs=2" inside_and_outside.MOV # concat them

but in single command.

I've managed to rotate upper video, but I need to rotate lower:

ffmpeg -i outside.MOV -i inside_rotated180degree.MOV \
  -filter_complex "[0:v]scale=1920:-1,rotate=PI[v0];[v0][1:v]vstack=inputs=2" inside_and_outside.MOV

I tried to modify the command various ways to add rotate=PI, but always there is a error in command/screen/input/... does anybody knows how to rotate video lower instead of upper?

1

There are 1 answers

0
kesh On BEST ANSWER

You just need to do the same prep work on both video streams (i.e., 2 filter chains) before stacking them together (the final chain):

ffmpeg -i outside.MOV -i inside.MOV \
  -filter_complex "[0:v]scale=640:-1,hflip,vflip[v0];\
                   [1:v]scale=640:-1,hflip,vflip[v1];\
                   [v0][v1]vstack=inputs=2" inside_and_outside.MOV

transpose or rotate should work the same, I'm using yet another alternate hflip,vflip for illustration. Don't know which one is the fastest.