feat: extract audio conversion to separate class and refine audio extraction

This commit is contained in:
Stevan Freeborn
2025-07-27 23:33:05 -05:00
parent a53b3893ad
commit a1864371dd
10 changed files with 199 additions and 35 deletions
@@ -0,0 +1,23 @@
using System.Diagnostics.CodeAnalysis;
using FFMpegCore;
using FFMpegCore.Enums;
using FFMpegCore.Pipes;
namespace StreamShorts.Library.Media;
[ExcludeFromCodeCoverage]
internal class FFMpegService : IFFMpegService
{
public async Task<bool> ExtractAudioFromVideoAsync(Stream video, Stream audio)
{
return await FFMpegArguments
.FromPipeInput(new StreamPipeSource(video))
.OutputToPipe(
new StreamPipeSink(audio),
static o => o.DisableChannel(Channel.Video).ForceFormat("mp3")
)
.ProcessAsynchronously()
.ConfigureAwait(false);
}
}