Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

number of frames

mikl_la
Beginner
1,039 Views
hi,
how can i get the total number of frames of a video?
regards,
michael
0 Kudos
4 Replies
Vladimir_Dudnik
Employee
1,039 Views
From where do you want to get total number of video? What IPP component you are using?

Vladimir
0 Kudos
mikl_la
Beginner
1,039 Views
From where do you want to get total number of video? What IPP component you are using?

Vladimir

i'm using unified media classes to write a video-decoder/player. so i'd like to show the totalnumber of frames,e.g. of a mpeg2-video, in the gui.

michael
0 Kudos
shyaki
Beginner
1,039 Views
Quoting - mikl_la

i'm using unified media classes to write a video-decoder/player. so i'd like to show the totalnumber of frames,e.g. of a mpeg2-video, in the gui.

michael

Unless your file wrapper contains this number, you have to partially decode the stream I think.
0 Kudos
iambaeba1
Beginner
1,039 Views
Quoting - shyaki

Unless your file wrapper contains this number, you have to partially decode the stream I think.

You can retreive video/audio/etc information using MediaInfo.

The sample code is followed..

[cpp]#include 

#include "MediaInfoDLL.h"

using namespace MediaInfoLib;

int GetMovieInfo(
	char*					_inp08FilePath,
{
	MediaInfo				MI;
	char					np08Buf[2048]
	int						n32Result,n32FrameCount;


	n32Result = MI.Open(_T(_inp08FilePath));
		
		if (n32Result == 0)
			return -1;

	/*
	 * Retrieve general movie information
	 */
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("FileName"        ),	Info_Text, Info_Name).c_str()); 
	sprintf(np08Cuf,"%s", MI.Get(Stream_General, 0, _T("FileExtension"   ),	Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("FileSize"        ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("Format/String"   ),	Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("Format/Family"   ),	Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("PlayTime/String3"), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("Duration"        ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("BitRate"         ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("OveralBitRate"   ),	Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("VideoCount"      ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("AudioCount"      ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_General, 0, _T("TextCount"       ),	Info_Text, Info_Name).c_str()); 
	
	
	/*
	 * Retrieve video information
	 */
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("Codec/String"             ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("Codec/Family"             ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("Width"                    ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("Height"                   ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("BitRate"                  ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("BitRate_Nominal"          ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("BitRate_Mode"             ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("DisplayAspectRatio"       ), Info_Text, Info_Name).c_str()); 
    sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("DisplayAspectRatio/String"), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("FrameRate"                ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("Interlacement/String"     ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Video, 0, _T("FrameCount"               ), Info_Text, Info_Name).c_str()); 
	
	n32FrameCount = atoi(np08Buf);


	/*
	 * Retrieve audio information
	 */
	sprintf(np08Buf,"%s", MI.Get(Stream_Audio, 0, _T("Codec"             ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Audio, 0, _T("Codec/String"      ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Audio, 0, _T("BitRate"           ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Audio, 0, _T("BitRate_Mode"      ), Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Audio, 0, _T("Channel(s)"        ),	Info_Text, Info_Name).c_str()); 
	sprintf(np08Buf,"%s", MI.Get(Stream_Audio, 0, _T("SamplingRate"      ),	Info_Text, Info_Name).c_str()); 
	

	MI.Close();

	return 1;
}



[/cpp]

0 Kudos
Reply