Example #1
0
        private void fixFileNameExtensions(VideoStream video, AudioJob[] audioStreams, ContainerType container)
        {
            AudioEncoderType[] audioCodecs = new AudioEncoderType[audioStreams.Length];
            for (int i = 0; i < audioStreams.Length; i++)
            {
                audioCodecs[i] = audioStreams[i].Settings.EncoderType;
            }
            MuxPath path;

            if (video.Settings == null)
            {
                path = mainForm.MuxProvider.GetMuxPath(VideoEncoderType.X264, audioCodecs, container);
            }
            else
            {
                path = mainForm.MuxProvider.GetMuxPath(video.Settings.EncoderType, audioCodecs, container);
            }
            if (path == null)
            {
                return;
            }
            List <AudioType> audioTypes = new List <AudioType>();

            foreach (MuxableType type in path.InitialInputTypes)
            {
                if (type.outputType is VideoType)
                {
                    // see http://forum.doom9.org/showthread.php?p=1243370#post1243370
                    if ((mainForm.Settings.ForceRawAVCExtension) && (video.Settings.EncoderType == VideoEncoderType.X264))
                    {
                        video.Output = Path.ChangeExtension(video.Output, ".264");
                    }
                    else
                    {
                        video.Output = Path.ChangeExtension(video.Output, type.outputType.Extension);
                    }
                    video.VideoType = type;
                }
                if (type.outputType is AudioType)
                {
                    audioTypes.Add((AudioType)type.outputType);
                }
            }
            AudioEncoderProvider aProvider = new AudioEncoderProvider();

            for (int i = 0; i < audioStreams.Length; i++)
            {
                AudioType[] types = aProvider.GetSupportedOutput(audioStreams[i].Settings.EncoderType);
                foreach (AudioType type in types)
                {
                    if (audioTypes.Contains(type))
                    {
                        audioStreams[i].Output = Path.ChangeExtension(audioStreams[i].Output,
                                                                      type.Extension);
                        break;
                    }
                }
            }
        }
Example #2
0
 public AudioCodecSettings(string id, AudioCodec codec, AudioEncoderType encoder, int bitrate, BitrateManagementMode mode)
 {
     this.id          = id;
     audioCodec       = codec;
     audioEncoderType = encoder;
     downmixMode      = ChannelMode.KeepOriginal;
     bitrateMode      = mode;
     this.bitrate     = bitrate;
     delay            = 0;
     delayEnabled     = false;
     autoGain         = true;
     forceDirectShow  = false;
     improveAccuracy  = true;
 }
Example #3
0
        /// <summary>
        /// separates encodable from muxable audio streams
        /// in addition to returning the two types separately an array of SubStreams is returned
        /// which is plugged into the muxer.. it contains the names of all the audio files
        /// that have to be muxed
        /// </summary>
        /// <param name="encodable">encodeable audio streams</param>
        /// <param name="muxable">muxable Audio Streams with the path filled out and a blank language</param>
        private void separateEncodableAndMuxableAudioStreams(out AudioJob[] encodable, out MuxStream[] muxable, out AudioEncoderType[] muxTypes)
        {
            encodable = this.getConfiguredAudioJobs();             // discards improperly configured ones
            // the rest of the job is all encodeable
            muxable  = new MuxStream[encodable.Length];
            muxTypes = new AudioEncoderType[encodable.Length];
            int j = 0;

            foreach (AudioJob stream in encodable)
            {
                muxable[j]  = stream.ToMuxStream();
                muxTypes[j] = stream.Settings.EncoderType;
                j++;
            }
        }
 public AudioCodecSettings(string id, AudioCodec codec, AudioEncoderType encoder, int bitrate, BitrateManagementMode mode)
 {
     this.id          = id;
     audioCodec       = codec;
     audioEncoderType = encoder;
     downmixMode      = ChannelMode.KeepOriginal;
     bitrateMode      = mode;
     this.bitrate     = bitrate;
     autoGain         = false;
     applyDRC         = false;
     normalize        = 100;
     preferredDecoder = AudioDecodingEngine.NicAudio;
     timeModification = TimeModificationMode.KeepOriginal;
     sampleRate       = SampleRateMode.KeepOriginal;
 }
