H.264 Encoding Guide PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5
At a glance
Powered by AI
The document discusses H.264 encoding profiles and levels, advanced encoding settings in Carbon Coder, and two new filters to increase video quality: MCTF and deblocking filter.

Profiles define which features of the H.264 codec are allowed, while levels define value parameters for those features. Profiles and levels provide guidelines for video content creators and playback devices on compatible formats.

The two new filters in Carbon Coder 3.14 are the Motion-Compensated Temporal Filter (MCTF) and the De-Blocking Filter. MCTF removes non-visible high frequency noise from rapid motion. The De-Blocking Filter smooths blockiness from previous compression.

Application Notes: Carbon Coder H.

264 Encoding Guide

Profiles and Levels


Advanced H.264 Encoding
The H.264 specification defines several
profiles and levels as part of the codec. with Carbon Coder
Profiles and levels provide a set of agreed-
upon guidelines between video content Achieving better video quality is often a trade-off with transcoding perfor-
creators and the engineers developing
mance (i.e., the amount of time it takes to transcode). The presets that
players and playback devices on which
ship with Carbon Coder are designed for a balance between optimal quality
video content will be played back. Profiles
and optimal performance. The recommendations in this guide will increase
define which features of the codec are
allowed, while levels define the value video quality at some cost to transcoding performance. Conversely, if
parameters for those features. performance is your main concern, you can configure your presets to the
opposite of these recommendations.
For example, most mobile phones support
Baseline profile at Level 3. So when you
create a preset for video to be played on a
mobile phone, you must set Carbon Coder
To Load the Carbon Coder H.264 Preset
to Baseline profile at Level 3. Carbon Download the CPF file:
Coder will then grey out all of the features
shown in the UI, which are not allowed ftp://xfer:[email protected]/Presets/dst_H_264_HQ_SD.cpf
in Baseline profile, and set the maximum
Place the CPF file in one of the following two folders.
values allowed to all other parameters
according to Level 3. • Windows XP or 2003
A full description of profiles, levels and C:\Documents and Settings\All Users\Application Data\Rhozet\
their limits, as well as more information Carbon Product Name\User Presets
about H.264 in general, can be found at:
• Windows Vista, 7, or 2008
http://en.wikipedia.org/wiki/H.264/
MPEG-4_AVC C:\ProgramData\Rhozet\Carbon Product Name\User Presets

Next, start Carbon Coder, add a new target and, under the system
category, you’ll find a new preset called “H.264 High Quality SD.”

This guide is intended to help explain some of the advanced settings in the
Rhozet Carbon Coder H.264 encoder. It also contains recommendations to
maximize video quality for each setting.

To Access the H.264 Encoding Advanced Settings


These settings can be found by loading the H.264 preset in Carbon Coder
and then clicking on Advanced.

A Business Unit of Harmonic Inc.


Application Notes: Carbon Coder H.264 Encoding Guide Page 2

Two New Filters to Carbon Coder H.264 Advanced Encoding Settings


Increase Video Quality

In addition to new encoding parameters, Adaptive Quantization Strength


