Пример #1
0
        /// <summary>
        ///  Handles assessment of whether the encoding options vary between two snowSettings instances
        /// The following are excluded from the comparison:
        /// BitrateQuantizer
        /// CreditsQuantizer
        /// Logfile
        /// Quantizer
        /// SARX
        /// SARY
        /// Zones
        /// </summary>
        /// <param name="otherSettings"></param>
        /// <returns>true if the settings differ</returns>
        public override bool IsAltered(VideoCodecSettings settings)
        {
            if (!(settings is snowSettings))
            {
                return(true);
            }
            snowSettings otherSettings = (snowSettings)settings;

            if (
                this.CustomEncoderOptions != otherSettings.CustomEncoderOptions ||
                this.EncodingMode != otherSettings.EncodingMode ||
                this.FourCC != otherSettings.FourCC ||
                // this.FourCCs != otherSettings.FourCCs ||
                this.KeyframeInterval != otherSettings.KeyframeInterval ||
                this.LosslessMode != otherSettings.LosslessMode ||
                this.MaxQuantizer != otherSettings.MaxQuantizer ||
                this.MBComp != otherSettings.MBComp ||
                this.MECompFullpel != otherSettings.MECompFullpel ||
                this.MECompHpel != otherSettings.MECompHpel ||
                this.MinQuantizer != otherSettings.MinQuantizer ||
                this.NbBframes != otherSettings.NbBframes ||
                this.NbMotionPredictors != otherSettings.NbMotionPredictors ||
                this.PredictionMode != otherSettings.PredictionMode ||
                this.QPel != otherSettings.QPel ||
                this.Trellis != otherSettings.Trellis ||
                this.Turbo != otherSettings.Turbo ||
                this.V4MV != otherSettings.V4MV
                )
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public static string genSnowCommandline(string input, string output, snowSettings ss, Zone[] zones)
        {
            StringBuilder sb = new StringBuilder();
            CultureInfo   ci = new CultureInfo("en-us");

            sb.Append("\"" + input + "\" -ovc lavc -nosound ");
            switch (ss.EncodingMode)
            {
            case 0:                                                                       // CBR
                sb.Append("-lavcopts vcodec=snow:vbitrate=" + ss.BitrateQuantizer + ":"); // add bitrate
                break;

            case 1:     // CQ
                sb.Append("-lavcopts vcodec=snow:vqscale=" + ss.Quantizer + ":");
                break;

            case 2:                                                             // 2 pass first pass
                sb.Append("-o NUL: -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
                sb.Append("-lavcopts vcodec=snow:vpass=1:vqscale=5:");          // workaround for corrupted first passes
                break;

            case 3:                                                                               // 2 pass second pass
            case 4:                                                                               // automated twopass
                sb.Append(" -passlogfile " + "\"" + ss.Logfile + "\" ");                          // add logfile
                sb.Append("-lavcopts vcodec=snow:vpass=2:vbitrate=" + ss.BitrateQuantizer + ":"); // add pass & bitrate
                break;

            case 5:
                sb.Append("-o NUL: -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
                sb.Append("-lavcopts vcodec=snow:vpass=1:vqscale=5:");          // workaround for corrupted first passes
                break;

            case 6:
                sb.Append(" -passlogfile " + "\"" + ss.Logfile + "\" ");                          // add logfile
                sb.Append("-lavcopts vcodec=snow:vpass=3:vbitrate=" + ss.BitrateQuantizer + ":"); // add pass & bitrate
                break;

            case 7:
                sb.Append(" -passlogfile " + "\"" + ss.Logfile + "\" ");                          // add logfile
                sb.Append("-lavcopts vcodec=snow:vpass=3:vbitrate=" + ss.BitrateQuantizer + ":"); // add pass & bitrate
                break;
            }
            if (ss.PredictionMode != 0)
            {
                sb.Append("pred=" + ss.PredictionMode + ":");
            }
            switch (ss.MECompFullpel)
            {
            case 0:
                break;

            case 1:
                sb.Append("cmp=1:");
                break;

            case 2:
                sb.Append("cmp=11:");
                break;

            case 3:
                sb.Append("cmp=12:");
                break;
            }
            switch (ss.MECompHpel)
            {
            case 0:
                break;

            case 1:
                sb.Append("subcmp=1:");
                break;

            case 2:
                sb.Append("subcmp=11:");
                break;

            case 3:
                sb.Append("subcmp=12:");
                break;
            }
            switch (ss.MBComp)
            {
            case 0:
                break;

            case 1:
                sb.Append("mbcmp=1:");
                break;

            case 2:
                sb.Append("mbcmp=11:");
                break;

            case 3:
                sb.Append("mbcmp=12:");
                break;
            }
            if (ss.QPel) // default is unchecked
            {
                sb.Append("qpel:");
            }
            if (ss.V4MV) // default is unchecked
            {
                sb.Append("v4mv:");
            }
            if (ss.NbMotionPredictors != 0)
            {
                sb.Append("last_pred=" + ss.NbMotionPredictors.ToString(ci) + ":");
            }
            sb.Append("vstrict=-2:");
            if (zones != null && zones.Length > 0 && ss.CreditsQuantizer >= new decimal(1))
            {
                sb.Append("-vrc_override=");
                foreach (Zone zone in zones)
                {
                    if (zone.mode == ZONEMODE.Quantizer)
                    {
                        sb.Append(zone.startFrame + "," + zone.endFrame + "," + zone.modifier + "/");
                    }
                    else
                    {
                        sb.Append(zone.startFrame + "," + zone.endFrame + ",-" + zone.modifier + "/");
                    }
                }
                sb.Remove(sb.Length - 1, 1); // remove trailing /(zone separator)
                sb.Append(":");
            }
            if (sb.ToString().EndsWith(":")) // remove the last :
            {
                sb.Remove(sb.Length - 1, 1);
            }
            if (ss.EncodingMode != 2)
            {
                sb.Append(" -o \"" + output + "\" -of "); // rest of mencoder options
                int outputType = getVideoOutputType(output);
                if (outputType == 0)                      // AVI
                {
                    sb.Append("avi -ffourcc " + ss.FourCCs[ss.FourCC] + " ");
                }
                if (outputType >= 1) // RAW
                {
                    sb.Append("rawvideo ");
                }
            }
            return(sb.ToString());
        }
Пример #3
0
 public static string genSnowCommandline(string input, string output, snowSettings ss, Zone[] zones)
 {
     StringBuilder sb = new StringBuilder();
     CultureInfo ci = new CultureInfo("en-us");
     sb.Append("\"" + input + "\" -ovc lavc -nosound ");
     switch (ss.EncodingMode)
     {
         case 0: // CBR
             sb.Append("-lavcopts vcodec=snow:vbitrate=" + ss.BitrateQuantizer + ":"); // add bitrate
             break;
         case 1: // CQ
             sb.Append("-lavcopts vcodec=snow:vqscale=" + ss.Quantizer + ":");
             break;
         case 2: // 2 pass first pass
             sb.Append("-o NUL: -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
             sb.Append("-lavcopts vcodec=snow:vpass=1:vqscale=5:"); // workaround for corrupted first passes
             break;
         case 3: // 2 pass second pass
         case 4: // automated twopass
             sb.Append(" -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
             sb.Append("-lavcopts vcodec=snow:vpass=2:vbitrate=" + ss.BitrateQuantizer + ":"); // add pass & bitrate
             break;
         case 5:
             sb.Append("-o NUL: -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
             sb.Append("-lavcopts vcodec=snow:vpass=1:vqscale=5:"); // workaround for corrupted first passes
             break;
         case 6:
             sb.Append(" -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
             sb.Append("-lavcopts vcodec=snow:vpass=3:vbitrate=" + ss.BitrateQuantizer + ":"); // add pass & bitrate
             break;
         case 7:
             sb.Append(" -passlogfile " + "\"" + ss.Logfile + "\" "); // add logfile
             sb.Append("-lavcopts vcodec=snow:vpass=3:vbitrate=" + ss.BitrateQuantizer + ":"); // add pass & bitrate
             break;
     }
     if (ss.PredictionMode != 0)
         sb.Append("pred=" + ss.PredictionMode + ":");
     switch (ss.MECompFullpel)
     {
         case 0:
             break;
         case 1:
             sb.Append("cmp=1:");
             break;
         case 2:
             sb.Append("cmp=11:");
             break;
         case 3:
             sb.Append("cmp=12:");
             break;
     }
     switch (ss.MECompHpel)
     {
         case 0:
             break;
         case 1:
             sb.Append("subcmp=1:");
             break;
         case 2:
             sb.Append("subcmp=11:");
             break;
         case 3:
             sb.Append("subcmp=12:");
             break;
     }
     switch (ss.MBComp)
     {
         case 0:
             break;
         case 1:
             sb.Append("mbcmp=1:");
             break;
         case 2:
             sb.Append("mbcmp=11:");
             break;
         case 3:
             sb.Append("mbcmp=12:");
             break;
     }
     if (ss.QPel) // default is unchecked
         sb.Append("qpel:");
     if (ss.V4MV) // default is unchecked
         sb.Append("v4mv:");
     if (ss.NbMotionPredictors != 0)
         sb.Append("last_pred=" + ss.NbMotionPredictors.ToString(ci) + ":");
     sb.Append("vstrict=-2:");
     if (zones != null && zones.Length > 0 && ss.CreditsQuantizer >= new decimal(1))
     {
         sb.Append("-vrc_override=");
         foreach (Zone zone in zones)
         {
             if (zone.mode == ZONEMODE.Quantizer)
                 sb.Append(zone.startFrame + "," + zone.endFrame + "," + zone.modifier + "/");
             else
                 sb.Append(zone.startFrame + "," + zone.endFrame + ",-" + zone.modifier + "/");
         }
         sb.Remove(sb.Length - 1, 1); // remove trailing /(zone separator)
         sb.Append(":");
     }
     if (sb.ToString().EndsWith(":")) // remove the last :
         sb.Remove(sb.Length - 1, 1);
     if (ss.EncodingMode != 2)
     {
         sb.Append(" -o \"" + output + "\" -of "); // rest of mencoder options
         int outputType = getVideoOutputType(output);
         if (outputType == 0) // AVI
             sb.Append("avi -ffourcc " + ss.FourCCs[ss.FourCC] + " ");
         if (outputType >= 1) // RAW
             sb.Append("rawvideo ");
     }
     return sb.ToString();
 }