Example #5
0
        private void fixFileNameExtensions(VideoStream video, AudioJob[] audioStreams, ContainerType container)
        {
            AudioEncoderType[] audioCodecs = new AudioEncoderType[audioStreams.Length];
            for (int i = 0; i < audioStreams.Length; i++)
            {
                audioCodecs[i] = audioStreams[i].Settings.EncoderType;
            }
            MuxPath path = mainForm.MuxProvider.GetMuxPath(video.Settings.EncoderType, audioCodecs, container);

            if (path == null)
            {
                return;
            }
            List <AudioType> audioTypes = new List <AudioType>();

            foreach (MuxableType type in path.InitialInputTypes)
            {
                if (type.outputType is VideoType)
                {
                    video.Output    = Path.ChangeExtension(video.Output, type.outputType.Extension);
                    video.VideoType = type;
                }
                if (type.outputType is AudioType)
                {
                    audioTypes.Add((AudioType)type.outputType);
                }
            }
            AudioEncoderProvider aProvider = new AudioEncoderProvider();

            for (int i = 0; i < audioStreams.Length; i++)
            {
                AudioType[] types = aProvider.GetSupportedOutput(audioStreams[i].Settings.EncoderType);
                foreach (AudioType type in types)
                {
                    if (audioTypes.Contains(type))
                    {
                        audioStreams[i].Output = Path.ChangeExtension(audioStreams[i].Output,
                                                                      type.Extension);
                        break;
                    }
                }
            }
        }
Example #6
0
 public AudioCodecSettings(string id, AudioCodec codec, AudioEncoderType encoder, int bitrate)
     : this(id, codec, encoder, bitrate, BitrateManagementMode.CBR)
 {
 }
        private void getTypes(out AudioEncoderType[] aCodec, out MuxableType[] audioTypes, out MuxableType[] subtitleTypes)
        {
            List<MuxableType> audioTypesList = new List<MuxableType>();
            List<MuxableType> subTypesList = new List<MuxableType>();
            List<AudioEncoderType> audioCodecList = new List<AudioEncoderType>();

            int counter = 0;
            foreach (MuxStreamControl c in audioTracks)
            {
                if (minimizedMode && knownAudioTypes.Length > counter)
                {
                    audioCodecList.Add(knownAudioTypes[counter]);
                }
                else if (c.Stream != null)
                {
                    MuxableType audioType = VideoUtil.guessAudioMuxableType(c.Stream.path, true);
                    if (audioType != null)
                    {
                        audioTypesList.Add(audioType);
                    }
                }
                counter++;
            }
            foreach (MuxStreamControl c in subtitleTracks)
            {
                if (c.Stream == null) continue;
                SubtitleType subtitleType = VideoUtil.guessSubtitleType(c.Stream.path);
                if (subtitleType != null)
                {
                    subTypesList.Add(new MuxableType(subtitleType, null));
                }
            }
            audioTypes = audioTypesList.ToArray();
            subtitleTypes = subTypesList.ToArray();
            aCodec = audioCodecList.ToArray();
        }
        /// <summary>
        /// sets the GUI to a minimal mode allowing to configure audio track languages, configure subtitles, and chapters
        /// the rest of the options are deactivated
        /// </summary>
        /// <param name="videoInput">the video input</param>
        /// <param name="framerate">the framerate of the video input</param>
        /// <param name="audioStreams">the audio streams whose languages have to be assigned</param>
        /// <param name="output">the output file</param>
        /// <param name="splitSize">the output split size</param>
        public void setMinimizedMode(string videoInput, VideoEncoderType videoType, double framerate, MuxStream[] audioStreams, AudioEncoderType[] audioTypes, string output,
            FileSize? splitSize, ContainerType cft)
        {
            base.setConfig(videoInput, (decimal)framerate, audioStreams, new MuxStream[0], null, output, splitSize, null, null);

            minimizedMode = true;
            knownVideoType = videoType;
            knownAudioTypes = audioTypes;

            // disable everything
            videoGroupbox.Enabled = false;

            for (int i = 0; i < audioStreams.Length; ++i)
                audioTracks[i].Enabled = false;

            this.output.Filename = output;
            this.splitting.Value = splitSize;
            this.muxButton.Text = "Go";
            updatePossibleContainers();
            if (this.cbContainer.Items.Contains(cft))
                cbContainer.SelectedItem = cft;
            checkIO();
        }
 public AudioCodecSettings(string id, AudioCodec codec, AudioEncoderType encoder, int bitrate, BitrateManagementMode mode)
 {
     this.id = id;
     audioCodec = codec;
     audioEncoderType = encoder;
     downmixMode = ChannelMode.KeepOriginal;
     bitrateMode = mode;
     this.bitrate = bitrate;
     delay = 0;
     delayEnabled = false;
     autoGain = true;
     forceDirectShow = false;
     applyDRC = false;
     sampleRateType = 0;
     normalize = 100;
 }
 public AudioCodecSettings(string id, AudioCodec codec, AudioEncoderType encoder, int bitrate)
     : this(id, codec, encoder, bitrate, BitrateManagementMode.CBR)
 {
 }
