Answers.Body: <p>using the scale filter will do it, but there is a bit more to it.</p>
  
  <pre><code>ffmpeg -i input.mov -vf scale=720x406 output.mov 
  </code></pre>
  
  <p>will create a movie with the required pixel dimensions, but if you look at the output you'll find that it adds information into the metadata so that it will play back at the same aspect ratio as the original, by using non-square pixels. So if you want to stretch the movie anamorphically to a new aspect ratio you need to manually set the pixel aspect ratio, called the SAR for "Sample Aspect Ratio", thus for square pixels use:</p>
  
  <pre><code>ffmpeg -i input.mov -vf scale=720x406,setsar=1:1 output.mp4
  </code></pre>
  
  <p>Alternatively you can set the display aspect ratio to whatever you want, thus:</p>
  
  <pre><code>ffmpeg -i input.mov -vf scale=720x406,setdar=16:9 output.mp4
  </code></pre>
  
  <p>What I'm doing with the <code>-vf</code> command and the <code>x=y,z=a</code> expressions that follow is creating a chain of <a href="http://ffmpeg.org/ffmpeg-filters.html" rel="noreferrer">filters</a>. Filters can be quite complex, but in the most simple usage they take the form <code>effect=parameter,nexteffect=anotherparameter</code>, and they get processed in the order you write them.</p>
  
  <p>You may want to put additional commands for the codec and so on, eg <code>-c:v libx264</code> to use the x264 mp4 encoder, and something like <code>-crf 20</code> to set the constant rate factor to 20 (usually a pretty good compromise between size and quality). So, a reasonably complete command would look like:</p>
  
  <pre><code>ffmpeg -i input.mov -vf scale=720x406,setdar=16:9 -preset slow -profile:v main -crf 20 output.mov
  </code></pre>
  
  <p>Main profile is good for device compatibility, the <code>slow</code> preset for the libx264 encoder is a pretty good balance of speed and quality, so this is a good general web-encoding workhorse. You can make it faster by using <code>fast</code> or <code>veryfast</code> or slower with <code>veryslow</code> and <code>placebo</code> will make it ever so slightly better than <code>veryslow</code> at the expense of a lot more processing time (hence the name).</p>
  
  <p>BTW <strong>Don't use -c copy</strong>, that means just copy the video and audio streams without doing anything to them <em>at all</em>, so nothing you do in terms of scale, codec, bitrate etc will have <em>any</em> effect.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-23T00:06:30.367Z
