http://avisynth.nl/index.php?title=Filter_SDK/VideoInfo&feed=atom&action=historyFilter SDK/VideoInfo - Revision history2024-03-29T06:20:09ZRevision history for this page on the wikiMediaWiki 1.19.24http://avisynth.nl/index.php?title=Filter_SDK/VideoInfo&diff=788&oldid=prevAdmin: 1 revision2013-05-09T21:33:53Z<p>1 revision</p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 21:33, 9 May 2013</td>
</tr></table>Adminhttp://avisynth.nl/index.php?title=Filter_SDK/VideoInfo&diff=787&oldid=prev92.233.37.17: /* Video-related information */2011-07-29T13:06:16Z<p><span dir="auto"><span class="autocomment">Video-related information</span></span></p>
<p><b>New page</b></p><div>VideoInfo provides basic information about the clip your filter receives.<br />
<br />
== Getting information from VideoInfo ==<br />
<br />
=== Video-related information ===<br />
<br />
bool HasVideo();<br />
<br />
This will return true if there is any video in the given clip.<br />
<br />
bool IsRGB24();<br />
bool IsRGB32();<br />
bool IsRGB();<br />
<br />
This will return true if the colorspace is [[RGB]] (in any way). The first two return true if the clip has the specific RGB colorspace ([[RGB24]] and [[RGB32]]). The third returns true for any RGB colorspace; future formats could also apply.<br />
<br />
bool IsYUY2();<br />
bool IsYV12();<br />
bool IsYUV();<br />
<br />
This will return true if the colorspace is [[YUV]] (in any way). The first two return true if the clip has the specific YUV colorspace ([[YUY2]] and [[YV12]]). The third returns true for any YUV colorspace; future formats could also apply. Note that I420 is also reported as YV12, because planes are automatically swapped.<br />
<br />
bool IsColorSpace(int c_space);<br />
<br />
This function will check if the colorspace (VideoInfo.pixel_type) is the same as given c_space (or more general it checks for a [[Colorspace property]] (see avisynth.h)).<br />
<br />
bool IsSameColorspace(const VideoInfo& vi2);<br />
<br />
This function will compare two VideoInfos, and check if the colorspace is the same. Note: It does not check imagesize or similar properties.<br />
<br />
bool Is(int property);<br />
<br />
This function is reserved for future use. Currently works as IsColorSpace.<br />
<br />
bool IsPlanar();<br />
<br />
This will return true if the video is planar. For now only YV12 returns true, but future formats might also do so. See the [[Planar]] image format.<br />
<br />
bool IsFieldBased();<br />
<br />
This will return true if the video has been through a [[SeparateFields]], and the video has not been [[Weave|weaved]] yet. Otherwise it will return false.<br />
<br />
bool IsParityKnown();<br />
<br />
This will return true if the video parity is known.<br />
<br />
bool IsBFF();<br />
bool IsTFF();<br />
<br />
This will return true if the video is bottom-field-first or top-field-first respectively.<br />
<br />
void SetFieldBased(bool isfieldbased);<br />
<br />
This will set the field-based property to true (respectively false) if isfieldbased=true (respectively false).<br />
<br />
void Set(int property);<br />
void Clear(int property);<br />
<br />
This sets respectively clears an image_type property like: IT_BFF, IT_TFF or IT_FIELDBASED. See field.h for examples.<br />
<br />
int BitsPerPixel();<br />
<br />
This will return the number of bits per pixel. This can be:<br />
<br />
{| border="1" cellpadding="4"<br />
!width=50%| pixel_type<br />
!width=50%| nr of bits<br />
|-<br />
| CS_BGR24<br />
| 24<br />
|-<br />
| CS_BGR32<br />
| 32<br />
|-<br />
| CS_YUY2<br />
| 16<br />
|-<br />
| CS_YV12, CS_I420<br />
| 12<br />
|}<br />
<br />
void SetFPS(unsigned numerator, unsigned denominator);<br />
<br />
This will set the framerate.<br />
<br />
void MulDivFPS(unsigned multiplier, unsigned divisor);<br />
<br />
This will multiply the denominator by ''multiplier'' and scale the numerator and modified denominator.<br />
<br />
There is some other useful information in VideoInfo structure (width, height, fps_numerator, fps_denominator, num_frames, pixel_type and image_type). See 'avisynth.h' header file.<br />
<br />
=== Audio-related information ===<br />
<br />
bool HasAudio();<br />
<br />
This will return true if there is any audio in the given clip.<br />
<br />
int AudioChannels();<br />
<br />
This will return the number of audio channels.<br />
<br />
int SampleType();<br />
<br />
This will return the sampletype. This can be:<br />
<br />
{| border="1" cellpadding="4"<br />
!width=50%| pixel_type<br />
!width=50%| nr of bits<br />
|-<br />
| SAMPLE_INT8<br />
| 1<<0<br />
|-<br />
| SAMPLE_INT16<br />
| 1<<1<br />
|-<br />
| SAMPLE_INT24<br />
| 1<<2<br />
|-<br />
| SAMPLE_INT32<br />
| 1<<3<br />
|-<br />
| SAMPLE_FLOAT<br />
| 1<<4<br />
|}<br />
<br />
bool IsSampleType(int testtype);<br />
<br />
This function will check if the sampletype (VideoInfo.sample_type) is the same as testtype. <br />
<br />
int SamplesPerSecond();<br />
<br />
This will return the number of bytes per second.<br />
<br />
int BytesPerAudioSample();<br />
<br />
This will return the number of bytes per sample:<br />
<br />
int BytesPerChannelSample()<br />
<br />
This will return the number of bytes per channel-sample. This can be:<br />
<br />
{| border="1" cellpadding="4"<br />
!width=50%| sample<br />
!width=50%| nr of bytes<br />
|-<br />
| SAMPLE_INT8<br />
| sizeof(signed char)<br />
|-<br />
| SAMPLE_INT16<br />
| sizeof(signed short)<br />
|-<br />
| SAMPLE_INT24<br />
| 3<br />
|-<br />
| SAMPLE_INT32<br />
| sizeof(signed int)<br />
|-<br />
| SAMPLE_FLOAT<br />
| sizeof(SFLOAT)<br />
|}<br />
<br />
__int64 AudioSamplesFromFrames(__int64 frames);<br />
<br />
This returns the number of audiosamples from the first ''frames'' frames.<br />
<br />
int FramesFromAudioSamples(__int64 samples);<br />
<br />
This returns the number of frames from the first ''samples'' audiosamples.<br />
<br />
__int64 AudioSamplesFromBytes(__int64 bytes);<br />
<br />
This returns the number of audiosamples from the first ''bytes'' bytes.<br />
<br />
__int64 BytesFromAudioSamples(__int64 samples);<br />
<br />
This returns the number of bytes from the first ''samples'' audiosamples.<br />
<br />
There is some other useful information in VideoInfo structure (audio_samples_per_second, sample_type, num_audio_samples and nchannels). See 'avisynth.h' header file.<br />
<br />
Back to [[Filter_SDK/Internal_functions|Internal functions]].<br />
<br />
[[Category:FilterSDK]]</div>92.233.37.17