How To Encode H.264/MPEG-4 Videos for Video Sharing

These guidelines will ultimately present a compromise between maintaining a small file size (less than 100MB for Youtube) and maintaining as much original information from the video content itself as possible to ensure the highest quality result. While this is our recommendation specifically for encoding for use on Youtube, these settings should be good overall for most other video sharing sites as well.

  1. We recommend that you use the H.264 codec, the best MPEG4 codec in the market today.
  2. Set quality option to "best”
  3. Set rate control to 1-pass CBR (Constant Bit Rate). Youtube transcoders prefer CBR so forget about Variable Bit Rate.
  4. For key frames, set them to every 30 frames or less. The more keyframes the better as it will offer more information and Youtube transcoders love keyframes. However, keep an eye on file size.
  5. We recommend that you set the bit rate to 1500 kbps or more, depending on the time/length of your video. Just like with keyframes, keep an eye again on file size. You should be good setting this to as high as 2000kbps for shorter length video clips.
  6. As far as resolution and aspect ratio, Youtube resizes your video upon upload to 320×240. Rather than having your video be resized by Youtube, which uses bicubic, bilinera method, use your compression software as it likely has a better algorithm for resizing the aspect ration.
    1. If you are working with video content that is 16:9 (widescreen), you have 3 possible options:
      1. Let YouTube letterbox your 16X9 videos automatically. Our recommendation would be to do this prior to uploading to Youtube, see below.
      1. Pan and scan - Fit the height of your video inside the 4:3 viewport, then crop off the excess left and right sides.
      2. Letterbox - Fit the width of your video inside the 4:3 viewport, then put black bars above and below your video to keep it centered vertically.
        1. There is a great post here that will show you in-depth instructions for resizing your widescreen videos for fitting within a 4:3 players.
  7. You probably don't need us to tell you this, but set the frame rate to 30 fps.
  8. For audio, set the compression to MP3 or AAC, with 44.1KHz, 64kbps, 16bit, mono.
  9. Make sure you de-interlace your video if there is a lot of motion.
  10. Use brightness, contrast, and sharpening filters to enhance the look of your video.

Other Great Resources:

  • Creating Video Content with H.264
    QuickTime 7 Pro makes it really easy to create stunning video with the new H.264 video codec in QuickTime 7.
  • FLV CompressionThis article features some tips and tricks for compressing and delivering video to the web.
  • Poking at YouTube
    Read this article on how YouTube might be doing its Flash server encoding.
  • Formats for Youtube
    This wiki page keeps a log of all the video formats that are acceptable for Youtube as well as the ones that failed upon upload.
Don't Miss Out - Join Our VIP Video Marketing Community!
Get daily online video tips and trends via email!
About the Author -
Mark Robertson is the Founder and Publisher of ReelSEO, an online information resource dedicated to the fusion of video, technology, social media, search, and internet marketing. He is a YouTube Certified, video marketing consultant and video marketing expert, popular speaker, and considered to be a passionate leader within the online video and search marketing industries. View All Posts By -

What do you think? ▼
  • http://blog.codesignstudios.com/ Dennison Uy

    Nice article, but it would have been more helpful if you indicated what software you were using and provided links to the actual software.

    • http://www.reelseo.com/ Mark Robertson

      I would recommend the following but there are tons of available tools - quicktime, handbrake, adobe media encoder, sorenson squeeze, or apply compressor. Hope that helps

  • http://www.thebizseller.com/sellinfo.htm TheBizSeller.com

    Mark:

    Thanks for these directions - they have really helped to maintain the quality while keeping the file size small. My problem is that when I follow these direction I get file with extension .m2ts and only Youtube will accept it. I'm using Power Director 8 to edit my videos and I choose H.264/MPEG-4 as the way to produce the video.

    Any suggestions on what I can do to produce a more widely accepted format?

    Thanks ,

    • http://www.reelseo.com/ Mark Robertson

      Pat.... if you are exporting h.264/MPEG-4, you should have an extension
      .mp4.... .m2ts sounds like it is being formated for blueray. I dont have
      power director 8 but you want to export the video as .mp4... Does that
      help?