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 8th December 2021, 06:57   #61  |  Link
damian101
Registered User
 
damian101's Avatar
 
Join Date: Feb 2021
Location: Germany
Posts: 21
Quote:
Originally Posted by SpasV View Post
Thank you for the post.
The CL generates 3840x2160 rawvideo. If 1920x1080 is needed instead, add one more resizing filter:

format=yuv420p,zscale=s=1920x1080
Resize before tonemapping to speed tonemapping up a lot.
damian101 is offline   Reply With Quote
Old 18th July 2024, 12:52   #62  |  Link
Anuskuss
Registered User
 
Join Date: Jul 2024
Posts: 5
Is there an alternative for when zscale isn't available?
Anuskuss is offline   Reply With Quote
Old 18th July 2024, 19:52   #63  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 8,389
try libplacebo
huhn is offline   Reply With Quote
Old 18th July 2024, 21:17   #64  |  Link
Anuskuss
Registered User
 
Join Date: Jul 2024
Posts: 5
Quote:
Originally Posted by huhn View Post
try libplacebo
And what if that's not available either (this is not a hypothecial question)?
Anuskuss is offline   Reply With Quote
Old 19th July 2024, 05:37   #65  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 8,389
i don't know a 3rd thing that act as a scaler in ffmpeg.
huhn is offline   Reply With Quote
Old 19th July 2024, 08:01   #66  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
If you are not sold on FFmpeg and AviSynth+ is an alternative for you, then you can try DGHDRtoSDR by Donald Graft.

Good luck
manolito
manolito is offline   Reply With Quote
Old 19th July 2024, 12:11   #67  |  Link
Anuskuss
Registered User
 
Join Date: Jul 2024
Posts: 5
Thanks for the tips but neither AviSynth+ nor DGHDRtoSDR are suitable alternatives - I need to use ffmpeg. In the end I decided to go for OpenCL:
Code:
ffmpeg -i hdr.mp4 -vf format=p010,hwupload,tonemap_opencl=tonemap=mobius:format=nv12:m=bt709:p=bt709:r=tv,hwdownload,format=nv12 thumb-%06d.jpg
The colors are not perfect but better than doing no color conversion at all. If someone knows an ffmpeg filter which improves upon this please let me know.
Anuskuss is offline   Reply With Quote
Old 20th July 2024, 11:34   #68  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 346
Quote:
Originally Posted by Anuskuss View Post
The colors are not perfect but better than doing no color conversion at all. If someone knows an ffmpeg filter which improves upon this please let me know.
I gave it a go and managed to get improved results:

Code:
ffmpeg -init_hw_device opencl -i HDR.mkv -vf hwupload,tonemap_opencl=tonemap=reinhard:param=0.1:desat=0:format=nv12:t=bt709:p=bt709:m=bt709:r=tv,hwdownload,format=nv12 SDR.mp4
While not perfect, it is not too far from the zscale/tonemap version that I use:

Code:
ffmpeg -i HDR.mkv -vf zscale=t=linear:npl=291,format=gbrpf32le,zscale=1920:-1:f=spline36,tonemap=reinhard:param=0.6:desat=0,zscale=t=709:p=709:m=709:r=limited:dither=error_diffusion,format=yuv420p,sidedata=delete OUTPUT
If it's too dark, raise "param" a little at a time. Another problem is that the brightness fluctuates per scene: there is a "threshold" parameter but I didn't test it.
GeoffreyA is offline   Reply With Quote
Old 21st July 2024, 07:05   #69  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
Quote:
Originally Posted by Anuskuss View Post
Is there an alternative for when zscale isn't available?
I still do not understand why zscale is not available when you use a plain vanilla current version of FFmpeg. Could you upload a short sample of your source file and specify the desired target size so forum members could do some experimentation?


Cheers
manolito
manolito is offline   Reply With Quote
Old 21st July 2024, 21:01   #70  |  Link
Anuskuss
Registered User
 
Join Date: Jul 2024
Posts: 5
Quote:
Originally Posted by manolito View Post
when you use a plain vanilla current version of FFmpeg
I'm using a fork of ffmpeg called Plex Transcoder which is used by Plex (among other things) for thumbnail generation. In it's default state it will create washed out thumbnails for HDR content so I hijacked the command and inserted the OpenCL tonemap filter.

On my desktop I can just do zscale+tonemap which looks way better of course. Maybe someday I'll investigate how the thumbnails are stored on disk and replace them myself, although that sounds tedious and like something I'll eventually forget to do.
Anuskuss is offline   Reply With Quote
Old 22nd July 2024, 09:27   #71  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 346
Code:
ffmpeg -init_hw_device opencl -i HDR.mkv -vf hwupload,tonemap_opencl=tonemap=reinhard:param=0.1:desat=0:format=nv12:t=bt709:p=bt709:m=bt709:r=tv,hwdownload,format=nv12 OUTPUT
Not perfect but an improvement. If too dark, raise "param" a little at a time.
GeoffreyA is offline   Reply With Quote
Old 23rd July 2024, 07:16   #72  |  Link
Anuskuss
Registered User
 
Join Date: Jul 2024
Posts: 5
Quote:
Originally Posted by GeoffreyA View Post
Not perfect but an improvement. If too dark, raise "param" a little at a time.
While I do appreciate the effort I don't think I'll ever touch the tuning parameters, as I find them too subjective. Sure I can create some beautiful colors with some fine tuning but I have no guarantee that it will look good in the next scene, let alone in a different movie. I'd rather have some "sane" defaults that some color theorist came up with or something that is based on some sort of defined standard. I mean Plex is basically doing the same thing anyway (just with an additional scale_vaapi to get the data into the right format) and while I don't think they do the best thing possible, they must've put some thought into it.
Anuskuss is offline   Reply With Quote
Old 23rd July 2024, 07:51   #73  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 346
I agree and am of the encoding philosophy to keep the picture "as is." (Except in cases where work is needed, such as debanding anime or fixing problematic material.) What nags me is that, while there are standard ways of tone mapping, for example the ITU-R recommendations, it seems that in practice, one always has to tune the parameters a bit. I wish this were a "solved problem" but we're not there yet and subjectivity is involved.

At present, I have a project where I'm tone mapping the Lord of the Rings 4K remastering down to SDR 1080p, trying to match the remastered 1080p Extended Edition I have access to, and while I'm getting excellent results, it is challenging to match the reference exactly, and getting one scene right may fail another.

Last edited by GeoffreyA; 23rd July 2024 at 07:56.
GeoffreyA is offline   Reply With Quote
Old 28th April 2025, 19:57   #74  |  Link
Argaricolm
Registered User
 
Join Date: Apr 2018
Posts: 58
I delete my question. To do same as MadVR does we need to do "linear" tonemapping (libplacebo has it).

Last edited by Argaricolm; 28th April 2025 at 20:25. Reason: Found solution.
Argaricolm 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 02:42.


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