I want to know how to use the scale filter to take an image that is 2154x1136 and scale it down exactly 89.04% such that the image sits in a 1920x1080 frame, with full image left and right and black letterboxing top and bottom. Using

vf scale=1920:-1

gets me close. But the resulting file is 1920x1013 and I need to add black pixels top and bottom to fill it out to 1920x1080.

I have other issues including how to feed ffmpeg a dpx sequence and get back an Avid-ready MXF while applying a shot specific cdl file and a show specific display lut, but I need to walk before I can run so a bit of help with this first puzzle is what I'm asking for now.

Thank you in advance.


Use this:

-vf "scale=iw*min(1920/iw\,1080/ih):ih*min(1920/iw\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\,1080/ih))/2:(1080-ih*min(1920/iw\,1080/ih))/2"

This code evaluates which ratio to apply for scaling, then scales it and finally applys the requisite amount of padding.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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