Hello, everyone!
If you own an RTX 20xx or higher GPU, you can easily convert SDR videos to HDR using NVIDIA’s AI-enhanced tools — no expensive software required.
The process leverages Rigaya NVEnc with NVIDIA AI to deliver high-quality results.
Here’s how to get started:
What You Need
Latest Rigaya NVEnc 64-bit version, download it here (make sure to use the 64-bit version):
Latest NVIDIA GPU driver:Code:https://github.com/rigaya/NVEnc/releases
Ensure your driver is up to date. Minimum required version: 550.58.
NVIDIA Video Effect models and runtime dependencies for your GPU model:
Code:https://www.nvidia.com/broadcast-sdk-resources
Setting Up an Option File
To simplify the encoding process, create an option file with all necessary settings:
Create a text file and name it (e.g.): SDR2HDR.txt.
Copy and paste the following content into the file:
Each option in the file has a specific purpose. Here’s an explanation:Code:--avhw --vbr 50000 --ref 8 --bframes 5 --output-depth 10 --pic-struct --audio-copy --chapter-copy --atc-sei auto --vpp-ngx-truehdr contrast=100,saturation=100,middlegray=50,maxluminance=1000 --master-display G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1) --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --max-cll 1000,300 --codec hevc --level 5.1 --profile main10 --tier high
Enables hardware acceleration, allowing the encoding process to use your NVIDIA GPU for faster performance.Code:--avhw
Sets the variable bitrate (VBR) to 50 Mbps, which adjusts dynamically for optimal quality and compression.Code:--vbr 50000
Lower values reduce file size but may decrease quality.
Higher values improve quality at the cost of larger file sizes.
Defines the number of reference frames used for efficient prediction and compression.Code:--ref 8
Specifies the number of B-frames.Code:--bframes 5
It improves compression efficiency and quality but increases encoding time.
Outputs a 10-bit video file, crucial for HDR, as it provides smoother gradients and a broader range of colors.Code:--output-depth 10
Activates NVIDIA AI-powered SDR to HDR conversion using TrueHDR.Code:--vpp-ngx-truehdr
Includes adjustable parameters:
contrast: Light/dark difference (default: 100).
saturation: Color intensity (default: 100).
middlegray: Midtone brightness (default: 50).
maxluminance: Peak brightness in nits (default: 1000).
Adds HDR10 metadata for consistent colour calibration and brightness across HDR displays:Code:--master-display
G, B, R: Color primaries (green, blue, red).
WP: White point coordinates.
L: Luminance range (max and min brightness in nits).
Converts the video’s color space from SDR (bt709) to HDR10 (bt2020):Code:--colormatrix, --colorprim, --transfer
: Converts colors to HDR.Code:--colormatrix bt2020nc
: Defines HDR color primaries.Code:--colorprim bt2020
: Uses the HDR10 PQ transfer function.Code:--transfer smpte2084
Encodes the video in the HEVC (H.265) format, which is efficient and required for UHD HDR.Code:--codec hevc
Specifies HDR encoding parameters:Code:--level, --profile, --tier
Level: Defines encoding complexity (e.g., 5.1 for UHD HDR).
Profile: Use main10 for 10-bit HDR content.
Tier: Set to high for improved quality.
Batch Processing with Command Line
You can batch-convert multiple SDR files to HDR in a folder using this command:
What it does:Code:for /R %i in (*.mp4 *.mkv) do "D:\rigaya\NVENC\NVEncC64.exe" -i "%i" --option-file "D:\rigaya\SDR2HDR.txt" -o "G:\%~pi%~ni.mkv"
for /R %i in (*.mp4 *.mkv): Loops through all MP4 and MKV files in the folder and its subfolders.
-i "%i": Specifies the input file.
--option-file "D:\rigaya\SDR2HDR.txt": Uses the settings in your SDR2HDR.txt file.
-o "G:\%~pi%~ni.mkv": Outputs the converted file to the specified folder, retaining the original structure and file name.
Example MediaInfo
Here’s an example of what the MediaInfo output for a converted file might look like.
This output confirms HDR10 encoding with correct metadata and properties.Code:Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main 10@L5.1@High HDR format : SMPTE ST 2086, HDR10 compatible Codec ID : V_MPEGH/ISO/HEVC Duration : 2:00:49 Bit rate : 42.4 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 2.40:1 Frame rate mode : Constant Frame rate : 23.976 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 10 bits Bits/(Pixel*Frame) : 1.152 Stream size : 44.6 GiB Default : Yes Forced : No Color range : Limited Color primaries : BT.2020 Transfer characteristics : PQ Matrix coefficients : BT.2020 non-constant Mastering display color primaries : Display P3 Mastering display luminance : min: 0.0001 cd/m2, max: 1000 cd/m2 Maximum Content Light Level : 1000 cd/m2 Maximum Frame-Average Light Level : 300 cd/m2
Additional Notes
Test on small files first: Avoid wasting time on long encodes by experimenting with short clips initially.
Adjust settings: Modify options like contrast, saturation, or bitrate in the SDR2HDR.txt file to meet your preferences.
More options: Rigaya NVEnc supports additional features like upscaling, cropping, and padding. Learn more here:Code:https://github.com/rigaya/NVEnc/blob/master/NVEncC_Options.en.md
Create UHD Content
Once you’ve converted your SDR files to HDR, you can use tools like BDRebuilder to compile the output files into UHD content.
Disclaimer
I’ve done my best to provide accurate information and instructions, but I’m only human.
If you notice any errors, mistakes, or areas for improvement, please let me know, and I’ll be happy to fix and correct them!
Enjoy converting SDR to HDR with NVIDIA AI, and feel free to ask questions.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 9 of 9
Thread
-
Last edited by dietboby; 20th Nov 2024 at 00:49.
-
Since the purpose of your procedure is to upscale shouldn't you include the upscaled frame size in your encoding parameters? Include for example "--output-res 1440x1080" in your SDR2HDR.txt file or the NVEncC64 command line.
-
Thank you for your feedback
You are correct; I did not include upscaling in the script.
This guide focused specifically on converting SDR to HDR, as HDR can be effectively applied to 1080p material without requiring upscaling.
However, upscaling is undoubtedly possible if desired.
For instance, adding a parameter likeCode:--output-res 1440x1080
I should have mentioned this option in the guide—thank you for pointing that out.
It’s also important to note that care must be taken when upscaling cropped files, as it can lead to distortions or misalignments.
For example, if a file has a resolution of 1920x800 and is resized to 1440x1080, the aspect ratio will be incorrect.
To upscale correctly, padding must be applied before resizing to maintain the original aspect ratio.
Padding is applied to the original resolution, not the output resolution.
How to Calculate Padding for Correct Aspect Ratio
To calculate the padding required for upscaling:
Use a tool like MediaInfo to find the original resolution of the video.
Determine the target resolution:
For 1080p, the target resolution is 1920x1080.
For UHD 4K, the target resolution is 3840x2160.
Calculate the missing pixels for padding:
Horizontal Padding: If the original width is less than the target width, calculate (target-width - original-width) and divide by 2 to apply equal padding on the left and right sides.
Vertical Padding: If the original height is less than the target height, calculate (target-height - original-height) and divide by 2 to apply equal padding on the top and bottom.
Example Calculation:
If the original resolution is 1920x800 and the target is 1920x1080:
Missing height:
1080−800=280
Padding for the top and bottom:
280/2=140
The command for padding:
Code:--vpp-pad 0,140,0,140
If the video also requires horizontal padding, for example, going from 1600x1080 to 1920x1080:
Missing width:
1920−1600=320
Padding for the left and right:
320/2=160
The command for padding:
Code:--vpp-pad 160,0,160,0
You can resize the video using the appropriate upscaling algorithm.
Rigaya NVEnc supports several options for resizing, each with its strengths.
Here are a few examples:
NVIDIA Video Effects Super Resolution (nvvfx-superres):
Code:--vpp-resize algo=nvvfx-superres,superres-mode=1
Code:--vpp-resize algo=ngx-vsr,vsr-quality=4
Code:--vpp-resize algo=libplacebo-sinc,pl-radius=3.0,pl-antiring=0.5
-
-
I just assume that you would upscale with something like Topaz first, and then apply the HDR. Not sure what having an upscale done by the GPU alone would even look like.
-
-
@jagabo
In case you are interested.
With the libplacebo and shaders you can now also do things like this:
Code:libplacebo-shader: cspconv(yv12(16bit) -> yuv444(16bit)) D:\rigaya\shader\SSimSuperRes.glsl, res=960x720, resampler=libplacebo-ewa-lanczos, colorsystem=bt601, transfer=bt1886, radius=-1.00, clamp=0.00, copyDtoD libplacebo-shader: copyDtoD D:\rigaya\shader\SSimSuperRes.glsl, res=1440x1080, resampler=libplacebo-ewa-lanczos, colorsystem=bt709, transfer=bt1886, radius=-1.00, clamp=0.00, copyDtoD
Last edited by dietboby; 28th Nov 2024 at 22:18.
Similar Threads
-
Acrovid neoFootage AI convert SDR to HDR and more
By dom61 in forum Video ConversionReplies: 0Last Post: 19th Jul 2023, 14:57 -
Video shooting in HDR or SDR. Does HDR worth?
By Truthler in forum Camcorders (DV/HDV/AVCHD/HD)Replies: 32Last Post: 26th Feb 2022, 10:11 -
How do I convert HDR to SDR on a Mac?
By Alidapro in forum Newbie / General discussionsReplies: 2Last Post: 11th Dec 2021, 13:58 -
All new NVIDIA RTX 3000 GPUs announced to have AV1 hardware decoder
By Alkl in forum Latest Video NewsReplies: 4Last Post: 3rd Sep 2020, 17:40 -
CONVERT 4K HDR (.mkv) TO 4K SDR (.mp4) - Who helps me?
By Alberto78 in forum Video ConversionReplies: 6Last Post: 7th Mar 2020, 08:38