BT2020 / Rec.2020 Output?

I have some jobs that is using the BT2020 color space, but not using HDR. Topaz Video AI (v3.2.0) seems to force outputting BT709. I’ve tried both outputting H265 Main (AMD) using a MKV container and Prores LT. The FFMPEG command shows the output as BT709:

ffmpeg "-hide_banner" "-nostdin" "-y" "-nostats" "-i" "M:/Incoming/JOB1_HD_RB_BT2020.mkv" "-sws_flags" "spline+accurate_rnd+full_chroma_int" "-color_trc" "14" "-colorspace" "9" "-color_primaries" "9" "-filter_complex" "tvai_up=model=amq-13:scale=0:w=2960:h=2160:device=0:vram=0.9:instances=1,scale=w=2960:h=2160:flags=lanczos:threads=0,scale=out_color_matrix=bt709" "-c:v" "prores_ks" "-profile:v" "1" "-vendor" "apl0" "-quant_mat" "lt" "-bits_per_mb" "525" "-pix_fmt" "yuv422p10le" "-map_metadata" "0" "-movflags" "frag_keyframe+empty_moov+delay_moov+use_metadata_tags+write_colr " "-map_metadata:s:v" "0:s:v" "-map_metadata:s:a" "0:s:a" "-c:a" "copy" "-metadata" "videoai=Enhanced using amq-13. Changed resolution to 2960x2160" "M:/Incoming/AI_Upscale/JOB1_HD_to_4K_amq13_temp.mov"

Here is my Input:

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main 10@L4@Main
Codec ID : V_MPEGH/ISO/HEVC
Duration : 1 h 38 min
Bit rate : 13.7 Mb/s
Width : 1 480 pixels
Height : 1 080 pixels
Display aspect ratio : 1.370
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.357
Stream size : 9.43 GiB (90%)
Title : JOB1 HD
Writing library : x265 3.5+96-c07d076cf:[Windows][GCC 13.0.1][64 bit] 10bit
Encoding settings : cpuid=1111039 / frame-threads=4 / numa-pools=24 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1480x1080 / interlace=0 / total-frames=7087 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=20 / lookahead-slices=6 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=32 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=1 / no-limit-modes / me=1 / subme=2 / merange=25 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=3 / selective-sao=4 / early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=12.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=14 / colormatrix=9 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : BT.2020 (10-bit)
Matrix coefficients : BT.2020 non-constant

So is this a bug or am I doing something wrong. I am converting the source which is BT709 to BT2020 before importing it into Video AI.

I’m guessing because your source video is actually rec709 (1480x1080) not bt2020 even tho you have changed this it is in fact wrong as bt2020 spec is for 3840x2160 and higher resolutions and TVAI is correcting the colour space based on resolution which is correct.

what about selecting MAIN 10?

image

Using another video that is 2160p and is native BT2020 with HDR also results in Video AI using BT709, according to the ffmpeg command. From what I read, technically, BT2020 with HDR is BT2100.

Granted I’m not using 3840x2160 resolutions, except upscaling HD to 4K and Video AI still does not use BT2020.

I use Video AI to upscale and to sharpen the details after I’ve already processed the video with Avisynth+ and SMDegrain to remove the grain. Problem is, sometimes the video is so clean after the grain is removed I can get banding is certain scenes. Switching to BT2020 using Handbrake before using avisynth increased the color pallet enough that the banding was gone and the picture was stunning after avisynth was finished. I wanted to upscale that to 4K using Video AI and that is when I hit the roadblock that Video AI does not seem to use BT2020. Even using Prores as the outpout.

Mine just says H265 Main (AMD) or H265 High (AMD) with my Radeon TX 6700XT. Not sure if that is a oversite by Topaz with the wording. H265 is 10bit color though. Selecting Prores LT also results in BT709.

Is anyone processing BT2020 videos with Video AI and having your output also be BT2020?

I’ll also think I read that Video AI does not support HDR. Or maybe that was converting SDR to HDR. I’ll have to research that as I have some 4K HDR video I need to cleanup and sharpen.

So the FFMPEG command for a 4K upscale using Prores LT showed the output at BT709, but the resulting video file shows it’s BT2020. So I’m happy to find that Video AI can output BT2020. The resulting video file though is 10 times larger than the H265 video (212 GB). That is going to wear out the SSDs a lot faster.

So I guess the bug would be the H265 AMD encoder is not doing BT2020. I guess a feature request would be to add a software encoder such as x265 along with a dialog option for tweaking the x265 settings.

1 Like

Hi Chris,

Thanks for reporting this issue. We are looking into options for adding better HDR and wide color gamut support in the app, but for now we recommend working in the standard BT709 colorspace as that is what the AI models are converting input files to for processing.

So if I understand you correctly, the pipleine of Video AI is BT709 even though Prores output would be BT2020? So anything going through VideoAI will be converted to BT709, even though the output can be BT2020 using Prores or I assume nVidia X265 Main10.

That’s right, we are currently looking into the possibility of expanding the supported colorspaces for processing but for now BT709 is the internal colorspace for all model processing.

Thanks for letting me know. Can you confirm if the H265 AMD can be fixed to output BT2020. Is there anything on the roadmap to add x265 as a CPU software encoder.

The AMD Video Coding Engine does support BT2020 so when we eventually add support in the models for expanded colorspaces, it would include support in the hardware encoders.

We don’t currently plan to add x265 CPU encoding as an option within the app for both licensing and performance reasons, but we plan to expand the overall functionality of the export menu in the app in a future update. This would include new options for bitrate control and the overall quality of exported files.

Thanks for the update. I guess I’ll need to hold off on Upscaling some BT2020 content that we’ve converted to fix banding problems after degraining. So I’ll try and be patient. :slight_smile: