Vero 4K H265 movies (8-bit encoded only?) - blacks show as grey, colours washed out (reduced colourspace)

In my experience as a coder, once a solution is found, all the time it took becomes immaterial - for me the fear of not being able to solve the issue (which has happened a few times in my career) was always far worse.

Do you think a toggle option can be introduced into osmc (presumably manual, unless it’s possible to detect from metadata that the colourspace is actually restricted when set to full), or is resetting the flag on the affected files the way forward?

A toggle switch would suit me fine, btw.

I think we need to work out how to toggle it first, but it looks like we are on the right lines.

@wesk05 – under what conditions should we flag full range? Is this a fudge up in the encode, or something that needs fixing unconditionally?

Sam

1 Like

Cool.

Thank you both for all of the effort you’ve put into this troublesome gremlin. I truly appreciate it.

You’re not wrong about it being pricey - the greatest cost perhaps being Windows 10 as a requirement.

My main platform is Linux, with Windows 7, heavily modified (e.g. telemetry backports removed and other insidious data leakage blocked) as a fall back, on a dual boot PC.

Win7 is needed also for .net coding, as Mono isn’t quite there yet, and my swiss-army knife tool of choice, RegexBuddy.

The clips in question are all incorrectly flagged as Full range. I didn’t find any 0-15 values in those clips. GoPro clips can be true full range (0-255).

To resolve this permanently, Amlogic code needs to be fixed. YUV-RGB conversion doesn’t seem to be correct when full range flag is detected. Can’t say whether the conversion matrix used itself is wrong or not.

It needs to be corrected in the SPS NAL units of the HEVC bitstream.

1 Like
                        if (naltype == NAL_UNIT_SPS) {
                                parse_type = HEVC_NAL_UNIT_SPS;
                                hevc->have_sps = 1;

Will compare against H264 vs HEVC.
Will be interesting to see if this is indeed the issue.

1 Like

The SPS NAL unit comment was with reference to VUI range flag correction.

This black level issue is likely due to an incorrect conversion matrix for full range YUV to RGB (and inverse).

Do you know whether this matrix is being used ?

No – I don’t believe it is used. That is for HDMI-RX (i.e. video in).

I will see if I can produce another build shortly.

1 Like

I’ve been reading up on this, and had been expecting, as you confirmed, that the colourspace flag setting would be repeated throughout the stream (although there seems to be some contension over this on some forums).

It’s a shame there’s no trial version of HDRmaster.

You can try setting SPS in header. It may work. The SEI messages have to be repeated.

1 Like

Thanks @wesk05

I’d glady try, if i could find a Linux or Windows 7 (or even 10 at a push) tool to do so, that didn’t cost upwards of £250

I tried setting the range in mkv header using mkvtoolnix - Header editor. It didn’t work. I think Kodi ignores header values (am not sure of this). I remember another discussion on aspect ratio in header being ignored.

Ok, thanks for trying. Mkvtoolnix is one program I do have, so that’s a shame

Hi @sam_nazarko,

Did you have any luck with introducing a switch to force a file to playback ignoring the SPS NAL values, to overcome incorrectly set colourspace range info?

I’ve still not found a tool to adjust the values in the files them selves (i.e. the approach @wesk05 took with the test files).

Thanks,
RR

Hi @retroresolution

I wanted to cut today’s release first. Now I will look in to this again as there are some other improvements I’d like to make

Cheers

Sam

1 Like

No problem @sam_nazarko, thanks for the update

Hi @wesk05,

A couple of weeks ago you commented ‘I downloaded your clips with incorrect black levels and changed the range to limited.’ I tested the clips you provided at the time, and confirmed everything looked good.

As I recall, to convert the incorrect colorspace information by setting the SPS NAL units of the HEVC bitstream, you used some expensive commercial software from hdr.avtop.com, which I don’t have access to.

I also recall some discussion regarding an alternative option of completely re-encoding an affected file.

I’ve been investigating a way to do this using ffmpeg at the command line, specifically using swscale / sws_setColorspace, but not found a solution as yet.

Is there a simpler method using Handbrake?

Whilst re-encoding isn’t practical as an overall solution (I have far too many affected files), I’d like to try this on a few as it looks like @sam_nazarko’s Vero 4K fix is still some way off.

Regards,
RR

I don’t think you will be able to do this with Handbrake. The one method that could possibly work is using the NVEnc Stream Patcher. I haven’t tried it personally. You will have to demux the bitstream. So the process is not going to be quick.

1 Like

Thanks, I’ll take a look

Hi @sam_nazarko,

I know you’re incredibly busy, but could you give me an indication whether the colourspace issue is likely to ever be fixed (indeed, is it unfixable)?

I’m asking as we’re three months down the line, and I’m wondering if it’s time to look for alternative hardware.

I still have no idea why my collection of films has so many encoded in a non-standard manner - nobody else seems affected (certainly no-one on this thread has mentioned the issue).

Many thanks
RR