News:

--

Main Menu

Colors change

Started by hansolocambo, May 02, 2021, 07:39:42 PM

Previous topic - Next topic

hansolocambo

My website has a background of R,G,B > 34,34,34 (#222222)
I integrate in there all the logotypes I do as a freelance. Logos are PNG sequences with an RGB background color that correspond to the website's background. I load the PNG sequence in Avidemux, choose a codec and export as MP4 3000kbps (far enough). Pretty straightforward.
I tried 2 or 3 codecs but the result is always the same : background's color becomes R,G,B > 21,21,21 (#151515)
Avidemux somehow changes the colors even though I checked the codec parameters and no effect, filter, etc. is activated. I tried with higher kbps but result is identical :(

I decided to use Pavtube Video Converter. I do the same : load the PNG sequence, mount the bitmaps as MP4 3000kbps. The resulting video keeps the original colors from the PNG sequence and video integrates perfectly on the website's background.

Not sure why this is happening. I never noticed the issue working on videos. But with pictures, sometimes the colors need to be very precise. And this difference is quiet a problem.

eumagga0x2a

I checked with the latest git ffmpeg44 and we are perfectly accurate when we can avoid color range conversion JPEG <--> MPEG (which is lossy by nature) by using the VP9 encoder and enabling extended range. We are slightly wrong (#212121) after a roundtrip when using other encoders or when not asking for full range.

Yes, it is displayed darker as something presumably out of our control (the graphics driver?) increases contrast. We pass precisely the #222222 color to the renderer.

Most (almost all) videos use so-called limited or MPEG color range (16 – 235) and most video encoders expect the input to be of limited color range too. PNG uses full ("JPEG", 0 – 255) and we need to shrink it to avoid clipping.

eumagga0x2a

Quote from: eumagga0x2a on May 02, 2021, 11:02:23 PMI checked with the latest git ffmpeg44

I think I should have clarified that this is https://github.com/mean00/avidemux2/tree/ffmpeg44 – a branch preparing an upgrade of the bundled FFmpeg from 4.2.4 to 4.4.

hansolocambo

#3
Thanks eumagga0x2a for that quick answer and the tests you did to eventually figure out the issue.
I didn't know about those color ranges and that's a great info.
I exported the image sequences (as I can't use transparency with a video anyway) as JPG instead of PNG. Just in case ?
I imported this JPEG sequence #222222 and once converted in H264, color becomes #151515
I tried to export using VP9 and full color range, but what I convert as videos are ad banners, skyscrappers, logotypes, etc with very weird resolutions and I get a "Video Track is incompatible".

Still don't know how Pavtube manages to make conversions, because I tried the PNG sequences with it using plenty different export options and the final color is always perfectly identical to the original one. They somehow found a way to work around the conversion issue  ??? And this app is from 2016. Latest 4.9.0.0 version has never been updated.

EDIT : With Pavtube, I just noticed that if by luck the background #222222 is unchanged, the rest of the image has very clearly different colors. So I guess there's no magical work around this conversion issue ;)

Thanks for the answers :D Cheers.

eumagga0x2a

Are you using the latest Avidemux? The deviation can be related to filtering, but simply loading a PNG file with a #222222 background and exporting the currently displayed picture as PNG preserves #222222 for me.

hansolocambo

#5
2.7.8 from about 36 days ago. Yep, I just checked. Latest version indeed. Weird.
I just load a PNG sequence. Change Output to Nvidia H246. kbps to 1200. And I render. I don't use any filter or change any option. That might be why my result is different than yours ?

"and exporting the currently displayed picture as PNG"
Not sure I understand that ? I'm attempting to export as MP4 ;)

I uploaded the pictures I work on if it can help in any way ?
https://mir.cr/0LQO8REJ

EDIT : All right I guess : I imported the PNG sequence, but chose this time : H264 Preset Lossless. And this time resulting background color is @232323. Which is clearly an unnoticeable difference. This will do the trick although the file is twice size the now.

eumagga0x2a

I meant PNG export from video preview. I need to check NVENC encoders, I think they don't handle full-range input yet.

eumagga0x2a

Quote from: hansolocambo on May 03, 2021, 09:27:26 AMI imported the PNG sequence, but chose this time : H264 Preset Lossless. And this time resulting background color is @232323.

The loss happens in the color range conversion (full --> limited), which is performed even if the quantizer is pushed all the way down to zero. If the encoder expects limited range and we feed full to it, shadows and highlights get clipped.

PNG export: load a video (or an image sequence), seek to the picture you want, press Ctrl+P.

hansolocambo

Thanks a lot eumagga0x2a for your quick responses and very detailed explanations.
I think I have enough info now to get proper results.
;)