Is 4k HDR input to 4K HDR output keeping all colourspace and HDR metadata possible? Help!

I’m more of a casual user and pretty main my use for TVai at present is taking old movies I’ve bought on UHD discs (where the studios chuck a load of grain and noise onto the film and call it ‘remastered with extra detail’) for use on my local Plex/Kodi server.

I’m feeding the video into TVai and processing with Nyx (which I find is slow but terrific if you tweak relative to auto and do not leave on auto BTW) - but the colourspace metadata read by MediaInfo after processing is not the same as from the input file and the HDR metadata is missing altogether. In fairness I expected this but got me wondering why there simply isn’t a opportunity in the export area to get TVai to copy that metadata over from the original file so the final file is identical to the original but with a far clearer image? I daresay there is a reason?

Ironically, if I run the resultant file through Handbrake nightly but do not tweak in any way, no filters, not BT.709 etc, just a change of bitrate, then the resultant file has the colourspace metadata characteristics showing as BT.2020 and it plays on VLC and my TV’s perfectly in proper saturation - just a shame I simply cannot use the original output from TVai which would retain the HDR data as well as proper colourspace data intact. (The TV also displays as HDR which it isn’t really as the HDR information is missing - I think the ‘Transfer Characteristics: PQ’ flag fools it)

I’m no CLI user but I have pulled off the following from the export command, if it’s just a question of changing a handful of parameters then happy to give it a try (I tried looking at FFMPEG commands but the syntax appears completely different from what TVai uses, at least in this context so didn’t know where to start!) Any CLI and /or colourspace/HDR experts care to chime in?

Many thanks

ffmpeg “-hide_banner” “-i” “E:/path/Video.mkv” “-sws_flags” “spline+accurate_rnd+full_chroma_int” “-color_trc” “16” “-colorspace” “9” “-color_primaries” “9” “-filter_complex” “tvai_up=model=nyx-2:scale=1:w=3840:h=2160:preblur=-0.62:noise=0:details=-0.14:halo=-0.75:blur=0:compression=-0.27:estimate=8:device=0:vram=0.81:instances=1” “-c:v” “hevc_amf” “-profile:v” “main” “-profile_tier” “main” “-tag:v” “hvc1” “-pix_fmt” “yuv420p” “-g” “30” “-b:v” “60M” “-an” “-map_metadata” “0” “-map_metadata:s:v” “0:s:v” “-map” “0:s?” “-c:s” “copy” “-movflags” “frag_keyframe+empty_moov+delay_moov+use_metadata_tags+write_colr” “-metadata” “videoai=Enhanced using nyx-2; mode: relative to auto; reduce noise at 0; reduce large grain at -14; revert compression at -27; dehalo at -75; and anti-alias/deblur at -62” “C:\Temp/815634324/previews/Output video.mkv”

2 Likes

Did you ever figure this out?

I’m also trying to process UHD HDR videos with Nyx. I’ve also found this works well for cleaning up low-bitrate video that’s unlikely to ever receive a high bitrate release.

A few notes:

  • make sure you use a 10bit video encoding, such as H265/Main10,
  • you can use another app to inject HDR10 metadata (I use Apple’s Compressor to recompress the video and inject HDR10 metadata, but I am sure there are free solutions to it).

I made a test with a 30 second video and it seems to work:

  • I get 10 bit BT.2020 PQ video out of Topaz Video AI (BT.2020 is the correct color space for HDR10;SDR is BT709 or others),
  • I could successfully inject HDR10 with Apple Compressor,
  • the video looks OK on my TV.

:slight_smile:

Umm any windows way to do this? I am looking for a way to recompress… just wanted to use the apollo model for more frames without losing hdr.