Search code examples
c#file-properties

C# Move video files into folders based on their video frame size.


I have a hard drives dedicated to videos, and I wanted to write a program that would move all my video files into folders based on their video playback size.

I was thinking about having it organized like this.

/HD/1080p/(FileName)/(fileName).ext
/HD/720p/(FileName)/(fileName).ext
(I know that not all video files are 1080 or 720p because of crop, but within +-20 to 30px.)
/SD/(FileName)/(fileName).ext //anything less then 720p

I know you are able to right click on a video file and go to properties then details and see the frame width and frame height, but I'm not sure you can view this information in C#.

I don't know where to start and some information would be awesome. like:

Moving files with c#, renaming them, Viewing file details (frame sizes, file type, name, lenght, etc.) I plan on making a DB on this information but as of right now I just want to move the files into the correct folders.

I have been doing this manually and it's very tedious and time consuming.

Any help would be awesome, Thanks, Throdne


Solution

  • The best for getting file info properties is to use MediaInfo.dll. There is also c# wrapper available to collect all data you need from video file.

    You can obtain media ifo from mediainfo.sourceforge.net

    This is multiplatform and can be used on Mono and Linux as well on Windows.

    I've put also some information about MediaInfo on following thread: https://stackoverflow.com/questions/9561490...