Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipe is broken for x86 builds #512

Open
m1adow opened this issue Apr 2, 2024 · 0 comments
Open

Pipe is broken for x86 builds #512

m1adow opened this issue Apr 2, 2024 · 0 comments

Comments

@m1adow
Copy link

m1adow commented Apr 2, 2024

Hi! I'm trying to convert videos to WAV format with ffmpeg to a MemoryStream. When a project is built with an x64 configuration following code works fine, but when the configuration is x86, an exception is thrown. By the way, if instead of OutputToPipe use OutputToFile, then code works fine on both configuration.

public async Task<MemoryStream?> ConvertToWavAsync(Stream file)
{
    var outputStream = new MemoryStream();

    await FFMpegArguments
        .FromPipeInput(new StreamPipeSource(file))
        .OutputToPipe(new StreamPipeSink(outputStream),
            options => options
                .WithAudioCodec("pcm_s16le")
                .DisableChannel(Channel.Video)
                .WithAudioSamplingRate(16000)
                .WithCustomArgument("-ac 1")
                .ForceFormat(wav))
    .ProcessAsynchronously(new() { BinaryFolder = "Path" } );

    outputStream.Position = 0;
    return outputStream;
}

Exception:
Pipe is broken.

StackTrace:
at System.IO.Pipes.PipeStream.PipeValueTaskSource.GetResult(Int16 token) at System.IO.Pipes.PipeStream.PipeValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.IO.Stream.<<CopyToAsync>g__Core|29_0>d.MoveNext() at System.IO.Strategies.BufferedFileStreamStrategy.<CopyToAsyncCore>d__57.MoveNext() at FFMpegCore.Arguments.InputPipeArgument.<ProcessDataAsync>d__4.MoveNext() at FFMpegCore.Arguments.PipeArgument.<During>d__13.MoveNext() at FFMpegCore.FFMpegArguments.<During>d__30.MoveNext() at FFMpegCore.FFMpegArgumentProcessor.<Process>d__25.MoveNext() at FFMpegCore.FFMpegArgumentProcessor.<ProcessAsynchronously>d__24.MoveNext() at MyProject.Services.Services.VideoConverterService.<ConvertToWavAsync>d__2.MoveNext()

So, any tips how to make it work for x86 too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant