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 > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th December 2022, 16:51   #241  |  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 Dragon1981 View Post
Used FranceBB LUT for iPhone SDR export but it doesn't quite go near to DV v5 color matching.
Have you tried the standard HLG to BT709 LUTs too?
The thing is that a lut doesn't understand Dolby Vision metadata, it's just a matrix: numbers in, numbers out, so the results can change.
Post a sample and I'll see what I can do.

Oh, almost forgot: Merry Christmas!
FranceBB is offline   Reply With Quote
Old 28th December 2022, 13:58   #242  |  Link
Dragon1981
Registered User
 
Join Date: Oct 2022
Posts: 4
Quote:
Originally Posted by FranceBB View Post
Have you tried the standard HLG to BT709 LUTs too?
The thing is that a lut doesn't understand Dolby Vision metadata, it's just a matrix: numbers in, numbers out, so the results can change.
Post a sample and I'll see what I can do.

Oh, almost forgot: Merry Christmas!
Merry Christmas!

Whenever I import "HLG_BT2020_to_Linear_BT709.cube " LUT in my resolve, it gives error". Attached is the screenshot.
Other LUTs import worked fine from your collection.

Below, I am giving original sample and processed videos as you asked.

Original HLG video from iPhone 12:
https://drive.google.com/file/d/1M_O...usp=share_link

Processed SDR video in resolve with your "HLG_A_to_LinearBT709" LUT:
https://drive.google.com/file/d/1RaN...usp=share_link

Processed Dolby Vision Profile v5 video in Resolve:
https://drive.google.com/file/d/1L4z...usp=share_link

I am attaching project settings and export video settings of Resolve here for dolby vision export and SDR export for your information.
Attached Images
    
Dragon1981 is offline   Reply With Quote
Old 4th January 2023, 12:14   #243  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Happy New Year!

So... let's first take a look at what we have here.
The reference white of 75% has overshooting over 0.52V in what is supposed to be specular highlights like the reflections in the tiara and the other pieces of jewelry that the girl is wearing. Far from being an ideal shot, but I guess we can't expect much from a tiny sensor like the one we have in mobile phones (iPhones included):



Although there's a great deal of motion blur at 29,970p, at least the real reference white is correctly positioned at 0.52V as we can see on the left hand side of the waveform monitor, so looks like Apple didn't screw this up completely after all:




This is the conversion with the non public BBC LUT:

Code:
video=LWLibavVideoSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Sample.mov")
audio=LWLibavAudioSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Sample.mov")
AudioDub(video, audio)

ConvertBits(16)
ConvertToPlanarRGB(matrix="Rec2020")
Cube("C:\Program Files (x86)\AviSynth+\LUTs\8a_HLG_bt709_AC_mode-nar_in-nar_out-nar_nocomp.cube", fullrange=true)
ConverttoYUV420(matrix="Rec709")



Now, I know that the BBC LUT is correct, which means that there's something deeply wrong in the way Apple's logic saved the BT.2020 colours as there's a huge shift towards the magenta and red.
As always, my HLG_A_to_LinearBT709 LUT was done in 2021 to address that and in fact the result is quite pleasing:

Code:
video=LWLibavVideoSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Sample.mov")
audio=LWLibavAudioSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Sample.mov")
AudioDub(video, audio)

ConvertBits(16)
ConvertToPlanarRGB(matrix="Rec2020")
Cube("C:\Program Files (x86)\AviSynth+\LUTs\HLG_A_to_LinearBT709.cube", fullrange=true)
ConverttoYUV420(matrix="Rec709")




The magenta shift is still quite noticeable, though, in your case, so I would still consider color shifting a bit more or reduce the saturation in the magenta part only altogether.
I think something like this looks much more natural:

Code:
video=LWLibavVideoSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Sample.mov")
audio=LWLibavAudioSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Sample.mov")
AudioDub(video, audio)

ConvertBits(16)
ConvertToPlanarRGB(matrix="Rec2020")
Cube("C:\Program Files (x86)\AviSynth+\LUTs\HLG_A_to_LinearBT709.cube", fullrange=true)
ConverttoYUV420(matrix="Rec709")
tweak(StartHue=75, EndHue=135, sat=0.70, dither=true)

Last edited by FranceBB; 4th January 2023 at 12:18.
FranceBB is offline   Reply With Quote
Old 5th January 2023, 10:06   #244  |  Link
Dragon1981
Registered User
 
Join Date: Oct 2022
Posts: 4
Quote:
Originally Posted by FranceBB View Post
Happy New Year!
Happy New Year. That's one hell of analysis which is certainly above my understanding and requirement. Thanks for the detailed reply though.
I shoot lots of home videos of my daughter. I normally convert them in Dolby Vision (for my TV) and Rec709 (for sharing).
Just wanted to have quick LUT which can give me Rec709 video in color grades like Dolby Vision.
I guess I will just use your LUT which gives decent colours in Rec709.
Dragon1981 is offline   Reply With Quote
Old 5th January 2023, 10:29   #245  |  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 Dragon1981 View Post
I shoot lots of home videos of my daughter.
Oh, I didn't know that she was your daughter.
It's nice that you get to spend some time with your family.

Quote:
Originally Posted by Dragon1981 View Post
I guess I will just use your LUT which gives decent colours in Rec709.
Yeah, for home videos sharing is more than enough.
The "official" use we have of that LUT is for our News channel.
Essentially we get people/viewers sending us videos from all over the world 'cause everyone has a smartphone around these days and people started sending us videos in HLG shot with the iPhone in early 2021, so we needed to cope with those, especially given that the news channel is still in FULL HD BT709, hence the LUT.
The other use we had for this LUT was during the America's Cup 'cause we couldn't send cameramen physically on the boats as they would slow them down, so we had the crew recording videos on their iPhone in HLG and sending those over (I talked about this early on in this topic if you're curious )
FranceBB is offline   Reply With Quote
Old 17th February 2023, 20:32   #246  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 539
There are now HDR10+ EETFs in libplacebo and in ffmpeg. https://github.com/FFmpeg/FFmpeg/com...2530c2e0d86450

So initial support for the base of Dolby Vision curves too, another part of ST2094
Balling is offline   Reply With Quote
Old 23rd February 2023, 17:29   #247  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Any chance of having a CPU only version of libplacebo in FFMpeg as well as the current GPU one?
I mean, currently it requires GPU acceleration, which is fine for on prem, but not very cloud friendly given the limits of most AWS EC2...
Ideally, if a GPU isn't available, it should be able to have a CPU only fallback instead of failing.
FranceBB is offline   Reply With Quote
Old 23rd February 2023, 18:36   #248  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
Quote:
Originally Posted by FranceBB View Post
Any chance of having a CPU only version of libplacebo in FFMpeg as well as the current GPU one?
I mean, currently it requires GPU acceleration, which is fine for on prem, but not very cloud friendly given the limits of most AWS EC2...
Ideally, if a GPU isn't available, it should be able to have a CPU only fallback instead of failing.
I've had no problem running it with "lavapipe" on Linux. Of course it comes from mesa.
https://archlinux.org/packages/extra...vulkan-swrast/

Following the Arch Wiki example for "Software Vulkan: lavapipe" at: https://wiki.archlinux.org/title/Vulkan.

Quote:
Environment vars: LIBGL_ALWAYS_SOFTWARE=1 __GLX_VENDOR_LIBRARY_NAME=mesa VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.i686.json:/usr/share/vulkan/icd.d/lvp_icd.x86_64.json
Command: ffmpeg -i video.mkv -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p test.mkv
Quote:
[libplacebo @ 0x563979c887c0] Device Name: llvmpipe (LLVM 15.0.7, 256 bits)
I don't know if this method would work for your environment.
In FFmpeg, vf_libplacebo is currently only supported for Vulkan frames. It's a GPU library, after all.
__________________
LG C2 OLED | GitHub Projects

Last edited by quietvoid; 23rd February 2023 at 18:39.
quietvoid is offline   Reply With Quote
Old 1st April 2023, 19:13   #249  |  Link
OrangeColaJuice
Registered User
 
Join Date: Dec 2021
Posts: 16
... my ancient iGPU lacks Vulkan support, so sad that I can't make short videos of my favorite HDR movies to share on Mongolian basket waving forums/imageboards.
OrangeColaJuice is offline   Reply With Quote
Old 1st April 2023, 23:04   #250  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 412
Quote:
Originally Posted by OrangeColaJuice View Post
... my ancient iGPU lacks Vulkan support, so sad that I can't make short videos of my favorite HDR movies to share on Mongolian basket waving forums/imageboards.
I lived in Ulaanbaatar, Mongolia from 1995 to 2000.

I don't remember anything about basket weaving.
wswartzendruber is offline   Reply With Quote
Old 17th June 2023, 21:46   #251  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 355
Thank you for sharing your LUTs, FranceBB . I think I've wrapped my head around their use enough to run some tests, but I'm unsure which to use for a BT.2020 PQ source that I want to transform into BT.709 ??. I've a 4K source but no 4K TV, so I want to downscale to 2K but don't know all the technical language. Here's a Test Clip.
_____________

Edit: Please ignore the above; I just remembered that the reason I'm even here is because you posted a link when helping me on the HDRTools Plugins thread (which has your script ).

Last edited by LouieChuckyMerry; 17th June 2023 at 21:51. Reason: D'oh
LouieChuckyMerry is offline   Reply With Quote
Old 17th June 2023, 23:31   #252  |  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 LouieChuckyMerry View Post
I just remembered that the reason I'm even here is because you posted a link when helping me on the HDRTools Plugins thread (which has your script ).
LOL and you posted the same example clip with trees xD

Quote:
Originally Posted by LouieChuckyMerry View Post
I'm unsure which to use for a BT.2020 PQ source that I want to transform into BT.709 ?
It's as easy as it sounds: to go from BT2020 PQ to BT709 you need, quite intuitively, the PQ_to_BT709_v1.cube or the PQ_to_BT709_v2.cube.

In other words, if you were to run it manually in Avisynth, it would be:

Code:
#Indexing
FFVideoSource("D:\TestClip2[2160p].mkv")

#Bringng everything to 16bit planar
ConvertBits(16)

#Going from YUV limited tv range to RGB full range
ConverttoPlanarRGB(matrix="Rec2020")

#From BT2020 PQ to BT709 SDR
Cube("PQ_to_BT709_v2.cube", fullrange=true)

#Going back from RGB full Range to YUV limited tv range
Converttoyuv420(matrix="Rec709")

#Dithering down to 8bit planar with the Floyd Steinberg Error Diffusion
ConvertBits(bits=8, dither=1)


OR if you use my plugin, LinearTransformation(), you can easily just do:

Code:
FFVideoSource("D:\TestClip2[2160p].mkv")

LinearTransformation(Input="BT2100_PQ", Output="Linear_BT709")
as described here: https://github.com/FranceBB/LinearTransformation
FranceBB is offline   Reply With Quote
Old 24th June 2023, 20:42   #253  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 355
Happy Saturday! I finally found some time to figure things out and run some tests, and was curious for your learned opinion. I tried your LinearTransformation:

Code:
ConvertToPlanarRGB(Matrix="Rec2020",Interlaced=False)
ConvertBits(Bits=16)
Spline36Resize(1920,1080)
Cube("F:\InstalledPrograms\AviSynth+\LUTs\PQ_to_BT709_v2.cube",Fullrange=True)
ConvertToYUV420()
and Donald Graft"s "DGHDRToSDR()":

Code:
ConvertToYUV420()
ConvertBits(Bits=16)
Spline36Resize(1920,1080)
DGHDRToSDR()
and Avidemux's "HDR tone mapping" feature with the "RGB Hable" option and "Spline" resizing. All default values and encoded with UtVideo. Here are my results:



and



and



and



and



and



I think the results with Avidemux look the best, but I'd prefer to use your LinearTransformation because it's faster and I can fine-tune the resizing and encoding options. Would you have a suggestion(s) how to tweak the settings to "brighten" the results?

Edit: Apologies for the massive images; not sure how fix that...

Last edited by LouieChuckyMerry; 24th June 2023 at 20:50. Reason: Image Links; Image Sizes
LouieChuckyMerry is offline   Reply With Quote
Old 24th June 2023, 22:17   #254  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
No apologies needed, nice comparison !
Judging from two panels (10bit-100%DCI-P3 + 8bit-100%NTSC) both France BB and Donald Grafts look fabulous,
France BB seems to match the hi-end panels, DG seems to match the majority of panels ATM (and AviDemux seems overdone).
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 24th June 2023 at 22:27.
Emulgator is offline   Reply With Quote
Old 25th June 2023, 19:12   #255  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 355
Emulgator: Thanks for your informative reply . I agree that the Avidemux results seem a bit overdone but, on both my laptops, they appear much less overdone than the other two appear underdone, at least to my eyes. Granted, both laptops are at least ten years old and have 1600x900 14" screens. By underdone I mean that they're slightly dark, with the FranceBB's looking a bit darker than the Donald Graft's; it's as if I'm wearing sunglasses relative to the Avidemux's, and with slightly darker lens when viewing the FranceBB's. I guess I'll check things out on my HDTV.
LouieChuckyMerry is offline   Reply With Quote
Old 26th June 2023, 14:45   #256  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
I noticed that you're using the v2 cube.
That version targets 50k$ Sony reference monitors for up to 4000 nits PQ contents (technically also above as it doesn't clip but rolls back to 100 nits all values 'till 10000 with a knee, but still).
Your content clearly has a much lower MaxCLL, therefore you should really use v1.

