예제 #1
0
        public FFmpegAudioWriter(string FileName, int AudioQuality, FFmpegAudioArgsProvider AudioArgsProvider, int Frequency = 44100, int Channels = 2)
        {
            var argsBuilder = new FFmpegArgsBuilder();

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

            argsBuilder.AddOutputFile(FileName)
            .AddArg(AudioArgsProvider(AudioQuality));

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

            _ffmpegIn = _ffmpegProcess.StandardInput.BaseStream;
        }
예제 #2
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;
        }