Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th March 2022, 18:14   #1  |  Link
Cedvano
Registered User
 
Join Date: Jul 2009
Posts: 244
Add HDR metadata on SDR video.

Hello, is it possible to convert SDR video to HDR video (or even Dolby Vision)? A bit like MadVR does to convert HDR to Dovi.

I tried with ffmpeg, but they catch a tint to red.

I'm upscaling videos in 4K and would like to put them in HDR.

Thank you for your answers.
Cedvano is offline   Reply With Quote
Old 26th March 2022, 22:24   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by Cedvano View Post
Hello, is it possible to convert SDR video to HDR video (or even Dolby Vision)? A bit like MadVR does to convert HDR to Dovi.

I tried with ffmpeg, but they catch a tint to red.

I'm upscaling videos in 4K and would like to put them in HDR.

Thank you for your answers.
I've gone past the times in which I used to ask users "why", I just roll out solutions now XD
Assuming you're upscaling from BT709 SDR FULL HD and your video is already progressive:

Quote:
#Indexing
video=LWLibavVideoSource("yoursource.whatever")
audio=LWLibavAudioSource("yoursource.whatever")
AudioDub(video, audio)

#Bring everything to 16bit planar
ConvertBits(16)

#Upscale
nnedi3_rpow2(cshift="Spline64ResizeMT", rfactor=2, fwidth=3840, fheight=2160, nsize=4, nns=4, qual=1, etype=0, pscrn=2, threads=0, csresize=true, mpeg2=true, threads_rs=0, logicalCores_rs=true, MaxPhysCore_rs=true, SetAffinity_rs=false)

#Going from BT709 SDR to BT2020 HLG HDR
LinearTransformation(Input="Linear_BT709", Output="BT2020_HLG")
then feed this Avisynth Script to x265 with the following BAT:

Code:
ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\Production\AVS\test.avs" -vf scale=out_color_matrix=bt2020nc:out_h_chr_pos=0:out_v_chr_pos=0 -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --no-high-tier --ref 4 --profile main10 --crf 22 --deblock -1:-1 --hdr-opt --hrd --min-luma 64 --max-luma 940 --chromaloc 2 --range limited --videoformat component --colorprim bt2020 --transfer arib-std-b67 --colormatrix bt2020nc --atc-sei 18 --overscan show --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000  --wpp -o "\\VBOXSVR\Share_Windows_Linux\raw_video.hevc"

ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\Production\AVS\test.avs" -map 0:1 -af loudnorm=I=-24:LRA=14:tp=-2 -c:0:1 ac3 -b:0:1 384k -ar 48000 "\\VBOXSVR\Share_Windows_Linux\audio.ac3"

pause
then you can use MKVToolnix to mux them in .mkv
I would write a command line command for it but it's 10PM on Saturday evening and I just don't feel like it, but yeah, you can use whatever you want to encode it with whatever settings and whatever container as long as it supports H.265 and HDR metadata.

p.s in case you don't feel comfortable using Avisynth or x265 directly and you wanna use FFMpeg to do everything, just apply the LUT from within FFMpeg and call it a day: https://forum.doom9.org/showthread.php?t=176091

Cheers,
Frank

Last edited by FranceBB; 26th March 2022 at 22:28.
FranceBB is offline   Reply With Quote
Old 27th March 2022, 03:19   #3  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
why++

Simple automated SDR to HDR upsampling won't always give accurate or visual pleasing "enhancements." And they certainly don't match the HDR grade the creatives would have made.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th March 2022, 06:29   #4  |  Link
lvqcl
Registered User
 
Join Date: Aug 2015
Posts: 293
Quote:
Originally Posted by benwaggoner View Post
why++
some like it fake
lvqcl is offline   Reply With Quote
Old 27th March 2022, 11:37   #5  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 539
The worst part is the opposite when you have SDR video (means tagged as 709 transfer), yet it has sei with hdr10 metadata. Like in sony camp demo.
Balling is offline   Reply With Quote
Old 27th March 2022, 15:25   #6  |  Link
Cedvano
Registered User
 
Join Date: Jul 2009
Posts: 244
Thank you @FranceBB
Cedvano is offline   Reply With Quote
Old 4th April 2022, 21:13   #7  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
It's going to be far from perfect.
You would need some well done tool, which would do it in 2 passes and per scene. Technicolor use to work on such a tool, but no idea what happened with it.
We still struggle with HDR to SDR conversion as any tool which does it globally (not per scene based on analysis) will give compromised results.
kolak is offline   Reply With Quote
Reply

Tags
dolby vision, hdr

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:59.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.