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. |
31st December 2017, 09:45 | #21 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
@Atak_Snajpera: Thanks for the example!
---- @all: Is there a way to do this in Vapoursynth? Only thing I saw was the HDR10 to SDR with Hable tone-mapping'-thread. I also read somewhere that tone-mapping basically is wrapping zimg, so this should be possible with Vapoursynth (for someone who knows their way around Python&Vapoursynth), but is there a script out there which basically brings the tone-mapping functionality to Vapoursynth? Cu Selur |
2nd January 2018, 00:35 | #22 | Link |
Registered User
Join Date: Oct 2014
Posts: 268
|
zimg is the scaling library built into vapoursynth. So the vs.resize.xxxx functions are Z.Img routines. (And I used a lot of Vapoursynth's Resize docs in figuring out stuff for ffmpeg zscale filter :P).
So after using zimg / vs.resize to convert to linear RGB in floating point, you can tonemap with basic math in Python if you know the algorithm. The thread about it you're already active in: https://forum.doom9.org/showthread.php?t=174415 |
4th January 2018, 08:14 | #23 | Link |
Registered User
Join Date: Jan 2004
Location: Amsterdam
Posts: 7
|
ITU has released recommendation for HDR -> SDR conversion. You can find it here: https://www.itu.int/pub/R-REP-BT.2390-3-2017
Look at page 19: 5.4.1 Mapping to display with limited brightness range |
4th January 2018, 10:35 | #24 | Link |
Registered User
Join Date: Oct 2014
Posts: 268
|
Do note that they're talking about taking the full reference signal (between basically 0 and 10.000 nits) and display it on a normal HDR screen (which for instance can take a maximum of 1.000 nits).
That being said, in figure 20 they show multiple lines for target displays with different brightness capabilities, and they show a blue line for a screen with 100 nits max, which is a nice SDR target. I'm no math expert, so not really looking at that, but just the text and the graphs basically describe what looks like a pretty normal 'knee' to map the values? Which I boil down in my mind to 'they are recommending to clip signals lower than a certain threshold, clip signals higher than a certain threshold, and use a s-curve for the left-over signal so it looks nice with rolled-off shadows and rolled-off highlights on the target display'. Am I wrong? This will not really show any detail that might be present in the signal of 1000 nits or brighter, it just rolls it off and compresses it in the upper region. Algorithms like Hable are ment to recover some of those details, right? |
4th January 2018, 11:08 | #25 | Link | ||||
Registered User
Join Date: Jan 2004
Location: Amsterdam
Posts: 7
|
Quote:
Quote:
Quote:
Quote:
edit: UHD to SDR blu-ray most likely follow this recommendation. Last edited by Kef71; 4th January 2018 at 11:15. |
||||
6th February 2018, 13:14 | #26 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,815
|
Single threaded tonemapping is creating huge bottleneck on my 8C/16T CPU. Is there any way to speed up zscale by using multi-threading?
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper |
6th February 2018, 13:45 | #27 | Link |
Registered User
Join Date: Oct 2014
Posts: 268
|
From my Vapoursynth experience it's not zscale that is the speed limiting factor, but I'm only guessing.
ffmpeg isn't very good at multi-threading at all, and I think the tonemap filter is just made as a proof of concept as a single-threaded demo. Guess you will have to ask on the ffmpeg-user list. |
9th February 2018, 20:26 | #28 | Link | |
Registered User
Join Date: Oct 2001
Posts: 416
|
Quote:
|
|
9th February 2018, 20:32 | #30 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,815
|
See how it is done in ripbot264. Add some HDR footage and see C:\Temp\RipBot264temp\Job1\job1_EncodeVideoPass1.cmd.
Probably you made a typo somewhere...
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper |
9th February 2018, 20:35 | #31 | Link |
Registered User
Join Date: Oct 2001
Posts: 416
|
It's getting further now but still errors -
Code:
Input #0, avisynth, from 'Standard.avs': Duration: 00:01:56.83, start: 0.000000, bitrate: 0 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x532, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'smpte2084' [zscale @ 19ce05c0] Unable to parse option value "smpte2084" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'bt2020nc' [zscale @ 19ce05c0] Unable to parse option value "bt2020nc" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'bt2020' [zscale @ 19ce05c0] Unable to parse option value "bt2020" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'tv' [zscale @ 19ce05c0] Unable to parse option value "tv" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'smpte2084' [zscale @ 19ce05c0] Unable to parse option value "smpte2084" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'bt2020nc' [zscale @ 19ce05c0] Unable to parse option value "bt2020nc" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'bt2020' [zscale @ 19ce05c0] Unable to parse option value "bt2020" [zscale @ 19ce05c0] [Eval @ 0028e6cc] Undefined constant or missing '(' in 'tv' [zscale @ 19ce05c0] Unable to parse option value "tv" [zscale @ 19ce05c0] [Eval @ 0028e71c] Undefined constant or missing '(' in 'smpte2084' [zscale @ 19ce05c0] Unable to parse option value "smpte2084" [zscale @ 19ce05c0] Error setting option tin to value smpte2084. [Parsed_zscale_0 @ 19ce0b80] Error applying options to the filter. [AVFilterGraph @ 031b18e0] Error initializing filter 'zscale' with args 'tin=smpte2084:min=bt2020nc: pin=bt2020:rin=tv:t=smpte2084:m=bt2020nc:p=bt2020:r=tv' Error opening filters! x264 [error]: could not open input file `-' |
9th February 2018, 20:36 | #32 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,815
|
Update your ffmpeg https://ffmpeg.zeranoe.com/builds/
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper |
9th February 2018, 22:50 | #34 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
ffmpeg does support 10 bit input/output. But "format=yuv420p" sets 8 bit. 10 bit equivalent is called "yuv420p10le". (I haven't looked at the complete filter list, this is just the last filter.) And if you pipe to x264cli/x265cli you have to use a 10 bit build and possibly explicity set 10 bit output if it's a multi-depth build.
|
10th October 2018, 09:31 | #35 | Link | |
Guest
Posts: n/a
|
Quote:
The pipe -f yuv4mpegpipe - | doesn't work, but -f rawvideo - | x265 - does. The CL generates 3840x2160 rawvideo. If 1920x1080 is needed instead, add one more resizing filter: format=yuv420p,zscale=s=1920x1080 Thank you for the help with this topic. There is no need for using script.avs to introduce a Source filter. ffmpeg has one. Last edited by SpasV; 10th October 2018 at 09:35. |
|
13th October 2018, 21:03 | #37 | Link |
Guest
Posts: n/a
|
No, it seems format yuv4mpegpipe is not supported anymore.
Besides, the filter zscale=tin=smpte2084:min=bt2020ncin=bt2020:rin=tv:t=smpte2084:m=bt2020nc=bt2020:r=tv, added by dipje is not needed with the current FFmpeg version. It is not only a sort of no-op but it adds additional processing time with any frame. These FFmpeg filters (without this no-op) work at least three times slower than DGTonemap filters. |
13th October 2018, 21:20 | #38 | Link | |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
I highly doubt that. Why don't you post any logs?
Quote:
|
|
13th October 2018, 23:44 | #39 | Link | |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Quote:
Code:
ffmpeg -y -loglevel fatal -threads 8 -i "F:\TestClips&Co\files\HDR\4K sun HDR test.mp4" -map 0:0 -an -sn -vf zscale=tin=smpte2084:min=bt2020nc:pin=bt2020:rin=tv:t=smpte2084:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=2.000:peak=0.000,zscale=t=bt709:m=bt709:r=tv -pix_fmt yuv420p10le -strict -1 -vsync 0 -f yuv4mpegpipe - | x265 --input - --output-depth 10 --y4m --profile main10 --qg-size 8 --limit-modes --no-open-gop --opt-ref-list-length-pps --radl 2 --lookahead-slices 0 --crf 18.00 --opt-qp-pps --cbqpoffs -2 --crqpoffs -2 --limit-refs 0 --ssim-rd --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --deblock=-1:-1 --limit-sao --range limited --colormatrix bt709 --output "E:\Temp\00_35_54_2910_01.265" Code:
-strict -1 Code:
,format=yuv420p -strict -1 -f yuv4mpegpipe Cu Selur |
|
8th December 2018, 05:34 | #40 | Link |
Registered User
Join Date: Aug 2015
Posts: 9
|
I'm trying to convert an HDR/UHD movie to SDR/FHD. I've stumbled upon this article and am trying ffmpeg for the first time. I'm a regular user of Handbrake but unfortunately this is my first run with ffmpeg.
I've installed ffmpeg and ran the following command: ffmpeg.exe -i D:\Videos\Media\Temp\video.mkv -vf zscale=t=linear:npl=100,format=gbrpf32le, zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv, format=yuv420p -c:v libx265 -crf 18 -preset slower D:\Videos\Media\Temp\output.mkv I've renamed the movie file (for simplicity sake) to video. Right now I'm getting the following error: "at least one output file must be specified". Any help would be greatly appreciated. If someone could give me the exact command to try that would be most helpful. The "video.mkv" file is located in D:\Videos\Media\Temp. Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|