Example #1
0
        public VideoFile Convert(string filename, string format)
        {
            var file = new VideoFile(filename);

            var sourceCodec = new CodecFactory().Extract(file);

            ICodec destinationCodec;

            if (format == "mp4")
            {
                destinationCodec = new Mpeg4CompressionCodec();
            }
            else
            {
                destinationCodec = new OggCompressionCodec();
            }

            var buffer = BitrateReader.Read(filename, sourceCodec);

            var result = BitrateReader.Convert(buffer, destinationCodec);

            result = new AudioMixer().Fix(result);

            return(new VideoFile(result));
        }
        public FileInfo ConvertVideo(String fileName, String format)
        {
            Console.WriteLine("VideoConversionFacade: conversion started.");
            VideoFile file        = new VideoFile(fileName);
            ICodec    sourceCodec = CodecFactory.Extract(file);
            ICodec    destinationCodec;

            if (format.Equals("mp4"))
            {
                destinationCodec = new OggCompressionCodec();
            }
            else
            {
                destinationCodec = new MPEG4CompressionCodec();
            }
            VideoFile buffer             = BitrateReader.Read(file, sourceCodec);
            VideoFile intermediateResult = BitrateReader.Convert(buffer, destinationCodec);
            FileInfo  result             = (new AudioMixer()).Fix(intermediateResult);

            Console.WriteLine("VideoConversionFacade: conversion completed.");
            Console.ReadKey();
            return(result);
        }