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:
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
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); } }