It is often necessary to split the video file to separate images. For example, it is required if you need to process each frame of the video (e.g. resize, convert to grayscale, apply some effects, etc). Also, it is possible you need to reuse these frames to build another video movie. Another example - when you need to analyze these frames (e.g. detect motion, etc).
It is very easy with AVI Processor Add-on for Graphics Mill. You need to follow these steps:
The following code snippet shows how to split video file to frames:
Public Shared Sub SplitToFrames(ByVal inputAviFilename As String, _ ByVal outputPath As String) Dim reader As New Aurigma.GraphicsMill.Codecs.AviReader reader.Open(inputAviFilename) Dim bitmap As New Aurigma.GraphicsMill.Bitmap Dim I As Integer = 0 Dim frame As Aurigma.GraphicsMill.Codecs.IFrame For Each frame In reader frame.GetBitmap(bitmap) bitmap.Save(outputPath & "\frame_" & I.ToString & ".jpg") I = I + 1 Next bitmap.Dispose() reader.Close() End Sub
public static void SplitToFrames(string inputAviFilename, string outputPath) { Aurigma.GraphicsMill.Codecs.AviReader reader = new Aurigma.GraphicsMill.Codecs.AviReader(inputAviFilename); Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(); int i = 0; foreach (Aurigma.GraphicsMill.Codecs.IFrame frame in reader) { frame.GetBitmap(bitmap); bitmap.Save(outputPath + @"\frame_" + i.ToString() + ".jpg"); i++; } bitmap.Dispose(); reader.Close(); }