View Full Version : Any way to get frame type from a source filter? Also, ranges for 32-bit color?
`Orum
26th February 2018, 07:43
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."
pinterf
26th February 2018, 11:06
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.
raffriff42
26th February 2018, 15:05
FFmpegSource sets a runtime variable FFPICT_TYPE - 'I', 'P', 'B' etc
http://avisynth.nl/index.php/FFMS2#Exported_AviSynth_variablesFFmpegSource(path, atrack=(-1))
ScriptClip(Last, """
Subtitle("[ "+Chr(FFPICT_TYPE)+" ]", align=2)
""", after_frame=true)
`Orum
27th February 2018, 15:53
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?
StainlessS
27th February 2018, 16:13
Something like this maybe (untested)
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.
...
}
`Orum
27th February 2018, 16:27
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.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.