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. |
5th December 2020, 15:17 | #1 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
Getting HDR Info from the C++ API
Hi,
as you know plenty of our workflows rely on Avisynth for pretty much everything. To get something meaningful out of it, I generally rely on the VideoInfo part of Avisynth in the SDK to forward information to the next blocks in the filterchain or to the encoders, muxers etc. Things like field parity, bits per pixel, color space, audio channels and so on are easily achievable as I can easily call them from the API and forward the information. The problem I'm facing now is that none of our HDR workflows are... ehm... HDR aware. I remember that a while ago ffms2 was updated to forward the relative HDR information like master display, maxcll etc to VapourSynth so that it could be used by other filters and could also be called via the API, so my question is: where are we in terms of Avisynth? I mean, is there a way to get these properties via the current C++ API? I know I could still run MediaInfo and FFProbe myself on the file before indexing it in Avisynth to get the relative properties and then forward them myself to the relative filters as I make the script (like on HDRTools etc) but that would add yet another step in the chain. Ideally, I would like to be able to get the properties from Avisynth and use them. I know that the .avi stream does not carry any of these things, which is the biggest limitation right now, but isn't it possible to get them by calling the API? I can't find anything in the SDK. |
5th December 2020, 16:25 | #2 | Link |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
these tags are stored as frame properties in vaporsynth, you access them by inspecting properties attached to the first frame of a node.
Code:
auto MasteringDisplayWhitePointX = 0.; auto MasteringDisplayPrimariesX = std::vector<double>{}; if (auto Frame0 = VideoClip[0]; Frame0["MasteringDisplayWhitePointX"].Exists() == false || Frame0["MasteringDisplayPrimariesX"].Exists() == false) Core.Alert("HDR properties not found!"); else { MasteringDisplayWhitePointX = Frame0["MasteringDisplayWhitePointX"]; for (auto x : Frame0["MasteringDisplayPrimariesX"]) MasteringDisplayPrimariesX.push_back(x); } |
11th December 2020, 12:40 | #6 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
FFMS2 is quite unfortunate. Create an issue and maybe I'll add support for it.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
Thread Tools | Search this Thread |
Display Modes | |
|
|