How to read resolution info from a video media file using C#?

Answered How to read resolution info from a video media file using C#?

  • Thursday, August 20, 2009 5:48 AM
     
     
    Hi all,

    I would like to find out how to read the resolution info from a video file stored on Windows file system programmatically (NTFS) with C#
    in Windows XP?

    Thanks very much.

All Replies

  • Thursday, August 20, 2009 6:05 AM
     
     Answered
    What do you mean by resolution?  The dimensions can be read using the shell.  How can I read an Image File's Information
  • Thursday, August 20, 2009 6:12 AM
     
     
    As there are such a lot of video file formats, trying to deal with each one individually (reading headers, capturing still frames etc) would kill you, so I'd certainly agree that you'd be best using DirectShow or its intended replacement, Media Foundation.

    There's a C# wrapper for DirectShow, and an active specialist forum, over at SourceForge which should be better than trying to grapple with the COM based API directly.

    There's also a C# wrapper for Media Foundation on the same site though it's still early days for that but its only for Vista and Windows 7.

    Quoted from : http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=70431

    Life would have been much easier if I had the source-code !!
  • Thursday, August 20, 2009 6:12 AM
     
     
    Hi John,

    Thanks for your reply.
    The resolution for the video file that i refer above is the width & height like (1900x1200, 1024x768).

    I installed Visual Studio 2005 Professional and i couldn't find the Shell namespace.
    I am new to .NET programming, can give me more guidance?

    Thanks very much.
  • Thursday, August 20, 2009 7:09 AM
     
     

    The reference is noted in the link.  It's on the COM tab.