0

I am using the following ffmpeg command to create multiple resolutions for the same video content.

ffmpeg -i ${f} -c:v libx264 -keyint_min 150 \
-g 150 -profile:v main -f h264 -dash 1 \
-an -vf scale=640:360 -b:v 750k ${streamsdirectory}/${filename}_640x360_750k.mp4 \
-an -vf scale=1280:720 -b:v 2000k ${streamsdirectory}/${filename}_1280x720_2000k.mp4 \
-an -vf scale=1920:1080 -b:v 4000k ${streamsdirectory}/${filename}_1920x1080_4000k.mp4

What is the best strategy to keep respect for the aspect ratio for any video content ?

1

To keep aspect ratio change:

-vf scale=640:360
-vf scale=1280:720
-vf scale=1920:1080

to:

-vf scale=-2:360
-vf scale=-2:720
-vf scale=-2:1080

See scale filter documentation for more info.

| improve this answer | |
1

If you want the output resolution to be 1280x720 and the video keeps its original ratio aspect as well:

ffmpeg  -v error -stats -i input -vf
"scale=1280:720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2"
output
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.