I am going to re-sample a bunch of videos to be played through web browsers. (Current video is large, 3 MB for a 4s clip. Hoping to compress by 90%).

Use: These videos will be played in a web-based eduational app. They'll be up to about 5 seconds and be played in the latest Chrome or (on iOS/Mac) Safari browser.

I'm using Handbrake (.9.9.5530, latest) . These must be playable in Chrome and Safari (latest versions) browsers without any pluggins (and would be nice to be playable in the latest FireFox and IE). (I'm also open to using another free or cheap encoding software that will let me do batch processing.

What are the recommended settings (Video Codec, Quality (and constant or avg bit rate, etc.) My top priority is compatibility.

  • How are you planning to embed the final video file into a web page without using plugins? This will help us determine the best codec for this problem.
    – nchpmn
    Commented Feb 3, 2014 at 0:20
  • I'd assume he means HTML5 <video>. Google up an x264 encoding guide for ffmpeg / x264. Commented Jan 20, 2015 at 6:21

4 Answers 4


If compatibility is your top priority, then you should include two alternative versions of your video on your website, like in this HTML example.

As for the exact formats I would suggest:

  • H.264 and AAC in MP4: Chrome, Firefox 22+ on Windows, IE9, Safari 3.1
  • VP8 and Vorbis in WebM: Firefox fallback for Mac and older versions on Windows.
  • (If you need support for even older browsers (IE6-8), and mobile (Android, WP7), you could add mediaelement.js to your website.)

Make sure to put them in that order to make the fallback work. H.264 or MPEG-4 are recommended because they are the only formats to have hardware acceleration on newer devices.

Compression settings: start by using constant quality with default settings for video and 128 Kbps VBR audio. For H.264 make sure to not exceed Main Profile and Level 4.0. And since Handbrake doesn't do the WebM format, you could try Miro Video Converter.

  • Why would you ever use Main, not High, profile, for anything? I thought HW decoders were usually either baseline or high, so worse compression (no 8x8dct) for no or very small gain in combatibility. Commented Jan 20, 2015 at 6:11
  • The Main profile recommendation comes from the mobile device world. For example most Apple A4 and A5 processors are H.264 Main profile limited. More specifically iPod Touch 4G & 5G, iPod 1 & 2, iPhone 4, AppleTV 2G & 3G (model A1427). Anything beyond is High profile.
    – Duvrai
    Commented Jan 20, 2015 at 9:08
  • Yeah I googled a bit after posting that comment. Unfortunately it seems there are a fair amount of HW decoders that support Main but not High, so a year or two of phones. I guess it makes sense that 8x8dct might require different logic blocks on a FPGA or ASIC, unlike the case for software where it's not hard. (CPU power to decode CABAC is the hard part for going from baseline to main, for software I think.) Anyway, blargh, are we never going to get rid of sub-optimally encoded videos, thanks to crappy devices? As soon as we do, devices with partial h.265 support will come out... square 1 Commented Jan 20, 2015 at 19:23

There's a table here showing support for the various video codecs by the four main browsers around today. For Chrome and Safari the only option that plays on both is h.264 in an mp4 container.

I've found that main profile h264 video plays best across most modern devices, but you can wind it back to base profile if you're having problems. This is a good discussion about the differences between the profiles.

A quality setting of 20 is a good place to start; it's a good compromise between size and quality, but you could tweak depending on your results.


h.264 + aac in .mp4.

Google up an x264 settings guide. (or use -preset slower). If you're doing something that the MPEG-LA would charge patent royalties for, screw them and use VP8 or VP9, with maybe a fallback to Theora if that helps compat.

Old question, but check the quality at the start of the video if using x264. If it's not good, use 2-pass. I forget if it's only 1pass ABR (average bitrate) mode that does this, or if it also happens sometimes with CFR (constant quality regardless of source resolution or complexity, normally the go-to choice for one pass).


h.264 is probably the easiest. Just about anything plays it, particularly if you use a base profile (which reduces effectiveness, but also simplifies the playback for lower powered devices).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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