/// <summary> /// Uses the dotImaging library to extract each frame from a video and saving it. /// </summary> /// <param name="savePath">Where the frames should be saved.</param> /// <param name="filePath">Path to videofile.</param> public void videoImageExtractor(String savePath, String filePath) { var reader = new FileCapture(filePath); reader.Open(); reader.SaveFrames(savePath, "{0}.png"); reader.Close(); }
private static void extractVideo(string fileName) { //get output dir (same as file name and in the same folder as video) var fileInfo = new FileInfo(fileName); var fileNameNoExt = fileInfo.Name.Replace(fileInfo.Extension, String.Empty); string outputDir = Path.Combine(fileInfo.DirectoryName, fileNameNoExt); //open video var reader = new FileCapture(fileName); reader.Open(); reader.SaveFrames(outputDir, "{0}.jpg", p => Console.Write($"\rExtracting: {(int)(p * 100)} %")); ImageUI.CloseAll(); }
private static void extractVideo(string fileName) { //get output dir (same as file name and in the same folder as video) var fileInfo = new FileInfo(fileName); var fileNameNoExt = fileInfo.Name.Replace(fileInfo.Extension, String.Empty); string outputDir = Path.Combine(fileInfo.DirectoryName, fileNameNoExt); //open video var reader = new FileCapture(fileName); reader.Open(); reader.SaveFrames(outputDir, "{0}.jpg", (percentage) => { ((double)percentage).Progress(message: "Extracting " + fileNameNoExt); }); UI.CloseAll(); }
private static void extractVideo(string fileName) { //get output dir (same as file name and in the same folder as video) var fileInfo = new FileInfo(fileName); var fileNameNoExt = fileInfo.Name.Replace(fileInfo.Extension, String.Empty); string outputDir = Path.Combine(fileInfo.DirectoryName, fileNameNoExt); //open video var reader = new FileCapture(fileName); reader.Open(); Console.WriteLine("Extracting video frames - {0}...", fileNameNoExt); reader.SaveFrames(outputDir, "{0}.jpg", (percentage) => { Console.Write("\r Completed: {0} %", (int)(percentage * 100)); }); Console.WriteLine(); }