Esempio n. 1
0
        public void ConstantRateFactor_Verify()
        {
            var settingWrong1 = new ConstantRateFactor(-1);
            var settingWrong2 = new ConstantRateFactor(60);
            var setting       = new ConstantRateFactor(18);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-crf 18", SettingSerializer.Serialize(setting));
        }
Esempio n. 2
0
        public void ConstantRateFactor_Verify()
        {
            var settingWrong1 = new ConstantRateFactor(-1);
            var settingWrong2 = new ConstantRateFactor(60);
            var setting       = new ConstantRateFactor(18);

            Assert.Throws <InvalidOperationException>(() => { var s = settingWrong1.GetAndValidateString(); });
            Assert.Throws <InvalidOperationException>(() => { var s = settingWrong2.GetAndValidateString(); });
            Assert.DoesNotThrow(() => { var s = setting.GetAndValidateString(); });
            Assert.Equal(setting.GetAndValidateString(), "-crf 18");
        }
Esempio n. 3
0
        public string Convert(string inputFile, VideoEncoder videoEncoder, VideoResize videoResize,
                              VideoPreset videoPreset, ConstantRateFactor videoConstantRateFactor,
                              AudioCodec audioCodec, string outputFile)
        {
            //-vf scale=-1:720 -c:v libx264 -preset veryfast -crf 23 -c:a aac


            var arguments = "-i " + "\"" + inputFile + "\"" +
                            " -v quiet -stats " +
                            _arguments.GetValue(videoResize.ToString()) +
                            _arguments.GetValue(videoEncoder.ToString()) +
                            _arguments.GetValue(videoPreset.ToString()) +
                            _arguments.GetValue(videoConstantRateFactor.ToString()) +
                            _arguments.GetValue(audioCodec.ToString()) +
                            " -y " + "\"" + outputFile + "\"";



            return(arguments);
        }