Answers.Body: <p>Yes it is. This will give you the default encoding settings, which are generally fine for web use. </p>
  
  <p>You can specify settings to tweak the size, speed and quality, but you don't <em>need</em> to to get good results. The best guide I know of is the <a href="https://trac.ffmpeg.org/wiki/Encode/H.264" rel="nofollow noreferrer">ffmpeg h.264 encoding guide</a> wiki page.</p>
  
  <p>For example, you could adjust the quality with the Constant Rate Factor setting (don't worry too much about what constant rate factor actually means, it's really just the quality setting) using <code>-crf x</code> where x is an interger between 0 (lossless, large file size not generally compatible with web delivery) and 51 (pretty crappy, small file size). The default is 23, which is pretty good, 17 is regarded as visually lossless, and somewhere between 17-28 is a sane value.</p>
  
  <p>Another setting is the speed. If you're using CRF, adjusting the speed won't affect the <em>quality</em> of the output, it will just affect the <em>file size</em>—faster compression basically means the software will spend less time optimising, so the file will be larger. Speed is controlled by using the option<br/><code>-preset presetname</code>, where <code>presetname</code> is one of (in decreasing order of speed / increasing file size): <code>ultrafast</code>, <code>superfast</code>, <code>veryfast</code>, <code>faster</code>, <code>fast</code>, <code>medium</code>, <code>slow</code>, <code>slower</code>, <code>veryslow</code>, and <code>placebo</code>.</p>
  
  <p>The playback devices that you expect the video to be played on is another thing you might want to consider. Setting the <code>-profile:v</code> and <code>-level</code> option (the <code>:v</code> bit means you're setting the profile for the video stream only) means that you can choose between more efficient compression with a higher profile/level, and greater compatibility with older or less powerful devices with lower profile/  level. <code>-profile main</code> is probably wise if you're expecting a general web audience, it's compatible with all iPads, apple tv2 and iPhone4 and their non-fruity equivalents. If your target audience is likely to be using an iPod touch gen 2 you might want to go with <code>-profile:v baseline</code> and if you want to be certain it can be played by as many devices as possibel you could specify the level as well, <code>-profile:v baseline -level 3.0</code></p>
  
  <p>As @LordNeckbeard pointed out, if you're encoding for web use where the video will be embedded in an HTML5 <code>&lt;video&gt;</code> tag then adding the option <code>-movflags +faststart</code> will allow the video to start playing as it downloads.</p>
  
  <p>Putting it all together, this is an example of how you chain options together in ffmpeg. This is a very basic example, ffmpeg is extremely powerful and your commands can be as complicated as you want them to be. This example will give you high quality, be playable on older/less powerful machines, and chooses smaller file size over encoding speed. It is not a recommended setting, just an example of how you specify the encoding options:</p>
  
  <pre><code>ffmpeg -i thefile.wmv -profile:v main -crf 20 -preset slow output.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-21T05:40:36.790Z
Answers.Text: I wouldn't use `veryslow`. That ramps up the refs count to upto 16. Can't be pleasant on underpowered devices. May also add some latency to startup. Stick to `slow` or add `-x264-params refs=4`
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-21T20:03:31.400Z
Answers.Text: @stib For viewing via progressive download, such as putting the MP4 on a server and presenting it with the HTML5 `<video>` element, adding `-movflags +faststart` is highly recommended. Otherwise the video will need to be completely downloaded before playback can begin.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-22T01:49:10.137Z
Answers.Text: Thanks. I'll make some edits. I should note that the example isn't necessarily a recommended setting, just an example of how you chain options together in ffmpeg.
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-21T04:12:03.167Z
Answers.LastActivityDate: 2018-06-22T01:58:07.473Z
Answers.LastEditDate: 2018-06-22T01:58:07.473Z
Answers.UserDisplayName: stib
Body: <p>I want to convert avi and wmv to mp4 for web and I use below code:<br>
  ffmpeg -I input.wmv output.mp4<br>
  Is that enough?</p>
  
Tags: <ffmpeg><mp4><conversion>
Title: How convert avi and wmv to mp4 for html video tag?
UserDisplayName: Hamed Moodi
ThreadText: # How convert avi and wmv to mp4 for html video tag?
  
  (Asked by: username_0 on 2018-06-20)
  
  I want to convert avi and wmv to mp4 for web and I use below code:  
  ffmpeg -I input.wmv output.mp4  
  Is that enough?
  
  **Tags:** ffmpeg, mp4, conversion
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-21. Score: 0 | Accepted answer
  
  Yes it is. This will give you the default encoding settings, which are generally fine for web use.
  
  You can specify settings to tweak the size, speed and quality, but you don't *need* to to get good results. The best guide I know of is the [ffmpeg h.264 encoding guide](https://trac.ffmpeg.org/wiki/Encode/H.264) wiki page.
  
  For example, you could adjust the quality with the Constant Rate Factor setting (don't worry too much about what constant rate factor actually means, it's really just the quality setting) using `-crf x` where x is an interger between 0 (lossless, large file size not generally compatible with web delivery) and 51 (pretty crappy, small file size). The default is 23, which is pretty good, 17 is regarded as visually lossless, and somewhere between 17-28 is a sane value.
  
  Another setting is the speed. If you're using CRF, adjusting the speed won't affect the *quality* of the output, it will just affect the *file size*—faster compression basically means the software will spend less time optimising, so the file will be larger. Speed is controlled by using the option  
  `-preset presetname`, where `presetname` is one of (in decreasing order of speed / increasing file size): `ultrafast`, `superfast`, `veryfast`, `faster`, `fast`, `medium`, `slow`, `slower`, `veryslow`, and `placebo`.
  
  The playback devices that you expect the video to be played on is another thing you might want to consider. Setting the `-profile:v` and `-level` option (the `:v` bit means you're setting the profile for the video stream only) means that you can choose between more efficient compression with a higher profile/level, and greater compatibility with older or less powerful devices with lower profile/ level. `-profile main` is probably wise if you're expecting a general web audience, it's compatible with all iPads, apple tv2 and iPhone4 and their non-fruity equivalents. If your target audience is likely to be using an iPod touch gen 2 you might want to go with `-profile:v baseline` and if you want to be certain it can be played by as many devices as possibel you could specify the level as well, `-profile:v baseline -level 3.0`
  
  As @LordNeckbeard pointed out, if you're encoding for web use where the video will be embedded in an HTML5 `<video>` tag then adding the option `-movflags +faststart` will allow the video to start playing as it downloads.
  
  Putting it all together, this is an example of how you chain options together in ffmpeg. This is a very basic example, ffmpeg is extremely powerful and your commands can be as complicated as you want them to be. This example will give you high quality, be playable on older/less powerful machines, and chooses smaller file size over encoding speed. It is not a recommended setting, just an example of how you specify the encoding options:
  
  ```
  ffmpeg -i thefile.wmv -profile:v main -crf 20 -preset slow output.mp4
  
  ```
  
  > **Comments:**
  > **username_2**: I wouldn't use `veryslow`. That ramps up the refs count to upto 16. Can't be pleasant on underpowered devices. May also add some latency to startup. Stick to `slow` or add `-x264-params refs=4`  
  > **username_3**: @username_1 For viewing via progressive download, such as putting the MP4 on a server and presenting it with the HTML5 `<video>` element, adding `-movflags +faststart` is highly recommended. Otherwise the video will need to be completely downloaded before playback can begin.  
  > **username_1**: Thanks. I'll make some edits. I should note that the example isn't necessarily a recommended setting, just an example of how you chain options together in ffmpeg.  
  
  ---
  
  