To put it in your own code:

Code:
ConvertToPlanarRGB(Matrix="Rec2020", Interlaced=False)
ConvertBits(Bits=16)
Spline36Resize(1920,1080)
Cube("F:\InstalledPrograms\AviSynth+\LUTs\PQ_to_BT709_v1.cube", Fullrange=True)
ConvertToYUV420(Matrix="Rec709")

Quote:
Originally Posted by Emulgator View Post
Judging from two panels (10bit-100%DCI-P3 + 8bit-100%NTSC) both France BB and Donald Grafts look fabulous,
France BB seems to match the hi-end panels, DG seems to match the majority of panels ATM (and AviDemux seems overdone).

Yeah, Avidemux is really off in this case.
And you're right, I did it targeting the professional broadcast monitors we have here at work while looking at the Tektronix Waveform Monitor connected via SDI, so not really surprising ehehehehehehe
But I'm glad it all checks out.

Last edited by FranceBB; 26th June 2023 at 14:52.
FranceBB is offline   Reply With Quote
Old 26th June 2023, 17:40   #257  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 355
Emulgator: Oooweeee! I'm glad I checked things out on my HDTV. And I admire your restraint, as "overdone" is very generous of you. Actually, "...France BB seems to match the hi-end panels, DG seems to match the majority of panels ATM..." seems spot on. Thanks again .
_____________

FranceBB: Thanks for the information and suggestion; I'll run new tests comparing The Donald Graft Method to The New, Improved FranceBB Technique then make a choice. Ahhh, and don't blame Avidemux; it was 100% operator error ;-) .
_____________

EDIT: Happy Friday! The results with PQ_to_BT709_v1.cube are excellent for color and black & white sources, and I thank you again for your kind help .

Last edited by LouieChuckyMerry; 14th July 2023 at 16:55.
LouieChuckyMerry is offline   Reply With Quote
Old 25th September 2023, 20:42   #258  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Linear Transformation v2.5 Released!

- Introduced a new optional parameter "Interpolation" which is a string and can be set either to Trilinear or to Tetrahedral (default is Tetrahedral)
- Temporarily removed x86 support as version 1.4 of the main dependency, Donald Graft's avscube, is now x64 only

As an example, a new way to call the function is now:

Code:
LinearTransformation(Input="Linear_BT709", Output="DCI_XYZ", Interpolation="Tetrahedral")

The interpolation parameter can either be set to "Trilinear" or "Tetrahedral" and by default it's set to Tetrahedral as it achieves better results.
Source (left) - Trilinear (center) - Tetrahedral (right):


As you can see, in the right hand side waveform (tetrahedral) there are no ripples, unlike the ones you can see in the trilinear interpolation at the center.

I've already ported the new parameters to FFAStrans 1.4 as well so that they can be selected from the GUI



although FFAStrans 1.4 is still in beta so it's not public yet as we're testing it extensively.
FranceBB is offline   Reply With Quote
Old 27th September 2023, 09:12   #259  |  Link
spoRv
Registered User
 
Join Date: Nov 2016
Posts: 151
Great FranceBB, thanks!
spoRv is offline   Reply With Quote
Old 6th October 2023, 18:25   #260  |  Link
ProWo
Registered User
 
Join Date: Mar 2020
Posts: 304
Hi FranceBB

can you tell me a working FFmpeg command line to apply your LUTs?
If I apply this:
ffmpeg -i input_HDR -vf lut3d=your_lut ...
I always get wrong colors (to much contrast, to much red).

TIA
prowo

EDIT:
Found it.
-colorspace -color_primaries -color_trc must be specified explicitly after the lut.

Last edited by ProWo; 9th October 2023 at 08:15.
ProWo is offline   Reply With Quote
Reply

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 23:06.


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