Answers.Text: If you're using recent versions of ffmpeg you don't need to stipulate x264 as the codec any more, but it still might be worth looking at what settings you might want.
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-10T05:03:04.797Z
Answers.Text: I think metadata only has a DAR field. So using `setsar` is just indirectly setting the DAR?
Answers.UserDisplayName: jiggunjer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-14T12:49:32.817Z
Answers.Text: I have to use "-c copy", but in other side I want to resize screen. How can I achieve this?
Answers.UserDisplayName: Dr.jacky
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-15T00:32:49.470Z
Answers.Text: @Mr.Hyde you should ask this as a new question instead of asking in a comment
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-01-19T13:15:29.707Z
Answers.LastActivityDate: 2020-02-03T03:36:47.947Z
Answers.LastEditDate: 2020-02-03T03:36:47.947Z
Answers.UserDisplayName: stib
Body: <p>I'm new to this StackExchange site, and to using the FFmpeg encoder. I have a video that is 720x480 (3:2) that I would like to change to 720x406 (16:9) to match the other videos I have for a site. I have tried various command combinations, including:</p>
  
  <pre><code>ffmpeg -i myfile.mv4 -s 720x406 outfile.mp4
  ffmpeg -i myfile.m4v -c copy -aspect 16:9 outfile.mp4
  </code></pre>
  
  <p>What I end up with is a video that scaled down to the specified height, but didn't preserve the width.  It ends up at 608x406 or thereabouts. I've been playing with various GUI versions of FFmpeg today, and they seem to do the same thing.</p>
  
  <p>What would be the proper options/parameters to pass in (assuming I'll have more control via the command line) to achieve the desired frame size?</p>
  
Tags: <ffmpeg>
Title: How do I change frame size, preserving width (using ffmpeg)?
UserDisplayName: eljefejb
ThreadText: # How do I change frame size, preserving width (using ffmpeg)?
  
  (Asked by: username_0 on 2014-01-17)
  
  I'm new to this StackExchange site, and to using the FFmpeg encoder. I have a video that is 720x480 (3:2) that I would like to change to 720x406 (16:9) to match the other videos I have for a site. I have tried various command combinations, including:
  
  ```
  ffmpeg -i myfile.mv4 -s 720x406 outfile.mp4
  ffmpeg -i myfile.m4v -c copy -aspect 16:9 outfile.mp4
  
  ```
  
  What I end up with is a video that scaled down to the specified height, but didn't preserve the width. It ends up at 608x406 or thereabouts. I've been playing with various GUI versions of FFmpeg today, and they seem to do the same thing.
  
  What would be the proper options/parameters to pass in (assuming I'll have more control via the command line) to achieve the desired frame size?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-01-19. Score: 49 | Accepted answer
  
  using the scale filter will do it, but there is a bit more to it.
  
  ```
  ffmpeg -i input.mov -vf scale=720x406 output.mov 
  
  ```
  
  will create a movie with the required pixel dimensions, but if you look at the output you'll find that it adds information into the metadata so that it will play back at the same aspect ratio as the original, by using non-square pixels. So if you want to stretch the movie anamorphically to a new aspect ratio you need to manually set the pixel aspect ratio, called the SAR for "Sample Aspect Ratio", thus for square pixels use:
  
  ```
  ffmpeg -i input.mov -vf scale=720x406,setsar=1:1 output.mp4
  
  ```
  
  Alternatively you can set the display aspect ratio to whatever you want, thus:
  
  ```
  ffmpeg -i input.mov -vf scale=720x406,setdar=16:9 output.mp4
  
  ```
  
  What I'm doing with the `-vf` command and the `x=y,z=a` expressions that follow is creating a chain of [filters](http://ffmpeg.org/ffmpeg-filters.html). Filters can be quite complex, but in the most simple usage they take the form `effect=parameter,nexteffect=anotherparameter`, and they get processed in the order you write them.
  
  You may want to put additional commands for the codec and so on, eg `-c:v libx264` to use the x264 mp4 encoder, and something like `-crf 20` to set the constant rate factor to 20 (usually a pretty good compromise between size and quality). So, a reasonably complete command would look like:
  
  ```
  ffmpeg -i input.mov -vf scale=720x406,setdar=16:9 -preset slow -profile:v main -crf 20 output.mov
  
  ```
  
  Main profile is good for device compatibility, the `slow` preset for the libx264 encoder is a pretty good balance of speed and quality, so this is a good general web-encoding workhorse. You can make it faster by using `fast` or `veryfast` or slower with `veryslow` and `placebo` will make it ever so slightly better than `veryslow` at the expense of a lot more processing time (hence the name).
  
  BTW **Don't use -c copy**, that means just copy the video and audio streams without doing anything to them *at all*, so nothing you do in terms of scale, codec, bitrate etc will have *any* effect.
  
  > **Comments:**
  > **username_1**: If you're using recent versions of ffmpeg you don't need to stipulate x264 as the codec any more, but it still might be worth looking at what settings you might want.  
  > **username_2**: I think metadata only has a DAR field. So using `setsar` is just indirectly setting the DAR?  
  > **username_3**: I have to use "-c copy", but in other side I want to resize screen. How can I achieve this?  
  > **username_1**: @Mr.Hyde you should ask this as a new question instead of asking in a comment  
  
  ---
  
  