How to Encode H.264 Using MediaCoder
Tech Talk
For some of our publishers and partners, there exists very valid reasons to use their own external media transcoding workflow which excludes the use of the BC3 Server-Side Transcoding functionality.
Those that need to really turn the screw on control of end quality and size, you'll need to really dig deep in the more advanced levers available in the encoding process. Things like the Profile, Level, and Predictor Frames are just some of the things you need to tweak to squeeze the most from your encoding.
For 99% of us, this is just too much specialized detail to get our heads around. Luckily the internet is here to save us as a gateway to the real experts out there.
Here's something to try.
How to Get MediaCoder
Download MediaCoder, an open sourced GUI tool that allows you to transcode your videos to h.264 free of charge. They have a command line tool for a cost if you like it enough.
How to Set Up MediaCoder
Set up MediaCoder following these instructions.
File menu --> Revert All Settings
Audio Tab
Select what makes the most sense for you. Remember that audio takes up space and the majority of your audio will be consumed and limited by the quality of PC speakers, so don't feel you need to up much here.
Video Tab
- Mode: Bitrate-based
- Bitrate: 500 kbps (start with this and vary it to see how things improve)
- Format: h.264
- Container: MP4
- Source: (Auto-Select)
- Encoder: (Auto-Select)
x264 Tab
- Profile: High
- Predictor Frames: 6
- Motion Est. Mode: Normal
- Motion Est. Range: 16
- Level: 5.1
- B-Frames: 5
- Subpel Refinement: 7
MediaCoder Preference Window
Click the "Advanced" button --> MediaCoder Preferences Window
Video Encoders
|-----x264
- Bitstream profile = Baseline (highlight and select "Baseline" in the drop down box below)
- Level of bitstream = 51 (enter value in the box below and click apply button)
- Frames used as predictors in B and P frames = 6 (enter value in the box below and click apply button)
- Maximum B frames between I and P frames = 5 (enter value in the box below and click apply button)
- B-frames decision = true (click "Yes" radio button below)
- B-frames used as for predicting = true (click "Yes" radio button below)
- Use CABAC = true (click "Yes" radio button below)
- Direct macroblocks prediction = Auto (highlight and click "Auto" in the drop down box below)
- Use weighted prediction for B-frames = true (click "Yes" radio button below)
- Adaptive spatial transform size = true (click "Yes" radio button below)
- Fullpixel motion estimation algorithm = Hexagonal (highlight and click "Hexagonal" in the drop down box below)
- Subpel refinement quality = 7 (enter value in the box below and click apply button)
- Mixed reference frame = true (click "Yes" radio button below)
- Rate-distortion optimization of B-frames macroblock type = true (click "Yes" radio button below)
- Refine motion vectors use in bidirectional macroblocks = false (click "No" radio button below)
- Rate-distortion optimal quantization = Enable during all mode decisions (highlight and click "Enable during all mode decisions" in the box below)
- Performs early skip detection in P-frames = false (click "No" radio button below)
- Threads (0 for auto) = 6 (enter value in the box below and click apply button)
Alpha and Beta Deblocking
The only settings left under the MediaCoder Preferences window is Alpha and Beta deblocking. For more information, please read How To Use Mpeg4 AVC Deblocking Effectively (Small FAQ).
Deciding what values to use is a personal choice. In this example, we'll be using more detailed look and occasional block setting of -2:-1.
- Alpha parameter of deblocking filter = -2 (enter value in the box below and click apply button)
- Beta parameter of deblocking filter = -1 (enter value in the box below and click apply button)
Click the "X" button in the upper right-hand corner of the MediaCoder Preferences window.
Muxer Tab
- Radio button: Enable
- Multiplexer: MP4Box
Check Mediacoder Output
Run your videos through and see the output. Remember, the better your source file the better any transcode output will be.
You should see much less blockiness or quality degradation during fast moving, complex scenes (look at the waves in transition).
This file is ready for upload and immediate playback by any Brightcove player as well as the iPhone (thanks to the Baseline setting).