Reputation: 1582
I'm trying to use ffmpeg for rendering video where an audio file and image are taken as inputs, and turned into a video (basically a music video) with the audio file playing for the duration of the video.
My current working command:
ffmpeg -loop 1 -framerate 2 -i "front.png" -i "testWAVfile.wav" -vf "scale=2*trunc(iw/2):2*trunc(ih/2),setsar=1,format=yuv420p" -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a aac -shortest -vf scale=1920:1080 "outputVideo.mp4"
Will set the output resolution of the video to whatever the resolution of the image is. Is there a way I can resize the image to enlarge it by a couple multiplications so that the output video resolution will be higher?
Like if my front.png
image was 800x800 pixels, I could add something to my ffmpeg command to triple the resolution, so that the output video resolution is 2400x2400?
Upvotes: 1
Views: 6947
Reputation: 134173
The simplest method is to use scale=iw*3:-1
.
However, since using libx264 with yuv420p requires width x height to be divisible by 2 use scale=2*trunc(iw/2*3):-2
.
Or just declare the size you want: scale=2400:-1
Example:
ffmpeg -loop 1 -framerate 2 -i "front.png" -i "testWAVfile.wav" -vf "scale=2*trunc(iw/2*3):-2,setsar=1,format=yuv420p" -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a aac -shortest "outputVideo.mp4"
-vf
at a time as the other will be ignored.Upvotes: 3
Reputation: 1150
Scale the image front.png using the ffmpeg cmd
ffmpeg -i front.png -vf scale=2400:2400 output_2400x2400.png
use the output of this cmd (output_2400x2400.png as input image) in your working video generating cmd
-vf scale=2400:2400
Upvotes: 1