This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Lossless RGB to BT.709 color matrix
#1
Hello!

I'm trying to compress many of my videos using Hybrid. They are originally recorded using x264vfw with Ultrafast preset, No tuning, High 4:4:4 Profile, CRF 23 and Zero Latency. The color matrix is lossless RGB (Bandicam - "Prefer RGB colorspace", x264vfw - "Keep input colorspace").

The resolution of all videos being 1360x768, Hybrid autodetects the color matrix as BT.709, but the output video has its colors off, whether or not I select the High 4:4:4 Profile again.

What I would want is to preserve the RGB color accuracy and have a final video with the BT.709 color matrix.

Is that at all possible?


Here is a MediaInfo of a file straight from Bandicam:
Format                                  : AVI
Format/Info                              : Audio Video Interleave
Format profile                          : OpenDML
File size                                : 5.09 GiB
Duration                                : 1 h 50 min
Overall bit rate                        : 6 618 kb/s
Writing application                      : Bandicam 5.1.0.1822 / GDI / External(X264)

Video
ID                                      : 0
Format                                  : AVC
Format/Info                              : Advanced Video Codec
Format profile                          : High 4:4:4 Predictive@L3.2
Format settings                          : 1 Ref Frames
Format settings, CABAC                  : No
Format settings, RefFrames              : 1 frame
Codec ID                                : H264
Duration                                : 1 h 50 min
Bit rate                                : 4 307 kb/s
Width                                    : 1 360 pixels
Height                                  : 768 pixels
Display aspect ratio                    : 16:9
Frame rate                              : 25.000 FPS
Color space                              : RGB
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                      : 0.165
Stream size                              : 3.31 GiB (65%)
Writing library                          : x264 core 152 r2851bm ba24899
Encoding settings                        : cabac=0 / ref=1 / deblock=0:0:0 / analyse=0:0 / me=dia / subme=0 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=12 / sliced_threads=1 / slices=12 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=250 / keyint_min=25 / scenecut=0 / intra_refresh=0 / rc=crf / mbtree=0 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=0
Color range                              : Full
Matrix coefficients                      : Identity

Audio #1
ID                                      : 1
Format                                  : PCM
Format settings                          : Little / Signed
Codec ID                                : 1
Duration                                : 1 h 50 min
Bit rate mode                            : Constant
Bit rate                                : 1 536 kb/s
Channel(s)                              : 2 channels
Sampling rate                            : 48.0 kHz
Bit depth                                : 16 bits
Stream size                              : 1.18 GiB (23%)
Alignment                                : Aligned on interleaves
Interleave, duration                    : 100  ms (2.50 video frames)

Audio #2
ID                                      : 2
Format                                  : PCM
Format settings                          : Little / Signed
Codec ID                                : 1
Duration                                : 1 h 50 min
Bit rate mode                            : Constant
Bit rate                                : 768 kb/s
Channel(s)                              : 1 channel
Sampling rate                            : 48.0 kHz
Bit depth                                : 16 bits
Stream size                              : 604 MiB (12%)
Alignment                                : Aligned on interleaves
Interleave, duration                    : 100  ms (2.50 video frames)
Reply
#2
No, clue what's happening.
My wild guess is that since Hybrid does not support x264 with RGB but only 4:4:4 there is some issue with the RGB->YUV conversion somewhere, but not knowing what really happened that is just a guess.

Without a debug output I don't know where the problem is.
-> read the sticky, ideally also provide a small sample of the source.

Quote:x264vfw with Ultrafast preset, No tuning, High 4:4:4 Profile, CRF 23 and Zero Latency.
Normally I would recommend to use a lossless compression during capturing, but assuming the captured video isn't anything important or you are happy with the quality, that's fine.

Cu Selur
Reply
#3
Here are the Debug output and the video samples requested. The .avi file is the raw capture and the .mkv is the recompressed video with Hybrid. The color shift is most noticeable on the start menu and the Quick Launch icons.

Hybrid 0.2.5 (2021.04.12.1)
No error message came up. For whatever Hybrid showed up in the verbose box, please check Hybrid verbose.zip

I simply select the file Bandicam recorded using x264vfw (Ultrafast preset, No tuning, High 4:4:4 Profile, CRF 23, Zero Latency, RGB color matrix, 2 WAV audio sources) and use the "Open File" interface from the "Base" tab of Hybrid. After opening the file, I can see, among other things, the message: "Unknown input color matrix 'g' found, guessing by format and resolution,.. selecting 'pc709' since width*height > 720*576.".
I then do the configuration for the file I want Hybrid to output: x264 video, passthrough all audio, 23 CRF, High 4:4:4 Profile, i444 output color space, disabled Deinterlacing.

The resulting output file is, as in the attachments, color shifted.
Reply
#4
Sadly the DebugOutput only contains the loading and analysis of the source since you set the output directory/file after loading the file and not before, so once you change the output folder the location of the debug output changes.
-> Still no clue what decoders&settings Hybrid used in the job creating&co.

Cu Selur

Ps.: also note that since you don't use lossless compression the conversion will not be lossless.
Reply
#5
(17.07.2021, 12:50)Selur Wrote: Sadly the DebugOutput only contains the loading and analysis of the source since you set the output directory/file after loading the file and not before, so once you change the output folder the location of the debug output changes.
-> Still no clue what decoders&settings Hybrid used in the job creating&co.

Cu Selur

Ps.: also note that since you don't use lossless compression the conversion will not be lossless.

No need to be lossless. All I want is no color shift, I probably didn't explain it correctly in the title.

I hope the debug is better now.
Reply
#6
Looking at the .avi and the .mkv the issue is a tv vs pc scale problem.
Debug Output still ends with:
2021.07.17 - 13:53:24_Windows 10 Version 1607 (64bit)_2021.04.12.1 - level 9: Output is matroska compatible,.. -> changing current container to mkv,..
2021.07.17 - 13:53:24_Windows 10 Version 1607 (64bit)_2021.04.12.1 - level 9: outputDir set to(2): D:\Users\Alexa\Documents\Bandicam
no job creation or job processing.

Cu Selur
Reply
#7
Seems to be an issue with the way ffmpeg does the RGB<>YUV conversion.
Enabling "Filtering->Vapoursynth->Misc->Script->Always use Vapoursynth" fixes the problem here.
(job needs to be recreated)
-> try whether that is the same for you.
Reply
#8
I don't know what to tell you then. I think I replaced the default preset of Hybrid with one that includes the settings I want. Should I reinstall Hybrid?

I also attached below a video so you can clearly see what I'm doing and maybe point me to where I do something wrong.

(17.07.2021, 13:10)Selur Wrote: Seems to be an issue with the way ffmpeg does the RGB<>YUV conversion.
Enabling "Filtering->Vapoursynth->Misc->Script->Always use Vapoursynth" fixes the problem here.
(job needs to be recreated)
-> try whether that is the same for you.

I will soon verify this and report back.

Yes, that fixed it. Thank you!

All I wanted.
Reply
#9
Happy that fixed it, will look into how to get ffmpeg to do the conversion properly too.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)