Carbon 3.14 boasts two new video filters
you can apply to source content to Adaptive Quantization Strength - Brightness – Specifies the strength
increase video quality. of the quantization for Brightness. The available range is from -100 to 100
inclusive. A higher value indicates coarser quantization; lower values
The Motion-Compensated Temporal
indicate finer values. The advantage to using finer values is most often
Filter (MCTF) is an advanced algorithm
realized in higher bitrates. For general use presets, this value should be
developed by Harmonic. Used in the
award-winning Electra line of encoders, left at 0 however, for specific types of source footage, this value can be
MCTF removes non-visible high frequency adjusted higher or lower and typically requires a little “playing around
noise introduced mostly due to rapid with” to get just right.
motion in the source. With MCTF, you’ll
Adaptive Quantization Strength - Complexity – Same as above
be able to get equivalent video quality at
lower bitrates because the encoder is not
Adaptive Quantization Strength - Contrast – Same as above
compressing the high-frequency noise.
This filter is most effective when the
source has rapid motion, like a basket- B-frames
ball game, and the target is low-bitrate,
Reference B-Pictures – Allows the encoder to use B-frames as a refer-
such as web or mobile output. The filter
ence to build other frames. This also increases the efficiency of the encoder
strength setting should be set higher for
higher levels of motion. We recommend and should always be checked. Not available in Baseline profile.
leaving the Motion Estimation set to Auto,
Use Adaptive B-frame Placement – Allows the encoder to adaptively
to allow the filter to adaptively change as
change the B-frame pattern based on the source content. This is very use-
the source frames vary.
ful when you are using a longer GOP and trying to hit low bitrates. In gen-
The De-Blocking Filter from Harmonic eral, this increases the encoder’s efficiency and should always be checked.
is also used in Electra encoders. The
Not available in Baseline profile.
De-Blocking Filter should be used only
if the source content contains blocki- Allow Pyramid B-frame Coding – Allows the encoder to compress
ness due to previous digital compression. B-frames based on other B-frames. Like the above two settings this
This filter smoothes the edges of blocks, increases the efficiency of the encoder and should always be checked. Not
softening the image but creating a more
available in Baseline profile.
visually appealing output. It is particularly
useful transcoding from interlaced source
to progressive output. The filter strength Black Normalization Level
should be raised for source content with
Specifies the pre-encode black level. The default is 0; the available range
more blockiness. It is important to note
that this filter is applied before the com- from 0 to 32. So, for example, a broadcast source could be set to 16 if the
pression, so it will not reduce blockiness blacks aren’t being properly preserved.
introduced by the encode itself.

Deblocking

Use Deblocking – Turns the encoder’s In-Loop Deblocking filter on and


off. It is almost always recommended to enable this for distribution formats
but not for post-production formats. Enabling this filter smoothes video
frames and reduces the amount of perceived blockiness in the video at
some cost to image sharpness.

A Business Unit of Harmonic Inc.


Application Notes: Carbon Coder H.264 Encoding Guide Page 3

Use Adaptive Deblocking – When enabled, specifies whether to use the


deblocking filter with standard or alternative offsets related to the quan-
tizer. Available values: 0 (standard offsets, default) and 1 (alternative
offsets, which apply less deblocking for lower quantizers in order to keep
more details in the encoded video). In general, we recommended enabling
this setting.

Deblocking Alpha – Configures the Alpha strength of the In-Loop


Deblocking filter. The accepted range is from -6 to +6, inclusive, with
higher values yielding a stronger deblock. In general, -1 is a good recom-
mended setting. If your output is still blocky you may increase this value to
reduce blockiness at a loss to video sharpness.

Deblocking Beta – Configures the Beta strength of the In-Loop


Deblocking filter. The accepted range is from -6 to +6, inclusive, with
higher values yielding a stronger deblock. In general, -1 is a good recom-
mended setting. If your output is still blocky you may increase this value to
reduce blockiness at a loss to video sharpness.

Denoise

Denoise Strength Y – Now automatically handled by the encoder, this is


a legacy setting and should be left set to 0.

Denoise Strength C – Now automatically handled by the encoder, this is


a legacy setting and should be left set to 0.

Entropy Encoding Mode

There are two options: Context-Adaptive Variable Length Coding


(CAVLC) and Context-Adaptive Binary Arithmetic Coding (CABAC).
Without going into how these two different algorithms work, here’s when
it’s appropriate to use one or the other... First, CABAC is not supported
in baseline profile, so if you’re using baseline, you must choose CAVLC.
Second, it’s important to know that CABAC will almost always produce bet-
ter quality results than CAVLC, but requires much more processing power
to decode. A general rule-of-thumb is to use CAVLC for hardware playback
devices and CABAC for software based playback.

Fast

Use Fast Inter and Intra Decisions – This is a mode for the encoder to
trade off transcoding speed for video quality. For quality, this should always
be disabled.

Use Fast Multi-Reference Frame Motion Estimation – Same as above

Use Fast Sub-Block Motion Estimation – Same as above

A Business Unit of Harmonic Inc.


Application Notes: Carbon Coder H.264 Encoding Guide Page 4

GOP and IDR

GOP Size – “GOP” is the abbreviation for Group of Pictures; “GOP Size”
defines the distance between IDR (Instantaneous Decoding Refresh) key
frames. Often the intended playback device will mandate a value, but a
good general recommendation for hardware devices such as phones or set-
top boxes is double the frame rate. For software playback such as Flash or
QuickTime players, 3 to 5 times the frame rate is very common.

