AVIInfo
function AVIInfo (AVIFile: string; var Duration: OleVariant; var FrameCount: OleVariant; var _VideoWidth: OleVariant; var _VideoHeight: OleVariant; var VideoFrameRateFps: OleVariant; var AvgBitRate: OleVariant; var AudioChannels: OleVariant; var AudioSamplesPerSec: OleVariant; var AudioBitsPerSample: OleVariant; var VideoCodec: OleVariant; var AudioCodec: OleVariant): Boolean;
bool __fastcall AVIInfo(System::UnicodeString AVIFile, /* out */ LargeInteger &Duration, /* out */ LargeInteger &FrameCount, /* out */ System::LongInt &_VideoWidth, /* out */ System::LongInt &_VideoHeight, /* out */ double &VideoFrameRateFps, /* out */ System::LongInt &AvgBitRate, /* out */ System::LongInt &AudioChannels, /* out */ System::LongInt &AudioSamplesPerSec, /* out */ System::LongInt &AudioBitsPerSample, /* out */ System::UnicodeString &VideoCodec, /* out */ System::UnicodeString &AudioCodec);
public bool AVIInfo(string AVIFile, out long Duration, out long FrameCount, out int _VideoWidth, out int _VideoHeight, out double VideoFrameRateFps, out int AvgBitRate, out int AudioChannels, out int AudioSamplesPerSec, out int AudioBitsPerSample, out string VideoCodec, out string AudioCodec);
Public Function AVIInfo(AVIFile As String, ByRef Duration As Long, ByRef FrameCount As Long, ByRef _VideoWidth As Integer, ByRef _VideoHeight As Integer, ByRef VideoFrameRateFps As Double, ByRef AvgBitRate As Integer, ByRef AudioChannels As Integer, ByRef AudioSamplesPerSec As Integer, ByRef AudioBitsPerSample As Integer, ByRef VideoCodec As String, ByRef AudioCodec As String) As Boolean
BOOL AVIInfo (wchar_t *AVIFile, __int64 *Duration, __int64 *FrameCount, int *_VideoWidth, int *_VideoHeight, double *VideoFrameRateFps, int *AvgBitRate, int *AudioChannels, int *AudioSamplesPerSec, int *AudioBitsPerSample, wchar_t * *VideoCodec, wchar_t * *AudioCodec);
Retrieves information about the video file specified as parameter (returns false if the format is not supported):
- Duration: returns the duration of the video file, expressed in 100-nanosecond units, returns 0 upon failure,
- FrameCount: returns the total frame count if available, otherwise returns 0,
- VideoWidth: returns the width of the video
- VideoHeight: returns the height of the video
- VideoFrameRateFps: returns the frame rate in frames per second
- AvgBitRate: returns the average bit rate of the file
- AudioChannels: returns the number of audio channels
- AudioSamplesPerSec: returns the audio sample frequency in Hz
- AudioBitsPerSample: returns the number of bits per sample
- VideoCodec: returns the name of the video codec in which the video stream of the file is encoded (if any)
- AudioCodec: returns the name of the audio codec in which the audio stream of the file is encoded (if any)
E.g.:
procedure TForm1.Button1Click(Sender: TObject);
var
Duration: int64;
FrameCount: int64;
VideoWidth: LongInt;
VideoHeight: LongInt;
VideoCodec: string;
AudioCodec: string;
VideoFrameRateFps: Double;
AvgBitRate: LongInt;
AudioChannels: LongInt;
AudioSamplesPerSec: LongInt;
AudioBitsPerSample: LongInt;
begin
if VideoGrabber.AVIInfo (edtPlayerClip.Text, Duration, FrameCount, VideoWidth, VideoHeight, VideoFrameRateFps, AvgBitRate, AudioChannels, AudioSamplesPerSec, AudioBitsPerSample, VideoCodec, AudioCodec) then begin
ShowMessage('');
ShowMessage(edtPlayerClip.Text + ':');
ShowMessage('duration (in sec): ' + FormatFloat ('0.00', Duration / 10000000));
ShowMessage('frame count: ' + IntToStr (FrameCount));
ShowMessage('video width: ' + IntToStr (VideoWidth));
ShowMessage('video height: ' + IntToStr (VideoHeight));
ShowMessage('video frame rate (fps): ' + FormatFloat ('0.00', VideoFrameRateFps));
ShowMessage('average bit rate (kb/s): ' + IntToStr (AvgBitRate div 1024));
ShowMessage('audio channels: ' + IntToStr (AudioChannels));
ShowMessage('audio samples/sec: ' + IntToStr (AudioSamplesPerSec));
ShowMessage('audio bits per sample: ' + IntToStr (AudioBitsPerSample));
ShowMessage('video codec: ' + VideoCodec);
ShowMessage('audio codec: ' + AudioCodec);
end
else begin
ShowMessage(edtPlayerClip.Text + ' clip not found.');
end;end;