Kumar Kumar - 22 days ago 8
C# Question

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


Ben Ben

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);