Medialooks Knowledge Base Support Center

Contact Us

H.264 encoding options

There are several options for H.264 encoding in MFormats SDK and MPlatform SDK - both CPU-based and GPU-powered. 

In MFormats SDK, all CPU-based H.264 encoding options are available in the Startup edition. All hardware-accelerated H.264 encoders are available with the Expert edition. In MPlatform SDK, all encoders are part of EncoderLib component.

Intel Quick Sync

Available in a software and in a hardware modes.

Codec ID for software mode: 'q264sw'

Codec ID for hardware mode: 'q264hw'

Your Intel processor supports Quick Sync decoding if it is equipped with Intel HD Graphics 4200 or higher. Note, that for all XEON processors a mainboard with C226 chipset is required.

Quick Sync encoding has no hardware limitations for a number of encoding processes running at the same time. It depends on the processor performance.

Attributes 

Here is a list of main attributes specific for 'q264hw' and 'q264sw' codecs:

  Name
  Default value
  Description
rc_type
auto
The rate control type.
Possible values:
  • vbr
  • cbr
  • cqp
  • avbr
  • vbr_la
  • quality
quality
7
Quality of captured video.
Possible values:
from 1 (fast capturing, minimal quality) to 7 (maximal quality, slow capturing)
profile
auto
Encoding profile
Possible values:
  • Auto
  • Baseline
  • Main
  • High
  • Extended
level
auto
Sets the level flag in the output bitstream
Possible values: Auto, 1.0, 1.0b, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2

NVIDIA NVENC

Codec ID: 'n264'

Available, if you use NVIDIA graphics card as default graphics device for your system.

There is a hardware limitation for a number of encoding processes running at the same time. This is made by NVIDIA:

Up to 2 encoding sessions enforced on low-end (like Kepler-based Quadro cards) or GeForce cards only and unlimited for non-low-end cards (like Pascal-based Quadro cards). It means that the limitation is up to hardware performance

To get information about Tesla, GRID or Quadro cards supported formats, please refer to this table:

https://developer.nvidia.com/video-encode-decode-gpu-support-matrix#Encoder

Here is a reference for NVIDIA NVENC SDK where you can find what features are available for your graphics card:

https://developer.nvidia.com/nvidia-video-codec-sdk

If you have a card that supports H.265 encoding then you can use 'n265' codec to encode H.265 video.

Attributes

Here is a list of main attributes specific for 'n264' codec:

  Name
  Default value
  Description
rc_type
auto
The rate control type.
Possible values:
  • auto
  • cbr
  • vbr
  • cqp
  • vbr_minq
preset
default
Encoding preset
Possible values:
  • default
  • high_quality
  • high_performance
  • low_latency
  • low_latency_hq
  • low_latency_hp
  • blue_ray_disk
profile
auto
Encoding profile
Possible values:
  • Auto
  • Baseline
  • Main
  • High
  • Stereo
  • 444
level
auto
Sets the level flag in the output bitstream
Possible values: Auto, 1.0, 1.0b, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2

x264 encoder (GPL)

One of the best CPU-based encoders in the world. However, the GPL license prohibits to use this encoder in commercial applications without a special license.

We don't ship x264 with any of our products, but you can still try it with MPlatform or MFormats SDK by downloading a GPL (shared) build of FFmpeg and extracting the archive to "\EncoderLib" folder of your MPlatform SDK directory or in "\bin\[target_build]" folder for MFormats SDK, replacing existing DLLs. 

Then libx264 component should be available as encoding option for MWriter and MFWriter object. The ID of the encoder is "libx264".

Attributes

Here is a list of main attributes specific for 'libx264' codec

  Name
  Default value
  Description
preset
faster
Change options to trade off compression efficiency against encoding speed.
Possible values:
  • ultrafast
  • superfast
  • veryfast
  • faster
  • fast
  • medium
  • slow
  • slower
  • veryslow
  • placebo
tune

Tune options to further optimize them for your input content.
Possible values:
  • film
  • animation
  • grain
  • stillimage
  • psnr
  • ssim
  • fastdecode
  • zerolatency
profile

Limit the profile of the output stream.
Possible values:
  • baseline
  • main
  • high
  • high10
  • high422
  • high444
level

Sets the level flag in the output bitstream.
Possible values: 1 1b 1.1 1.2 1.3 2 2.1 2.2 3 3.1 3.2 4 4.1 4.2 5 5.1
v422
false
Indicates whether captioning is in 4:2:2 colorspace.
Possible values: true, false
interlace
-1
Interlacing type.
Possible values:
  • 1 - interlaced, 
  • 0 - progressive,
  • -1 - auto.

Cisco OpenH264

Codec ID: "libopenh264"

CPU-only based encoder by Cisco Systems. More details about the encoder are here - http://www.openh264.org/

Attributes

Here is a list of main attributes specific for 'libopenh264' codec:

  Name
  Default value
  Description
slices
0Set the number of slices, used in parallelized encoding. This is only used when slice_mode is set to ‘fixed
slice_mode
auto
Set slice mode.Possible values:
  • fixed
  • rowmb
  • auto
  • dyn
loopfilter
1
Enable loop filter, if set to 1. To disable set a value of 0.
max_nal_size
0
Set maximum NAL size in bytes.
allow_skip_frames
0Allow skipping frames to hit the target bitrate if set to 1.