On this page

Using Per-Title Encoding efficiently

Introduction

Every video is characterized by its own unique complexity, quality, and style, which renders a one-size-fits-all approach to choosing encoding parameters inefficient. Per-Title Encoding is an advanced AI feature that optimizes video bitrates based on the content of each title. This results in better video quality and reduced bandwidth usage, enhancing viewer experience especially for platforms with diverse video content.

Per-Title Encoding identifies the segments where higher detail is essential, as well as those where compression can occur without degrading visual quality. It chooses the optimal settings for each segment, resulting in the ideal balance between high-quality visuals and reduced file sizes. Using AI allows you to optimize your video content efficiently at scale, ensuring that your videos look exceptional while being delivered as efficiently as possible.

note
Note
This feature is currently only available for output videos using the H.264 and H.265 codecs. Learn more about Per-Title Encoding.

Prerequisites

  • Make sure you have a Transcoding Project and API Key.

1
Set Up Your Basic Transcoding Task

Begin by setting up your basic transcoding task. Use the /v1/start_encode2 method to set up the encoding parameters for your transcoding task. If you're new to this process, our Getting Started tutorial offers a comprehensive guide to setting up your first transcoding task.

2
Enable Per-Title Encoding

To activate Per-Title Encoding, modify the format object in your /v1/start_encode2 request to set optimize_bitrate = 1.

{
	"query": {
    "source": "https://nyc3.s3.qencode.com/qencode/bbb_30s.mp4",
    "format": [
      {
        "output": "mp4",
        "optimize_bitrate": 1,
      }
    ]
  }
}

3
Adjusting CRF for Your Use Case

The adjust_CRF parameter is used for calibrating Per-Title Encoding to meet to your application's unique requirements. It allows you to modify the Constant Rate Factor selected, giving you direct control over the equilibrium between video clarity and compression rate. Whether your priority is crystal-clear quality or compact file sizes, adjust_CRF allows you to adapt your transcoding tasks to the specific needs of your project.

adjust_CRFInteger between -10 and 10. Default 0.
Changes the selected CRF to be higher or lower, depending if the user prefers smaller files or higher quality respectively.

Lowering the CRF is used for high-quality outputs where level of detail is critical. Increasing it when storage and content delivery efficiency is important to keep costs down and reduce latency. This granular control provides full control over the balance between delivering high-definition video and managing file economics, and enabling further optimization in video performance for any scenario.

4
Constraining CRF

The min_crf and max_crf parameters act as the guardrails for Per-Title Encoding, providing precise boundaries within which the Constant Rate Factor can operate. This further ensures that your outputs stay within the specific quality constraints required for your application.

By setting a min_crf, you establish a quality threshold, ensuring that the video does not exceed a certain level of clarity, which is essential when maintaining a high standard of visual experience is non-negotiable.

min_crfInteger 0 - 51.
The lowest possible CRF that will be selected.

Conversely, max_crf sets a ceiling on compression, avoiding excessive degradation of video quality, which can be crucial for content where clarity is less critical than storage and bandwidth economy.

max_crfInteger 0 - 51.
The highest possible CRF that will be selected.

Utilizing these parameters enables you to calibrate encoding settings with precision, maintaining control over your content's presentation while optimizing for cost and delivery efficiency. Use these settings as a strategic tool to consistently deliver of content that meets both user experience expectations and business objectives.

Now you're ready to get started. Here's an example of what your request would look like with all of the parameters outlined above:

{
	"query": {
    "source": "https://nyc3.s3.qencode.com/qencode/bbb_30s.mp4",
    "format": [
      {
        "output": "mp4",
        "optimize_bitrate": 1,
        "adjust_crf": "-1",
        "min_crf": "21",
        "max_crf": "51"
      }
    ]
  }
}

Best Practices

  • Balancing Quality and Size: Experiment with different CRF values to find the ideal balance between quality and file size for your specific use case. Remember, lower CRF values improve quality at the cost of larger file sizes.

  • Limiting CRF Range: Use min_crf and max_crf to set strict boundaries for video quality and compression. This is particularly useful when dealing with bandwidth constraints or specific quality standards.