Example #1
0
        /// <summary>
        /// sets the projected video bitrate field in the GUI
        /// </summary>
        private void setVideoBitrate()
        {
            try
            {
                ulong desiredSizeBytes;
                checked { desiredSizeBytes = targetSize.Value.Value.Bytes; }
                ulong videoSize;

                int bitrateKbits = BitrateCalculator.CalculateBitrateKBits(videoStream.Settings.Codec,
                                                                           (videoStream.Settings.NbBframes > 0),
                                                                           ((ContainerType)container.SelectedItem),
                                                                           getAudioStreamsForBitrate(),
                                                                           desiredSizeBytes,
                                                                           videoStream.NumberOfFrames,
                                                                           (double)videoStream.Framerate,
                                                                           out videoSize);

                this.videoSize.Text             = new FileSize(Unit.KB, videoSize).ToString();
                this.projectedBitrateKBits.Text = bitrateKbits.ToString();
            }
            catch (Exception)
            {
                this.projectedBitrateKBits.Text = "";
                videoSize.Text = "";
            }
        }
Example #2
0
 public AutoEncodeWindow()
 {
     InitializeComponent();
     calc       = new BitrateCalculator();
     logBuilder = new StringBuilder();
     gen        = new CommandLineGenerator();
     sizeSelection.Items.AddRange(calc.getPredefinedOutputSizes());
 }
Example #3
0
/*		/// <summary>
 *              /// gets the predefined output size given the index of the dropdown
 *              /// </summary>
 *              /// <param name="index">the index which is currently selected in the size selection dropdown</param>
 *              /// <returns>the size in kilobytes</returns>
 *              public static int getOutputSizeKBs(int index)
 *              {
 *                      if (index == 0) // 1/4 CD
 *                              return 179200;
 *                      if (index == 1) // 1/2 CD
 *                              return 358400;
 *                      if (index == 2) // 1 CD
 *                              return 716800;
 *                      if (index == 3) // 2 CDs
 *                              return 1433600;
 *                      if (index == 4) // 3 CDs
 *                              return 2150400;
 *                      if (index == 5) // 1/3 DVD
 *                              return 1501184;
 *                      if (index == 6) // 1/4 DVD
 *                              return 1126400;
 *                      if (index == 7) // 1/5 DVD
 *                              return 901120;
 *                      if (index == 8) // 1 DVD
 *                              return 4586496;
 *          if (index == 9) //1 DVD-9
 *              return 8333760;
 *                      return 716800;
 *              }
 *              /// <summary>
 *              /// gets all the predefined output sizes
 *              /// </summary>
 *              /// <returns>an array of strings</returns>
 *              public static string[] getPredefinedOutputSizes()
 *              {
 *                      string[] values = {"1/4 CD", "1/2 CD", "1 CD", "2 CD", "3 CD", "1/3 DVD-R", "1/4 DVD-R", "1/5 DVD-R", "DVD-5", "DVD-9"};
 *                      return values;
 *              }*/
        #endregion

        public static long CalculateFileSizeKB(VideoCodec vCodec, bool p, ContainerType containerType, AudioBitrateCalculationStream[] audioStreams, int bitrate, ulong nbOfFrames, double framerate, out int vidSize)
        {
            BitrateCalculator c = new BitrateCalculator(vCodec, p, containerType, audioStreams, nbOfFrames, framerate);
            FileSize          a, b;

            c.getFileAndVideoSize((ulong)bitrate).get(out a, out b);
            vidSize = (int)b.KB;
            return((long)a.KB);
        }
Example #4
0
        public AutoEncodeDefaults()
        {
            InitializeComponent();
            calc = new BitrateCalculator();
            sizeSelection.Items.AddRange(calc.getPredefinedOutputSizes());
#warning muxprovider needs to be added here
//            MuxProvider muxProvider = new MuxProvider();
//            this.container.Items.AddRange(muxProvider.GetSupportedContainers().ToArray());
        }
Example #5
0
        public static int CalculateBitrateKBits(VideoCodec vCodec, bool p, ContainerType containerType, AudioBitrateCalculationStream[] audioStreams, ulong muxedSizeBytes, ulong numberOfFrames, double framerate, out ulong videoSizeKBs)
        {
            BitrateCalculator c = new BitrateCalculator(vCodec, p, containerType, audioStreams, numberOfFrames, framerate);
            FileSize          b;
            ulong             a;

            c.getBitrateAndVideoSize(new FileSize(Unit.B, muxedSizeBytes)).get(out a, out b);
            videoSizeKBs = b.KB;
            return((int)a);
        }
Example #6
0
        public OneClickConfigurationDialog(int videoIndex, int audioIndex, MainForm mainForm)
        {
            InitializeComponent();
            this.mainForm = mainForm;
            this.path     = mainForm.MeGUIPath;
            this.calc     = new BitrateCalculator();
            this.filesizeComboBox.Items.AddRange(calc.getPredefinedOutputSizes());
            this.filesizeComboBox.Items.Add("Custom");
            this.filesizeComboBox.Items.Add("Don't care");

            this.filesizeComboBox.SelectedIndex = 2;
            this.containerFormat.SelectedIndex  = 1;
            foreach (string name in mainForm.Profiles.AvsProfiles.Keys)
            {
                this.avsProfile.Items.Add(name);
            }

/*            if (avsProfile.Items.Contains(mainForm.Settings.AvsProfileName))
 *              avsProfile.SelectedItem = mainForm.Settings.AvsProfileName;*/
            foreach (string name in mainForm.Profiles.VideoProfiles.Keys)
            {
                this.videoProfile.Items.Add(name);
            }
            if (videoIndex > -1)
            {
                videoProfile.SelectedIndex = videoIndex;
            }
            // This will have already been done by containerFormat.SelectedIndex,
            // which triggers containerFormat_SelectedIndexChanged which refreshes the profiles

            /*foreach (string name in mainForm.Profiles.AudioProfiles.Keys)
             * {
             *    this.audioProfile.Items.Add(name);
             * }
             * if (audioIndex > -1)
             *    audioProfile.SelectedIndex = audioIndex;
             */
            foreach (string name in mainForm.Profiles.OneClickProfiles.Keys)
            {
                this.playbackMethod.Items.Add(name);
            }

/*            if (playbackMethod.Items.Contains(mainForm.Settings.OneClickProfileName))
 *              playbackMethod.SelectedItem = mainForm.Settings.OneClickProfileName;*/
            playbackMethod_SelectedIndexChanged(null, null);
        }
Example #7
0
 /// <summary>
 /// sets the size of the output given the desired bitrate
 /// </summary>
 private void setTargetSize()
 {
     try
     {
         int  desiredBitrate = Int32.Parse(this.projectedBitrateKBits.Text);
         long outputSize     = 0;
         int  rawVideoSize   = 0;
         outputSize = BitrateCalculator.CalculateFileSizeKB(videoStream.Settings.Codec,
                                                            (videoStream.Settings.NbBframes > 0),
                                                            ((ContainerType)container.SelectedItem),
                                                            getAudioStreamsForBitrate(),
                                                            desiredBitrate,
                                                            videoStream.NumberOfFrames,
                                                            (double)videoStream.Framerate,
                                                            out rawVideoSize) / 1024L;
         this.videoSize.Text   = new FileSize(Unit.KB, rawVideoSize).ToString();
         this.targetSize.Value = new FileSize(Unit.MB, outputSize);
     }
     catch (Exception)
     {
         videoSize.Text   = "";
         targetSize.Value = null;
     }
 }