Пример #1
0
        public static EncodingPreset Thumbnail()
        {
            var h264Codec = new Codec
            {
                Type                 = "H264Video",
                KeyFrameInterval     = "00:00:02",
                SceneChangeDetection = "true",
                H264Layers           = new List <H264Layer>
                {
                    new H264Layer
                    {
                        Profile         = "Auto",
                        Level           = "auto",
                        Bitrate         = 4500,
                        MaxBitrate      = 4500,
                        BufferWindow    = "00:00:05",
                        Width           = 1280,
                        Height          = 720,
                        ReferenceFrames = 3,
                        EntropyMode     = "Cabac",
                        AdaptiveBFrame  = true,
                        Type            = "H264Layer",
                        FrameRate       = "0/1"
                    }
                }
            };

            var pngImage = new Codec
            {
                Type = "PngImage",
                //Start = "00:00:01",
                //Step = "00:00:10",
                //Range = "00:00:58",
                Start     = "{Best}",
                PngLayers = new List <Layer>
                {
                    new Layer
                    {
                        Type   = "PngLayer",
                        Width  = 640,
                        Height = 360
                    }
                }
            };

            var audioCodec = new Codec
            {
                Type         = "AACAudio",
                SamplingRate = 48000,
                Bitrate      = 128,
                Channels     = 2
            };

            var preset = new EncodingPreset
            {
                Version = 1.0,
                Codecs  = new List <Codec>
                {
                    h264Codec,
                    pngImage,
                    audioCodec
                },
                Outputs = new List <Output>
                {
                    new Output {
                        FileName = "{Basename}_{Index}{Extension}", Format = new Format {
                            Type = "PngFormat"
                        }
                    },
                    new Output {
                        FileName = "{Basename}_{Width}x{Height}_{VideoBitrate}.mp4", Format = new Format {
                            Type = "MP4Format"
                        }
                    }
                }
            };

            return(preset);
        }
Пример #2
0
 public static string ToJson(this EncodingPreset self) => JsonConvert.SerializeObject(self, Reviewer.Functions.Models.Converter.Settings);