How to do that? I need a fast method to make Instagram moments of ready videos without using video editor.
Asked
Active
Viewed 5,620 times
1 Answers
4
The method below assumes that the source aspect ratio isn't greater than 720/1280.
ffmpeg -i in.mp4 -vf scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1 out.mp4
The force_original_aspect_ratio in the scale 'fits' the video within the dimensions specified. The pad then expands the canvas to get the size desired.
Gyan
- 34,439
- 6
- 56
- 98
-
With thanks to https://video.stackexchange.com/a/16686, here is a way to make that same padding white, as well as being another example of how to scale a mobile-originating video (in vertical format) correctly to horizontal as well as adjust the video and audio speed at the same time: `ffmpeg -y -i "mobile_input.mp4" -filter_complex "[0:v]setpts=1.5*PTS,scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:white,setsar=1/1,setdar=16/9[v];[0:a]atempo=(1/1.5)[a]" -map "[v]" -map "[a]" output.mp4` More info then the original question... but it may help someone.. – Roel Van de Paar May 30 '19 at 00:35