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. |
9th May 2020, 10:18 | #1 | Link |
Registered User
Join Date: Aug 2013
Posts: 9
|
HW / GPU Tone Mapping with FFMPEG
Hi,
Quite simply a cry for help! I'm running a Linux media server, and recently bought a cheap NVIDIA P400 ( Linux Stream Patch Applied) for HW Accelerated Remux when away from home. I want to do HDR -> SDR Tonemap on the few 4K HDR movies don't also have the blurray for. I've compiled FFMPEG with appropriate flags and managed to run: Code:
ffmpeg -hwaccel nvdec -init_hw_device opencl=ocl -filter_hw_device ocl -threads 4 -extra_hw_frames 3 -I INPUT.mkv -vf "format=p010,hwupload,tonemap_opencl=t=bt709:r=tv:p=bt709:m=bt709:tonemap=hable:format=p010,hwdownload,format=p010" OUTPUT Can anyone give me a simple 10BIT HDR -> 8BIT SDR HW Accelerated command using either Hable or Mobius? FYI Linux server, CLI only. I've spent over a week searching and trying... mainly failing! Thanks. Alex |
9th May 2020, 15:26 | #3 | Link |
Registered User
Join Date: Aug 2013
Posts: 9
|
Can you please explain how I am expecting miracles?
Software Tonemapping via zscale is limited to single thread processing. GPU processing by its very nature is designed for parallel processing... hence why they are used in graphical processing. The P400 has two cores which should outperform a single CPU core. I will happy be corrected on any of the above? Also; if someone can confirm my command is correct and is the most optimised it can be then I will thank them and be content. EDIT: Just to add; the GPU isn’t at 100% utilisation so improvements are possible. Last edited by alxscott; 9th May 2020 at 15:50. |
9th May 2020, 15:33 | #4 | Link | |
Testeur de codecs
Join Date: May 2003
Location: France
Posts: 2,505
|
Quote:
__________________
Le Sagittaire ... ;-) 1- Ateme AVC or x264 2- VP7 or RV10 only for anime 3- XviD, DivX or WMV9 |
|
9th May 2020, 16:12 | #6 | Link | |
Registered User
Join Date: Aug 2013
Posts: 9
|
Quote:
I was under the impression that due to the flags in the command everything was kept in the GPU memory buffer as it was hardware decoded; tonemapped then hardware encoded? No zscaling or the like that would need it to be transferred back? That’s what I understood from NVIDIA guide https://devblogs.nvidia.com/nvidia-f...scoding-guide/ |
|
9th May 2020, 16:24 | #7 | Link |
Useful n00b
Join Date: Jul 2014
Posts: 1,666
|
I looked up your card and it is not so bad: 256 CUDA cores, PCIe 3.0, DDR5, 64-bit memory interface. Seems like you should be able to get some gain. I don't know enough about ffmpeg to know if it can properly tap the card's power in your use case. Is it using CUDA cores for the tone mapping and/or resizing?
Last edited by videoh; 9th May 2020 at 16:27. |
9th May 2020, 16:32 | #8 | Link | |
Registered User
Join Date: Aug 2013
Posts: 9
|
Quote:
|
|
9th May 2020, 16:36 | #9 | Link |
Useful n00b
Join Date: Jul 2014
Posts: 1,666
|
It's using opencl and who knows what that is doing?
If you have Avisynth+ installed you could use my CUDA DGHDRtoSDR() filter and play the script in your player (if it supports that), or transcode by opening the script with your encoder. EDIT: Oops, you are on linux. Last edited by videoh; 9th May 2020 at 16:40. |
9th May 2020, 16:52 | #10 | Link | |
Registered User
Join Date: Aug 2013
Posts: 9
|
Quote:
|
|
9th May 2020, 16:59 | #11 | Link |
Registered User
Join Date: May 2009
Posts: 338
|
AFAIK, Plex, Emby, Jellfyfin, et all do NOT support this. In fact none of them can get it right because it's not currently possible. Intel is adding this feature into Icelake.
If you want to watch these movies, watch them on the proper hardware. |
9th May 2020, 17:06 | #12 | Link | |
Registered User
Join Date: Aug 2013
Posts: 9
|
Quote:
Plex, where using mpv as its player can support tone mapping client side to SDR ( using usual filters ... Hable , Mobius, Linear etc. ) This is why I’m using FFMPEG separately to generate a HDR -> SDR version. I know this is possible as I have done it using both software and hardware, as shown above. My question is for a more optimised command as currently hardware transcoding is running slower than CPU transcoding. EDIT: Just to mention I am using proper hardware; 2019 NVIDIA Pro and Dolby Atmos capable surround sound. This is for when I need to remote view. |
|
12th May 2020, 14:05 | #16 | Link |
Registered User
Join Date: Aug 2013
Posts: 9
|
Solved
I managed to find a good compromise in quality and speed; with satisfactory results which for me were : FHD SDR tonemapped output.
For anyone else; this is the command I've decided to use going forward: Code:
ffmpeg -vsync 0 -hwaccel cuda -init_hw_device opencl=ocl -filter_hw_device ocl -extra_hw_frames 3 -threads 16 -c:v hevc_cuvid -resize 1920x1080 -i INPUT -vf "format=p010,hwupload,tonemap_opencl=tonemap=mobius:param=0.01:desat=0:r=tv:p=bt709:t=bt709:m=bt709:format=nv12,hwdownload,format=nv12" -c:a copy -c:s copy -c:v libx264 -max_muxing_queue_size 9999 OUTPUT Just as a note, I decided to use software encoding due to the significant quality increase but minimal time increase for encoding . Thank you all. |
20th May 2020, 08:31 | #18 | Link |
Registered User
Join Date: Aug 2013
Posts: 9
|
Hey! I did try removing the hwupload/download arguments; especially when I was using the GPU encoder... but it kept throwing an error. As you can tell no FFmpeg expert but I think it was because I was changing colour space???
|
Tags |
hdr, nvidia, opencl, sdr, tonemap |
Thread Tools | Search this Thread |
Display Modes | |
|
|