This documentation is for the old version. Go to the latest Graphics Mill docs

Splitting Video Files to JPEGs

Splitting video files to frames is an essential feature of Media Processor Add-on. When working with individual frames one by one, you can easily resize them, apply effects to them or edit in other ways.

This basic example merely saves video frames into separate JPEG files.

The function that will save frames should perform the following operations:

  1. Create a reader and open the source file.
  2. Create an empty instance of the Aurigma.GraphicsMill.Bitmap object.
  3. Loop through all frames in the reader:
    1. Call the Frame.GetBitmap(Bitmap) method to save each frame to the Bitmap object.
    2. Save the Bitmap object as a file.
  4. Close the reader.
Visual Basic
Public Sub SplitToJpegs(ByVal inputFilename As String, ByVal _
    outputBaseFilename As String)
    Try
        'Create the reader
        Dim reader As IFormatReader = MediaFormatManager.CreateFormatReader _
            (inputFilename)
        'Create the bitmap
        Dim image As Aurigma.GraphicsMill.Bitmap = New _
            Aurigma.GraphicsMill.Bitmap
        Dim index As Int32 = 0
        'Save frames
        Dim frame As IFrame
        For Each frame In reader
            frame.GetBitmap(image)
            'File type selection is based on the extension
            image.Save(outputBaseFilename + index.ToString() + ".jpg")
            index = index + 1
        Next
        image.Dispose()
        reader.Dispose()
    Catch ex As Exception
        Console.WriteLine(ex)
    End Try
End Sub
C#
public static void SplitToJpegs(string inputFilename, string outputBaseFilename)
{
    try 
    {
        //Create the reader
        IFormatReader reader = MediaFormatManager.CreateFormatReader(inputFilename);
        //Create the bitmap
        Aurigma.GraphicsMill.Bitmap image = new Aurigma.GraphicsMill.Bitmap();
        Int32 index = 0;
        //Save frames
        foreach (IFrame frame in reader)
        {
            frame.GetBitmap(image);
            //File type selection is based on the extension
            image.Save(outputBaseFilename + index.ToString() + @".jpg");
            index++;
        }
        image.Dispose();
        reader.Dispose();
    }
    catch (System.Exception ex)
    {
        Console.WriteLine(ex);
    }
}

See Also

Samples

Reference

Manual