Пример #1
0
        public FFmpegAudioWriter(string FileName, int AudioQuality, FFmpegAudioArgsProvider AudioArgsProvider, int Frequency = 44100, int Channels = 2)
        {
            if (!FFmpegService.FFmpegExists)
            {
                throw new FFmpegNotFoundException();
            }

            var argsBuilder = new FFmpegArgsBuilder();

            argsBuilder.AddStdIn()
            .SetFormat("s16le")
            .SetAudioCodec("pcm_s16le")
            .SetAudioFrequency(Frequency)
            .SetAudioChannels(Channels)
            .DisableVideo();

            var output = argsBuilder.AddOutputFile(FileName);

            AudioArgsProvider(AudioQuality, output);

            _ffmpegProcess = FFmpegService.StartFFmpeg(argsBuilder.GetArgs(), FileName, out _);

            _ffmpegIn = _ffmpegProcess.StandardInput.BaseStream;
        }