Exemplo n.º 1
0
        /// <summary>
        /// Builds an argument string from the settings
        /// </summary>
        /// <returns>A string to be used as argument to Handbrake CLI</returns>
        public string Build()
        {
            var sb = new StringBuilder();

            sb.Append($"--format {Format} ");
            if (MaxHeight > 0)
            {
                sb.Append($"--maxHeight {MaxHeight} ");
            }
            if (MaxWidth > 0)
            {
                sb.Append($"--maxWidth {MaxWidth} ");
            }
            if (WebOptimize)
            {
                sb.Append("--optimize ");
            }

            sb.Append($"--modulus {Modulus} ");
            sb.Append($"--{Anamorphic.Formatted()} ");
            sb.Append($"--encoder {Encoder} ");
            sb.Append($"--quality {VideoQuality} ");
            sb.Append($"--{FrameRateSetting} ");
            sb.Append($"--rate {FrameRate} ");
            sb.Append($"--aencoder {AudioEncoder.Formatted()} ");
            if (AudioEncoder == AudioEncoder.copy)
            {
                sb.Append($"--audio-copy-mask {AudioCopyMask.Formatted()} ");
            }
            if (AudioEncoder.ToString().StartsWith("copy"))
            {
                sb.Append($"--audio-fallback {AudioEncoderFallback.Formatted()} ");
            }
            sb.Append($"--mixdown {Mixdown.Formatted()} ");
            sb.Append($"--arate {AudioSampleRate.Formatted()} ");
            sb.Append($"--ab {AudioBitrate} ");
            sb.Append($"--{AudioTracks.Formatted()} ");
            sb.Append($"--gain {AudioGain} ");
            sb.Append($"--subtitle none ");
            if (TwoPass)
            {
                sb.Append("--two-pass ");
                if (TurboTwoPass && (Encoder == Encoder.x264 || Encoder == Encoder.x265))
                {
                    sb.Append("--turbo ");
                }
            }
            sb.Append($"--encoder-level {EncoderLevel.Formatted()} ");
            sb.Append("--verbose 0 ");
            return(sb.ToString());
        }
Exemplo n.º 2
0
 public static string Formatted(this Anamorphic anamorphic)
 {
     return(anamorphic.ToString().Replace("_", "-"));
 }