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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th December 2020, 15:17   #1  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
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.
FranceBB is offline   Reply With Quote
Old 5th December 2020, 16:25   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
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);
}
avisynth+ has supported frame properties last time I checked, so it's theoretically possibly to do this in avisynth+.
feisty2 is offline   Reply With Quote
Old 11th December 2020, 11:17   #3  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
Ok, so those are supported in Avisynth as well and not just VapourSynth, right?
FranceBB is offline   Reply With Quote
Old 11th December 2020, 11:38   #4  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
avisynth+ has provided the facility to do this, but afaic, the ffms2 plugin does not make use of such functionality for avisynth, probably out of compatibility concerns.
feisty2 is offline   Reply With Quote
Old 11th December 2020, 12:35   #5  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,869
Quote:
Originally Posted by feisty2 View Post
avisynth+ has provided the facility to do this, but afaic, the ffms2 plugin does not make use of such functionality for avisynth, probably out of compatibility concerns.
I see... that's unfortunate...
FranceBB is offline   Reply With Quote
Old 11th December 2020, 12:40   #6  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Quote:
Originally Posted by FranceBB View Post
I see... that's unfortunate...
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
Myrsloik is offline   Reply With Quote
Old 11th December 2020, 12:45   #7  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
there's nothing stopping you from writing a separate "passthru" filter that does nothing but attaching tags to each frame.
feisty2 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.