Example #11
0
        private static void fixFileNameExtensions(VideoStream video, AudioJob[] audioStreams, ContainerType container)
        {
            AudioEncoderType[] audioCodecs = new AudioEncoderType[audioStreams.Length];
            for (int i = 0; i < audioStreams.Length; i++)
            {
                audioCodecs[i] = audioStreams[i].Settings.EncoderType;
            }
            MuxPath path;

            if (video.Settings == null)
            {
                path = MainForm.Instance.MuxProvider.GetMuxPath(VideoEncoderType.X264, audioCodecs, container);
            }
            else
            {
                path = MainForm.Instance.MuxProvider.GetMuxPath(video.Settings.EncoderType, audioCodecs, container);
            }
            if (path == null)
            {
                return;
            }
            List <AudioType> audioTypes = new List <AudioType>();

            foreach (MuxableType type in path.InitialInputTypes)
            {
                if (type.outputType is VideoType)
                {
                    if (video.Settings.EncoderType == VideoEncoderType.XVID && (type.outputType.ContainerType == ContainerType.AVI || type.outputType.ContainerType == ContainerType.MKV))
                    {
                        video.Output = Path.ChangeExtension(video.Output, ".m4v");
                    }
                    else if (video.Settings.EncoderType == VideoEncoderType.X264 && type.outputType.ContainerType == ContainerType.MP4)
                    {
                        video.Output = Path.ChangeExtension(video.Output, ".264");
                    }
                    else if (video.Settings.EncoderType == VideoEncoderType.X265 && (type.outputType.ContainerType == ContainerType.MKV || type.outputType.ContainerType == ContainerType.MP4))
                    {
                        video.Output = Path.ChangeExtension(video.Output, ".hevc");
                    }
                    else
                    {
                        video.Output = Path.ChangeExtension(video.Output, type.outputType.Extension);
                    }
                    video.VideoType = type;
                }
                if (type.outputType is AudioType)
                {
                    audioTypes.Add((AudioType)type.outputType);
                }
            }
            AudioEncoderProvider aProvider = new AudioEncoderProvider();

            for (int i = 0; i < audioStreams.Length; i++)
            {
                AudioType[] types = aProvider.GetSupportedOutput(audioStreams[i].Settings.EncoderType);
                foreach (AudioType type in types)
                {
                    if (audioTypes.Contains(type))
                    {
                        string newFileName = Path.ChangeExtension(audioStreams[i].Output, type.Extension);
                        if (!audioStreams[i].Input.Equals(newFileName))
                        {
                            audioStreams[i].Output = newFileName;
                        }
                        break;
                    }
                }
            }
        }
Example #12
0
 /// <summary>
 /// separates encodable from muxable audio streams
 /// in addition to returning the two types separately an array of SubStreams is returned
 /// which is plugged into the muxer.. it contains the names of all the audio files
 /// that have to be muxed
 /// </summary>
 /// <param name="encodable">encodeable audio streams</param>
 /// <param name="muxable">muxable Audio Streams with the path filled out and a blank language</param>
 private void separateEncodableAndMuxableAudioStreams(out AudioJob[] encodable, out MuxStream[] muxable, out AudioEncoderType[] muxTypes)
 {
     encodable = this.getConfiguredAudioJobs(); // discards improperly configured ones
     // the rest of the job is all encodeable
     muxable = new MuxStream[encodable.Length];
     muxTypes = new AudioEncoderType[encodable.Length];
     int j = 0;
     foreach (AudioJob stream in encodable)
     {
         muxable[j] = stream.ToMuxStream();
         muxTypes[j] = stream.Settings.EncoderType;
         j++;
     }
 }