Get Frames/Images From Video in Asp.Net


In this article we will see how to get frames from a running video in ASP.Net. To run the video use the third party control as AspNetVideo.Net3, which required only the path of a video file to play the video.

For getting the first frame from the video file I used JockerSoft.Media library which has a set of methods for operations like crop the frame, save the frame from video file. This JockerSoft.Media has the following methods.
public static Bitmap GetFrameFromVideo(string videoFile, double percentagePosition);
        public static Bitmap GetFrameFromVideo(string videoFile, double percentagePosition, Size target);
        public static Bitmap GetFrameFromVideo(string videoFile, double percentagePosition, out doublestreamLength, Size target);
        public static Size GetVideoSize(string videoFile);
        public static void SaveFrameFromVideo(string videoFile, double percentagePosition, stringoutputBitmapFile);
        public static void SaveFrameFromVideo(string videoFile, double percentagePosition, stringoutputBitmapFile, Size target);
        public static void SaveFrameFromVideo(string videoFile, double percentagePosition, stringoutputBitmapFile, out double streamLength, Size target);
        public static void SaveFramesFromVideo(string videoFile, double[] positions, stringoutputBitmapFiles);

For getting frame use the Bitmap return type method GetFrameFromVideo() which takes the videofiles path and the percentage for frame and return the bitmap object. You can save also this bitmap and this JockerSoft provide method for getting and saving the frame on specified location also.