Answers.Body: <p>Use this:</p>
  
  <pre><code>-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"
  </code></pre>
  
  <p>This code evaluates which ratio to apply for scaling, then scales it and finally applys the requisite amount of padding.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-21T07:06:59.987Z
Answers.LastActivityDate: 2015-07-21T07:06:59.987Z
Answers.UserDisplayName: Gyan
Body: <p>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 </p>
  
  <pre><code>vf scale=1920:-1
  </code></pre>
  
  <p>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.   </p>
  
  <p>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.  </p>
  
  <p>Thank you in advance.  </p>
  
Tags: <ffmpeg><scale>
Title: ffmpeg - resize and crop
UserDisplayName: pirxx
ThreadText: # ffmpeg - resize and crop
  
  (Asked by: username_0 on 2015-07-21)
  
  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.
  
  **Tags:** ffmpeg, scale
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-21. Score: 6
  
  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.
  
  
  ---
  
  