Create video from image (fit but not stretch)

1.7k views Asked by At

I'm trying to create video from image but it's fit to video size (hd). How to keep aspect ratio of my image BUT get 1280 x 720 video?

Here is current result (image is 3264 x 2448 px, video 1280 x 720 px):

enter image description here

Here is my current command:

ffmpeg -loop 1 -i IMAGE_PATH -t 3 -s hd720 -c:v mpeg4 -pix_fmt yuv420p -preset ultrafast RESULT_PATH

Should I divide my task to two operations (generate image with black stripes then generate video)? Could you help to modify command to get desired result?

1

There are 1 answers

0
Chamath On

It is better to use aspect though you specify the s in the command.

-aspect 3264/2448

And also try pad to get the black bars around the output video without stretching the video to fit the screen size. This question is about that.

Hope this will help you!