Exemple #1
0
        public FFmpegCommandBuilder WithAudioCommands(IEnumerable <MediaStream> streams)
        {
            if (!streams.Any())
            {
                return(this);
            }

            foreach (MediaStream audioStream in streams)
            {
                FFmpegAudioCommandBuilder builder    = FFmpegAudioCommandBuilder.Initilize(audioStream, outputDirectory, outputBaseFilename, AdditionalAudioFlags);
                StreamAudioFile           streamFile = builder
                                                       .WithLanguage()
                                                       .WithTitle()
                                                       .WithCodec()
                                                       .Build();

                audioFiles.Add(streamFile);
            }
            return(this);
        }
Exemple #2
0
        /// <summary>
        /// Generates and appends commands for the given audio streams to the internal command set.
        /// </summary>
        public virtual FFmpegCommandBuilder WithAudioCommands(IEnumerable <MediaStream> streams, AudioConfig config)
        {
            if (!streams.Any())
            {
                return(this);
            }

            foreach (MediaStream audioStream in streams)
            {
                int maxBitrate = audioStream.channels * config.MaxPerChannelBitrate;
                FFmpegAudioCommandBuilder builder = new FFmpegAudioCommandBuilder(audioStream, OutputDirectory, OutputBaseFilename, Options.AdditionalAudioFlags);
                var streamFile = builder
                                 .WithLanguage()
                                 .WithTitle()
                                 .WithCodec(maxBitrate: maxBitrate)
                                 .WithDownmix(config.DownmixMode)
                                 .Build();

                audioFiles.Add(streamFile);
            }
            return(this);
        }