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 26th February 2018, 07:43   #1  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 135
Any way to get frame type from a source filter? Also, ranges for 32-bit color?

I have two unrelated questions:

1. Is there any way to get the frame type from lossy video, i.e. I, P, or B, out of a source filter for use within other filters? Or rather, do any source filters support this?

Edit: Looking at the cache file from LSMASHSource(), is this what the Pic= field is for? If so I suppose that will work (as long as users don't Trim(), decimate, splice, etc.)...

2. What are the valid ranges (i.e. white and black point) for 32-bit floating point color spaces? 1.0 (white) to 0.0 (black), or 1.0 to -1.0? Or something else entirely? What about for chroma, and what is the range for TV levels?

I tried feeding 32-bit footage to ColorYUV() only to see "float pixel type is not supported yet."
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 26th February 2018 at 10:49. Reason: grammar
`Orum is offline   Reply With Quote
Old 26th February 2018, 11:06   #2  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 928
As for 2.)
In Avisynth plus 32bit float means 0.0-1.0. For all planes, both luma and chroma at the moment. Unlike VapourSynth where chroma is -0.5 to 0.5.
Maybe this chroma thing will once change for -0.5..+0.5.
And yes, ColorYUV is not yet ported to 32bit float.
EDIT: ported. It's on git, not released.

Last edited by pinterf; 26th February 2018 at 17:52.
pinterf is offline   Reply With Quote
Old 26th February 2018, 15:05   #3  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,365
FFmpegSource sets a runtime variable FFPICT_TYPE - 'I', 'P', 'B' etc
http://avisynth.nl/index.php/FFMS2#E...ynth_variables
Code:
FFmpegSource(path, atrack=(-1)) 
ScriptClip(Last, """
Subtitle("[ "+Chr(FFPICT_TYPE)+" ]", align=2)  
""", after_frame=true)
raffriff42 is offline   Reply With Quote
Old 27th February 2018, 15:53   #4  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 135
Thanks. My only concern on the runtime variables is reading them within a plugin, before all frames are served. Right now I'm stepping through all frames when the first frame is requested (in order to build a necessary cache), so I would need the frame type at that point.

Are there any examples of retrieving these variables from within a plugin?
__________________
My filters: DupStep | PointSize
`Orum is offline   Reply With Quote
Old 27th February 2018, 16:13   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
Something like this maybe (untested)
Code:
AVSValue __cdecl GetVar(IScriptEnvironment* env, const char* name) {
    try {return env->GetVar(name);} catch (IScriptEnvironment::NotFound) {} return AVSValue();}

    ...

    for(n=0;n<vi.num_frames;++n) {
        src = child->GetFrame(n, env);
        \\ const BYTE  *srcp = src->GetReadPtr(PLANAR_Y);      // Not sure if this necessary
        AVSValue ftn      = GetVar(env,"FFPICT_TYPE");         // Read frametype AFTER fetching frame.
        if (!ftn.IsInt()) env->ThrowError("'FFPICT_TYPE' unavailable");
        const int ftyp    = ftn.AsInt();     // Oops, was cn, changed to ftn, FIXED.
        ...
    }
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th February 2018 at 16:26.
StainlessS is offline   Reply With Quote
Old 27th February 2018, 16:27   #6  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 135
Thanks, I'll give that a try!

EDIT: Works great (after some minor modifications for use within my code). Any similar variables set by LSMASHSource()/LWLibAVVideoSource()? Those would really come in handy as I think that's a more popular source filter at this point.

Edit2: Probably better for me to ask over on his thread instead of continuing this here.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 27th February 2018 at 17:37.
`Orum 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 02:43.


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