Software⏱️ 4 min read📅 2026-06-11

How to Fix: Ffmpeg x265 error: "Color Primaries must be", "Transfer Characteristics must be", "Matrix Coefficients must be"

FFmpeg x265 error: Color Primaries must be unknown, Transfer Characteristics must be unknown, Matrix Coefficients must be unknown.

Quick Answer: Check the video's color profile and adjust it to one of the supported options (e.g., bt709, bt2020) in your FFmpeg command.

The error 'Color Primaries must be unknown' occurs when FFmpeg's x265 encoder is unable to determine the color primaries used in the input video. This is a common issue that affects videos shot on certain cameras or with specific color grading settings.

This error can be frustrating because it prevents FFmpeg from encoding the video correctly, leading to poor quality output. However, by following the steps outlined below, you should be able to resolve this issue and successfully encode your video.

⚠️ Common Causes

  • The primary cause of this error is that the input video's color primaries are not recognized by FFmpeg's x265 encoder. This can happen when the video was shot on a camera with a non-standard color profile or when the color grading settings used in post-production do not match the camera's native color primaries.
  • Another possible cause is that the input video's transfer characteristics are not supported by the x265 encoder. Transfer characteristics define how the video's brightness and contrast are encoded, and if they are not recognized, the encoding process will fail.

✅ Best Solutions to Fix It

Setting Color Primaries using FFmpeg

  1. Step 1: Use the '-colorprim' option to specify the color primaries used in the input video. You can do this by adding the following flag to your FFmpeg command: `-colorprim bt709`. This will tell FFmpeg to assume that the input video uses the BT.709 color primaries, which is a standard for HDTV.
  2. Step 2: Alternatively, you can use the '-colorspace' option to specify the color space of the input video. For example, if your video was shot in Rec. 709, you can use the following flag: `-colorspace rec709`. This will tell FFmpeg to assume that the input video is in the Rec. 709 color space and use the correct color primaries accordingly.
  3. Step 3: Note that you may need to adjust the '-colorprim' or '-colorspace' option depending on the specific requirements of your project.

Using a Different Encoder

  1. Step 1: If setting the color primaries using FFmpeg's x265 encoder does not work, you may need to use a different encoder that supports your video's color characteristics. For example, you can try using the 'libx264' encoder instead of 'libx265'. To do this, simply replace '-c:v libx265' with '-c:v libx264' in your FFmpeg command.
  2. Step 2: Keep in mind that using a different encoder may affect the quality of your output video, so it's always best to test and compare the results before making any final decisions.

✨ Wrapping Up

By following these steps, you should be able to resolve the 'Color Primaries must be unknown' error and successfully encode your video using FFmpeg's x265 encoder. Remember to always check the documentation for the specific requirements of your project and to test your output before making any final decisions.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions