Rendered video has wrong colors

I rendered my animation using eevee and video has wrong colors. If I render image it has correct colors exactly how they appear in viewport in preview mode. Perhaps there are video settings I don’t know about?
Here is color comparison as how it looks like on rendered png and rendered video (.mkv). Am I missing some setting?

Here are my color management settings

Oh, wow. Does the same happen when you assemble through sequencer? Does different codecs behave differently? Does other software behave differently?

I have no idea though.

Video has correct colors only if I render with Avi raw or FFmpeg codec #1 or Png codec. Sequencer makes no difference. I also tried to convert Avi raw using other software using vp9, h264 and some other codecs aaaaand it also breaks colors adding that awful yellow tint. Perhaps it’s different color space thing, AVI raw, FFmpeg1 and png are using RGB while vp9 and h264 are using YUV color space. Still difference is dramatic. I guess the only way to solve it is to add color correction in compositor.

Finally figured it out. According to this topic blender renders video with BT601 conversion in YUV colorspace. That’s why I had had correct colors with RGB colorspace codecs (avi raw, FFmpeg codec #1 and png) and wrong colors with codecs using YUV colorspace (h264,vp9). BT601 conversion is used on SD videos, while BT709 is used on HD videos (my video has 4k resolution). So all I had to do is to render video in raw format and then compress it with ffmpeg using -vf colormatrix=bt601:bt709 parameter. Works like a charm, output colors are almost identical to input.

Even if not considered “a bug”, it should still be noted somehow in the encoding settings. Most users wouldn’t know the difference between RBG and YUV or BT601 and BT709 or that SD vs HD videos even mattered (I didn’t), let alone their technical differences. People do care about their colors coming out correct.

Currently the output encoder tooltip (other than the python info) displays the same as the output encoder entry itself - I don’t see how that adds any relevant info. So if not fixed as the issue is not within Blender, it would still be nice to inform about it.

I do believe I’ve seen a dev mentioned on blender dev tracker that FFmpeg is supposed to automatically set up BT601 or BT709 depending on resolution settings. Anyways there are tasks on dev tracker requesting more features to set up video encoder precisely and the tasks are still open. So perhaps it’s a matter of time when they implement it. Anyways I hope my research is going to be helpful for those who stuck with color shift and wrong colors in rendered video.