Kumar
Kumar

Reputation: 11349

Identify the video frame size

Is there a generic way to get the height and width of a video and other metadata (like the timestamp when the video was taken, etc.) using .NET? I would like to get the size information of common video formats such as .avi, .mpg, .mpeg, .mov, .asf etc.

Upvotes: 2

Views: 8263

Answers (1)

Ben
Ben

Reputation: 1012

I don't know if this is the best way to do it, but using DirectX you can use the Video class in the AudioVideoPlayback namespace to get the default size of the video. After creating the Video object, you can get the DefaultSize property, from which the height and width can be obtained.

A simple example:

    Video video = new Video(videoPath, false);
    Size size = video.DefaultSize;

    Console.WriteLine("Width: " + size.Width);
    Console.WriteLine("Height: " + size.Height);

Upvotes: 2

Related Questions