Mega Code Archive

 
Categories / Delphi / VCL
 

Frame count of an avi

Question: How can I tell how many frames are in a given AVI file and how long the AVI file will play? Answer: The TMediaPlayer provides this information by setting the TimeFormat property and querying the Length property. The following example demonstrates retrieving the number of frames and the play time of a given AVI file. Example: procedure TForm1.Button1Click(Sender: TObject); begin MediaPlayer1.TimeFormat := tfFrames; ShowMessage('Number of frames = ' + IntToStr(MediaPlayer1.Length)); MediaPlayer1.TimeFormat := tfMilliseconds; ShowMessage('Number of milliseconds = ' + IntToStr(MediaPlayer1.Length)); end;