question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing colors when encoding H264

See original GitHub issue

I’m trying to encode a series of PNG files to H264. I’ve attached one of the PNG files as a reference. img-00001

When I encode it to mp4/H.264, the dark-gray background becomes black. I tried to play around with different quality settings (e.g. using new H264FixedRateControl(1024) instead of new DumbRateControl()), but it didn’t make a change.

When I encoded the same files to ProRes, the gray stayed gray (independent of the profile, I tried all four of them: HQ, STANDARD, LT, PROXY). The following screenshot shows the two movies next to each other: ProRes on the left, H.264 on the right.

screen shot

Encoding the same PNGs with FFMPEG to H264 does not change the gray to black, so the YUV420 color space should be able to handle those colors.

Can the color during encoding be controlled somehow in order to prevent such a color shift?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mriesercommented, Mar 4, 2017

Okay, got it working by modifying some more files (CAVCL. codeTableChromaDC did not yet handle the YUV420 case, and EncodedMB assumed YUV420J for its pixels member).

Is there interest in a PR to introduce an option to choose the color space for the H264-Encoder?

0reactions
mriesercommented, Mar 7, 2017

See PR #174.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re: Colour changes on H.264 Adobe Media Encoder
You have a color management problem somewhere and H.264 compresses color in 4 X 4-pixel blocks. My first suggestion is to load your...
Read more >
Bug: Adobe Media Encoder is shifting color when rendering to ...
After Effects and Adobe Media Encoder 2020 are rendering h264 codec MP4s too bright. The colors are washed out slightly and what I'm ......
Read more >
Fix Premiere Color Shift when Exporting H.264 for Vimeo
I had been annoyed by the fact that my exports never matched the look of my Program Monitor in Premiere. I finally figured...
Read more >
h.264 - How to manage colour in After Effects to get precisely ...
In which colorspace are you working? Just an idea: Have you ticked the checkbox "Preserve RGB" under the color-management tab in the Output ......
Read more >
H264 out of After effects changing color? : r/AfterEffects - Reddit
I brought the mp4 into after effects and checked the HEX of the background, and sure enough it's changing the color. Is there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found