Exemple #1
0
        public void Audio_ToAAC_Args_Pipe()
        {
            using var outputFile = new TemporaryFile($"out{VideoType.Mp4.Extension}");

            var samples = new List <IAudioSample>
            {
                new PcmAudioSampleWrapper(new byte[] { 0, 0 }),
                new PcmAudioSampleWrapper(new byte[] { 0, 0 }),
            };

            var audioSamplesSource = new RawAudioPipeSource(samples)
            {
                Channels   = 2,
                Format     = "s8",
                SampleRate = 8000,
            };

            var success = FFMpegArguments
                          .FromPipeInput(audioSamplesSource)
                          .OutputToFile(outputFile, false, opt => opt
                                        .WithAudioCodec(AudioCodec.Aac))
                          .ProcessSynchronously();

            Assert.IsTrue(success);
        }
Exemple #2
0
        public void Audio_ToAAC_Args_Pipe_InvalidSampleRate()
        {
            using var outputFile = new TemporaryFile($"out{VideoType.Mp4.Extension}");

            var audioSamplesSource = new RawAudioPipeSource(new List <IAudioSample>())
            {
                SampleRate = 0,
            };

            var ex = Assert.ThrowsException <FFMpegException>(() => FFMpegArguments
                                                              .FromPipeInput(audioSamplesSource)
                                                              .OutputToFile(outputFile, false, opt => opt
                                                                            .WithAudioCodec(AudioCodec.Aac))
                                                              .ProcessSynchronously());
        }