View Full Version : PNG supports PQ and HLG
tormento
8th March 2024, 23:40
I have recently found that the newer specifications (https://www.w3.org/TR/png-3/) of PNG allows HDR.
How can I export a frame from a video to this kind of PNG, keeping all the useful metadata?
The purpose is image comparison for encoding et similia.
huhn
9th March 2024, 00:34
mpv with GPU next write them.
but GPU next has accuracy issues when outputting RGB from ycbcr.
after that you still need a tool that can read this type of meta data.
the windows photo app can do that but it is hard to get 100 % accruate image from it and it really dislikes the wrong meta data mpv adds for the jokes.
chrome can also read them but the result is just a mess.
if you just want to look at them in SDR washed out you don't need the meta data and mpc-hc should do you more then justice.
tormento
9th March 2024, 09:42
Thank you!
I'd prefer to have a way to extract PNGs by some AVS+ plugin, so I can have a direct chain for saving screenshots.
StvG
9th March 2024, 21:58
You can use ImageWriter to save HDR video frame in PNG but no metadata will be stored (transfer, primaries...).
You can use ffmpeg -i input -ss xxx -vf zscale=chromal=topleft:filter=spline36:min=2020_ncl -vframes 1 output.png and the resulted png will have transfer, primaries... metadata.
Or if you don't want to use zscale (zimg) - ffmpeg -i input -ss xxx -vf scale=in_h_chr_pos=0:in_v_chr_pos=0:flags=spline:in_color_matrix=bt2020:flags=full_chroma_int+accurate_rnd+spline -vframes 1 output.png.
https://forum.doom9.org/showthread.php?p=1998501#post1998501 - "* The macro 'Save as Tiff_rgb48' has been replaced by 'Save Image_rgb48'. It can now be saved as tiff or png (requires ffmpeg.exe).". I didn't test this macro but probably the mentioned metadata is saved. Also you can ask @gispos if he could add a feature that such metadata is saved in png when AvsPmod is used directly for saving images.
tormento
10th March 2024, 11:33
Also you can ask @gispos if he could add a feature that such metadata is saved in png when AvsPmod is used directly for saving images.
That would be the best thing as I want to choose the frame to save. :)
FranceBB
10th March 2024, 17:01
AVSPmod mod is already using FFMpeg for high bit depth frame saving.
It uses its internal thing for up to RGB32 and then FFMpeg (which is optional and not shipped together with it) for high bit depth, so as long as FFMpeg can save it with the appropriate metadata, so will AVSPmod mod.
I'm sure Gispos will evaluate the idea, but keep in mind that FFMpeg receives from Avisynth the metadata through the frame properties, so you'll have to go through a bunch of annoying propSet() to get it right... :(
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.