Exemplo n.º 1
0
        private static void GIF(MediaEngine engine)
        {
            var param = EngineParameters.GIF(
                new MediaFile(@"D:\1.mp4"),
                new MediaFile($@"d:\\{Guid.NewGuid()}.gif"),
                GifGenerationOptions.Default());
            var result = CommandBuilder.GetGIF(param);

            Console.WriteLine(result);
            engine.GenerateGIF(param);
        }
        public void Should_Create_GIF()
        {
            var parameters = new EngineParameters()
            {
                HLSOptions = new HLSGeneratingOptions(@"D:\test\", "360p_%03d.ts", "360p.m3u8"),
                InputFile  = new MediaFile(@"E:\World_s_Most_Breathtaking_Piano_Pieces_Contemporary_Music_Mix_Vol._1.135.mp4"),
                Task       = FFmpegTask.GenerateHLS
            };

            EngineParameters.GIF(
                new MediaFile(@"E:\1.mp4"),
                new MediaFile(@"E:\output.gif"),
                GifGenerationOptions.Default());

            var result = CommandBuilder.GetHLS(parameters);
        }
        public Task Gif(string inputFile, string outputFile, GifGenerationOptions options = null)
        {
            Guard.NotNullOrEmpty(inputFile, nameof(inputFile));
            Guard.NotNullOrEmpty(outputFile, nameof(outputFile));

            var outputDirectory = Path.GetDirectoryName(outputFile);

            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            var param = EngineParameters.GIF(
                new MediaFile(inputFile),
                new MediaFile(outputFile),
                options ?? GifGenerationOptions.Default());

            return(Task.Run(() => _engine.GenerateGIF(param)));
        }
        public void Should_Generate_GifConfig(string inputPath, string outputDirectory)
        {
            var options = EngineParameters.GIF(new MediaFile(inputPath), new MediaFile(outputDirectory), GifGenerationOptions.Default());

            using (var engine = new MediaEngine(FFMPEG))
            {
                engine.GenerateGIF(options);
            }
        }