title: FFmpeg - Change resolution of the video with aspect ratio
body: <p>all.</p>
  
  <p>How to change resolution of the video with aspect ratio with FFmpeg?</p>
  
  <p>There are options 
  <a href="http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html" rel="noreferrer">http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html</a></p>
  
  <pre><code>       -s size
         Set frame size. The format is wxh (ffserver default = 160x128,
         ffmpeg default = same as source).  The following abbreviations are
         recognized:
  </code></pre>
  
  <p>and</p>
  
  <pre><code>       -aspect aspect
         Set the video display aspect ratio specified by aspect.
  
         aspect can be a floating point number string, or a string of the
         form num:den, where num and den are the numerator and denominator
         of the aspect ratio. For example "4:3", "16:9", "1.3333", and
         "1.7777" are valid argument values.
  </code></pre>
  
  <p>For example, I have two input videos:</p>
  
  <ul>
  <li>with 200*400 resolution</li>
  <li>with 400*700 resolution</li>
  </ul>
  
  <p>I need to make output video with 100*200 resolution.</p>
  
  <p>If I will run ffmpeg with -s 100x200, then second video will have bad aspect ratio.</p>
  
  <p>How can I limit output video by width, with auto aspect ratio by height?</p>
  
  <p>For example, I want specify for the output video only width 100px and ffmpeg must automatically calculate height with right aspect ratio.</p>
  
  <p>For first video it will be:</p>
  
  <p>200/100=2</p>
  
  <p>400/2=200</p>
  
  <p>Ie 100x200</p>
  
  <p>For second video it will be:</p>
  
  <p>400/100=4</p>
  
  <p>700/4=75</p>
  
  <p>Ie 100x75</p>
  
  <p>Is it possible?</p>