Skip to content

Pipe is broken for .m4a files #616

Description

@Maitrog

Hi, everyone!

I have a code that converting audio files to mp3

public async Task<Stream> ConvertAsync(
        MemoryStream inputAudioStream,
        string extension = "webm",
        CancellationToken cancellationToken = default)
{
    var outputMp3Stream = new MemoryStream();
    var isResultSuccess = await FFMpegArguments
                    .FromPipeInput(new StreamPipeSource(inputAudioStream))
                    .OutputToPipe(new StreamPipeSink(outputMp3Stream), ConfigureMp3)
                    .ProcessAsynchronously();

    return isResultSuccess ? outputMp3Stream : null;
}


private static void ConfigureMp3(FFMpegArgumentOptions options)
{
    options
        .WithAudioCodec(AudioCodec.LibMp3Lame)
        .WithAudioBitrate(64)
        .WithAudioSamplingRate(32000)
        .WithCustomArgument("-ac 1")
        .WithCustomArgument(
            "-af afftdn=nr=12:nf=-40:tn=1," +
            "loudnorm=I=-16:TP=-1.5:LRA=11:linear=true")
        .ForceFormat("mp3");
}

When I'm trying to convert .m4a file I get an error

[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025fd66a7600] stream 0, offset 0x216: partial file
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0000025fd66a7340] Error during demuxing: Invalid argument
[af#0:0 @ 0000025fd66ed500] No filtered frames for output stream, trying to initialize anyway.

All output can see here: pipe output.txt

But when I'm converting .m4a file using FromFileInput() function all working good, also no errors when I'm using ffmpeg in console
FromFileInput() output: file output.txt

File with problem: link
How I can fix it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions