Getting Video Dimensions

So, I am really new to C++. I have Visual C++ 2008.

How can I retrieve the width and height from a video file?

Thanks for any help!
It depends on the format.
That information is usually in the header of the file. For example, in .avi files, the width is defined by the 4 bytes at offset 64 and height by those at offset 68
I would need to be able to look at the most popular formats.

By telling me what you did, how can I get the information from that avi file? Could you give me an example script?
this would show the dimensions of an avi file in most systems:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// avi width and height
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
	int width,height;
	std::ifstream f;
	f.open ("thevideo.avi",f.binary|f.in);
	f.seekg(64,f.beg);
	f.read((char*)&width,4);
	f.read((char*)&height,4);
	f.close();
	std::cout << width << "x" << height << "\n";
	return 0;
}
hi! could u explain me what is avi file and what is it use of ?
thnx :).
Topic archived. No new replies allowed.