Answer the question
In order to leave comments, you need to log in
How to make ffmpeg resize video 1280x714 to 320x240?
There is a video with a resolution of 1280x714, SAR 1:1 DAR 640:357
You need to get a file with a resolution of 320x240 from it, preferably without cropping, but adding black bars.
What I tried:
1. I calculated the proportions of the reduced image based on the original width, i.e. 1280/320=4, so the image height will be 714/4=178.5 ~= 179 plus rounding up to the nearest even number, i.e. I set the height to 180
2. I calculate the height of the black bars that I add to the video 240-180=60 (30x2)
/usr/bin/ffmpeg -y -i "i.mp4" -acodec copy -vcodec mpeg4 -b:v 330k -vf "scale=320:180,pad=320:240:0:30:black,unsharp" -f mp4 "o.mp4"
I get the video 323x240
3. We take the height 178 instead of 180 and the black bars are 62px (31x2)
/usr/bin/ffmpeg -y -i "i.mp4" -acodec copy -vcodec mpeg4 -b:v 330k -vf "scale=320:178,pad=320:240:0:31:black,unsharp" -f mp4 "o.mp4"
I get the video 319x240
4. I try to apply a filter that will first cut the original video in height so that the height is divisible by 4 without a remainder. That is, 1280x714 -> 1280x712, while 1280/4 = 320, 712/4=178 and then I add stripes .
-vf "crop:in_w:in_h-2" //минус 2 пикселя от исходной высоты картинки
/usr/bin/ffmpeg -y -i "i.mp4" -acodec copy -vcodec mpeg4 -b:v 330k -vf "crop:in_w:in_h-2" -vf "scale=320:178,pad=320:240:0:31:black,unsharp" -f mp4 "o.mp4"
I get a video of 319x240
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question