コード例 #1
0
        private static IEnumerable<string> ExecuteFFMPEGAndGetImageFiles(ImageJobGroup imageJobGroup, string mediaFilePath)
        {
            using (var ffmpeg = new FFMPEGProcess(new FFMPEGProcessSettings(mediaFilePath, imageJobGroup.Timestamp - TimeSpan.FromSeconds(1))))
            {
                ffmpeg.Execute();
            }

            return GetImageFilePaths(imageJobGroup, mediaFilePath);
        }
コード例 #2
0
        private static void IndexEntriesAtIndex(
            string videoFile,
            TimeSpan startTime,
            Ratio framerate,
            TimeSpan totalDuration,
            IndexDatabase database
            )
        {
            string outputDirectory = Path.GetRandomFileName();
            Ratio quarterFramerate = new Ratio(framerate.Numerator, framerate.Denominator * 4);
            var ffmpegProcessSettings = new FFMPEGProcessSettings(
                videoFile,
                outputDirectory,
                startTime,
                CalculateFramesToOutputFromFramerate(startTime, quarterFramerate, totalDuration),
                framerate,
                FFMPEGOutputFormat.Y4M
            );

            if (Directory.Exists(outputDirectory) == false)
            {
                Directory.CreateDirectory(outputDirectory);
            }

            using (var ffmpegProcess = new FFMPEGProcess(ffmpegProcessSettings))
            {
                ffmpegProcess.Execute();
                IndexFilesInDirectory(videoFile, outputDirectory, startTime, database, quarterFramerate);
                try
                {
                    Directory.Delete(outputDirectory, true);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(string.Format("Could not clean up images: {0}", e.Message));
                }
            }
        }