Asd-g / avslibplacebo

AviSynth+ libplacebo.
GNU General Public License v3.0
25 stars 2 forks source link

DoVi to SDR #6

Closed tormento closed 1 year ago

tormento commented 1 year ago

I have just bought The Flash UHD but I want to be able to see it on a standard 1080p TV too.

The video stream is:

MPEG-H HEVC Video 50861 kbps 2160p / 23.976 fps / 16:9 / Main 10 @ Level 5.1 @ High / 4:2:0 / 10 bits / 1000nits / HDR10 / BT.2020

MPEG-H HEVC Video 69 kbps (0.14%) 1080p / 23.976 fps / 16:9 / Main 10 @ Level 5.1 @ High / 4:2:0 / 10 bits / 1000nits / Dolby Vision MEL / BT.2020

Wanting to preserve the best quality possible from a DoVi UHD to SDR 1080p 10 bit, is it better to resize or tonemap first?

As far as I can read, the output is YUV444P16. What do you suggest to go to a simple 420?

Do you suggest to use light debanding too?

A simple script with the order and parameters you think are better, would be glad ;)

Asd-g commented 1 year ago

If you want to speed up the process - resize->tonemap, otherwise tonemap->resize.

About debanding - it's always better to check the source before applying debanding. If one have to apply or not apply blindly debanding to UHD BD source, I would say omit it. Debanding can be done additionally at the rendering step if needed but reversing already debanded video is almost impossible.

source
z_ConvertFormat(pixel_type="yuv444p16", resample_filter="x") # x preferred kernel for resampling the chroma. You can use whatever other filter than z_.. if you want - just go first to 16-bit and then to 444 (keep in mind top left chroma location).
libplacebo_Tonemap(src_csp=3, intent=0, tone_mapping_function=4, dst_max=150) # tune to your preferences but keep src_csp=3.
z_ConvertFormat(pixel_type="yuv420p16", resample_filter="x") # x preferred kernel for resampling the chroma. You can use whatever other filter than z_.. if you want.
# some additional filtering
# z_ConvertFormat(width=xx, height=yy, pixel_type="yuv420p10", resample_filter="x") # if you wouldn't do additional filtering you omit previously `z_ConvertFormat(pixel_type="yuv420p16", resample_filter="x")`. Keep in mind the final chroma location will be left (for SDR) instead top left.
quietvoid commented 1 year ago

As a note, for the Dolby Vision metadata to be detected you need to have a single layer video file (such as what MakeMKV outputs as MKV). Going from the original m2ts with 2 streams wouldn't use the metadata.

tormento commented 1 year ago

If you want to speed up the process - resize->tonemap, otherwise tonemap->resize.

You are telling me that tonemap->resize has higher quality?

z_ConvertFormat

Damn. I hoped I could avoid the z_ConvertFormat double pass. It eats so many cycles of my ancient CPU. No way to do it in CUDA/Vulkan/HW whatever?

tormento commented 1 year ago

As a note, for the Dolby Vision metadata to be detected you need to have a single layer video file (such as what MakeMKV outputs as MKV). Going from the original m2ts with 2 streams wouldn't use the metadata. So opening with UHD with DGIndexNV is a no-no?

"What" should detect DoVi? AVSLibPlacebo via frame properties?

quietvoid commented 1 year ago

"What" should detect DoVi? AVSLibPlacebo via frame properties?

Yes, if you don't have a single video file with the 2nd stream muxed in, the frame props won't be available in the clip. Since the metadata is in the 2nd video.

tormento commented 1 year ago

"What" should detect DoVi? AVSLibPlacebo via frame properties?

Yes, if you don't have a single video file with the 2nd stream muxed in, the frame props won't be available in the clip. Since the metadata is in the 2nd video. What if I don't want to use the frame properties but proceed "blindly"?

quietvoid commented 1 year ago

What if I don't want to use the frame properties but proceed "blindly"?

Then just use whatever video and src_csp=1 and it won't use Dolby Vision metadata.