Configure UT Video Pixel Format and Threads in FFmpeg

This article provides a quick guide on how to configure the pixel format and thread options for the UT Video encoder in FFmpeg. You will learn the specific command-line arguments needed to define color spaces and optimize encoding speed using multi-threading.

Selecting the UT Video Encoder

To use the UT Video codec in FFmpeg, specify the encoder using the -c:v utvideo flag. UT Video is a mathematically lossless predictor codec, making it ideal for archiving and intermediate editing.

Configuring Pixel Format

UT Video supports several pixel formats, including RGB and YUV color spaces. You can force a specific pixel format using the -pix_fmt flag. The encoder will map the input to the corresponding UT Video subtype.

Commonly supported pixel formats for UT Video include:

  • rgb24 (8-bit RGB without alpha)
  • rgba (8-bit RGB with alpha)
  • yuv420p (8-bit YUV 4:2:0)
  • yuv422p (8-bit YUV 4:2:2)
  • yuv444p (8-bit YUV 4:4:4)

Example Command: To encode a video to UT Video with a YUV 4:2:2 pixel format, use:

ffmpeg -i input.mp4 -c:v utvideo -pix_fmt yuv422p output.avi

Configuring Thread Options

UT Video supports multi-threading to speed up the encoding process on multi-core processors. This is controlled using the -threads option in FFmpeg.

  • Auto-detection: Set -threads 0 to let FFmpeg automatically decide the optimal number of threads based on your CPU.
  • Manual Limit: Set -threads <number> (e.g., -threads 4) to restrict the encoder to a specific number of CPU cores.

Example Command: To encode a video using UT Video with RGB24 pixel format while utilizing 4 threads, use:

ffmpeg -i input.mp4 -c:v utvideo -pix_fmt rgb24 -threads 4 output.avi

Combined Configuration Example

To perform a complete conversion utilizing a YUV 4:2:0 color space and automatic multi-threading, combine the parameters as follows:

ffmpeg -i input.mp4 -c:v utvideo -pix_fmt yuv420p -threads 0 output.avi