Minimum GOP Size – Defines the minimum distance between IDR


frames. This setting is used in conjunction with Enable Scene Change
Detection, which can create non-uniform GOP sizes. This value should be
set to 1 unless a specific device requires a different value.

IDR Frequency – Defines how often I-frames are marked as IDR frames.
An IDR frame is a special type of I-frame in H.264. An IDR frame specifies
that no frame after the IDR frame can reference any frame before it. This
makes seeking the H.264 file easier and more responsive in the player.
Unless the target playback device requires a different value, this setting
should also be set to 1 (every I-frame is an IDR frame).

Grain Optimization Strength

We recommend using higher strengths for very grainy or noisy material


and lower strengths for less grainy material. Available range is from 0 (off)
to 100; default value is 0. It is recommended to leave this at 0 unless
the footage is grainy and, if so, to increase it to the appropriate level to
compensate for the amount of film grain in the source. Alternatively, for
creating “all-purpose” presets, you can leave it set to 50. This will improve
perceived video quality at some cost to PSNR.

Hadamard Transformation

Use Hadamard Transformation – This is an algorithm named for mathe-


matician Jacques Solomon Hadamard, which calculates two discrete Fourier
transforms (DFTs). For increased quality this should always be checked.

HRD

Maintain HRD – This is purely for device compatibility. It is recommended


to leave it off unless encoding for a device that requires it, such as BluRay.

MBAFF (Macro-Block-Adaptive Field/Frame coding)

This setting is only applicable for transcoding from interlaced to interlaced


frames, in which case this setting should always be turned on. The video
quality will always be better, but it will slightly increase the transcode time.

A Business Unit of Harmonic Inc.


Application Notes: Carbon Coder H.264 Encoding Guide Page 5

About Rhozet Motion Estimation Subpixel Mode


Since 2004, Rhozet, a business unit Indicates the depth of the pixel examined for motion estimation. Quarter
of Harmonic Inc, has focused on design-
pixel will yield the highest video quality but the slowest transcode time.
ing scalable, high-performance, universal
Moving to half and finally full pixel will decrease video quality but transcode
media transcoding technology for deliver-
much faster.
ing content in any format, at any time, on
any device, smoothly, efficiently and in
the most cost-effective manner possible. Number of Slices Per Picture
Rhozet began as part of Canopus
and operated as an independent Defines the number of horizontal segments (slices) into which the frame
company from 2005 until August 2007, is divided for encoding. Increasing this value can potentially speed up the
when Rhozet was acquired transcode process with some cost to video quality. For most applications
by Harmonic, a manufacturer of this should be set to 1. Some applicationsspecify the number of slices to
enterprise-class hardware encoders. In use (such as BluRay, for which this must be set to 4).
addition to its enterprise trans-coding
products, Carbon Coder and Carbon
Server, Rhozet is the developer of the Reference Frames
popular desktop transcoding applications
Defines the number of reference frames used during encoding. Reference
ProCoder and ProCoder Express, which
frames are previously-encoded frames which the encoder uses while
have been marketed and sold under the
Grass Valley brand since its acquisition executing the motion search algorithm for B and P frames. More reference
of Canopus. frames will create higher quality output but will also increase transcoding
time and the memory requirement for decoding. This value can be set
from 2 to 16 frames. A good general value is 4, and should be increased to
target transcodes at lower bitrates.

Search Shape

This is the macro-block search mode and can be set to 8x8 pixels or 16x16
pixels. 8x8 will be a slower transcode but yield higher quality. Conversely,
16x16 will be a faster transcode at a lower quality level. If transcoding
speed isn’t your main concern, this should always be set to 8x8.

Weighted Modes

Use Weighted P Mode – Allows the encoder to use weighted prediction


for P-Frames. This is used mostly to compensate for camera flashes or
fades. We recommend enabling this feature for quality.

Use Weighted B Mode – Not enabled yet, but ditto for the above.

A Business Unit of Harmonic Inc. © Copyright 2008 Harmonic Inc. and Dominic David Milano, Dominic Milano & Company.
All rights reserved. Rhozet and the Rhozet logo are trademarks of Harmonic Inc.
All other trademarks are property of their respective owners.

You might also like