Brightcove
Support+1 888 882 1880
Products
Solutions
Resources
Company
Search IconA magnifying glass icon.
Talk to Us

Back

By Cameron Church

Technical Channel Director, EMEA at Brightcove

TAGS


H264 encoding using Mediacoder

Brightcove News

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 (very) 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 really squeeze the most from your encoding.

For 99% of us this is just too much specialised 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:


Download Mediacoder, an open sourced GUI tool that allows you to transcode your videos to H.264 (ready for Brightcove upload) free of charge (they have a command line tool for a cost if you like it enough).

Set up Mediacoder following these instructions (baseline taken from the great blog by Fabio Sonatti):

/*********************************************/
Start of Settings

Go to
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 like 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

Click "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)

The only settings left under MediaCoder Preferences window is Alpha and Beta deblocking.

Please read: How To Use Mpeg4 AVC Deblocking Effectively (Small FAQ)

Deciding what values to use is a personal choice. In this example, I will 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 "X" button in the upper right hand corner of MediaCoder Preferences window.

Muxer Tab
"Enable" radio button

Multiplexer: MP4Box

End of Settings
/*********************************************/

Now run your videos through and see the output. REMEMBER - the better your source file the better ANY transcode output will be.

My test follows - I used a 1080p hi-res WMV file as an input

Standard Encode at 500K (uses Dynamic Delivery so you might get a higher rendition):


Custom Encode using Mediacoder and above settings at 500Kbps


You should see much less blockiness at quality degredation during fast moving, complex scenes (look at the waves in transition)

And the best bit?  This file is ready for upload for immediate play back by any Brightcove player as well as it's ready for playback (thanks to the Baseline setting) on the iPhone - with a size that fits!

Not too bad.


BACK TO TOP