How to Fix “unexpected color primaries value” in Unreal 5.4

If you’re using the Electra player within Unreal Engine, I assume you’re already transcoding your videos using ffmpeg… because if you’re not, then you’re not getting very far at all as the Electra player supports a disappointing number of formats. Unfortunately, Unreal 5.4 crashes on videos that 5.3 played without issues…. and it unsurprisingly was driving me NUTS….

UPDATE: After fixing this in Unreal 5.3, it is broken again in 5.4. Stay tuned for a solution.

The long and short of it, is that you need to avoid the color space that Electra is complaining about. I had a particular issue with a few videos that came from 3rd parties. Unfortunately for me, my project is more of a Media Player object and less of a “game”. If you’re working on a game, you can probably afford to play around with a narrow range of codecs, but a major trick I have to deal with is transcoding ANYTHING anyone throws at me into a format that the Electra player will play.

I solved the error by adding the following string to my ffmpeg command line.

-vf scale=in_color_matrix=auto:in_range=auto:out_color_matrix=bt709:out_range=tv

When placed in the entire command line it looked a little something like this:
ffmpeg.exe -y -threads 32 -i "brokenvideo.mp4" -vcodec h264 -q:a 0 -q:v 0 -vf scale=in_color_matrix=auto:in_range=auto:out_color_matrix=bt709:out_range=tv -r 30 -s 640x480 "fixedvideo.mp4"

The offending video was likely digitized from VHS a long time ago, and was in a narrow NTSC broadcast color space. All I know is that it took me many hours to figure this out… and you’re welcome!

One Reply to “How to Fix “unexpected color primaries value” in Unreal 5.4”

  1. Yara Campbell:
    @article: Interesting fix! I’m curious, did you try other color spaces before settling on bt709? Also, any tips on batch processing these fixes for multiple videos?

Leave a Reply

Your email address will not be published. Required fields are marked *