Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams Process proc = new Process(); proc.StartInfo.FileName = Path.Combine(WorkingFolder, "ffmpeg"); proc.StartInfo.Arguments = String.Format("$ ffmpeg -i input.mp3 pipe:1"); proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardInput = true; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); FileStream baseStream = proc.StandardOutput.BaseStream as FileStream; byte[] audioData; int lastRead = 0; using (MemoryStream ms = new MemoryStream()) byte[] buffer = new byte[5000]; lastRead = baseStream.Read(buffer, 0, buffer.Length); ms.Write(buffer, 0, lastRead); } while (lastRead > 0); audioData = ms.ToArray(); using(FileStream s = new FileStream(Path.Combine(WorkingFolder, "pipe_output_01.mp3"), FileMode.Create)) s.Write(audioData, 0, audioData.Length);

It's log from ffmpeg, the first file is readed:

Input #0, mp3, from 'norm.mp3': Metadata: encoder : Lavf58.17.103 Duration: 00:01:36.22, start: 0.023021, bitrate: 128 kb/s Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc58.27

Then pipe:

[NULL @ 0x7fd58a001e00] Unable to find a suitable output format for '$' $: Invalid argument

If I run "-i input.mp3 pipe:1", the log is:

Unable to find a suitable output format for 'pipe:1' pipe:1: Invalid argument

How do I set correct output? And how should ffmpeg know what the output format is at all?

ffmpeg is a conversion program. You are giving it an input, but not telling it what to do with the input. What do you want as the output from ffmpeg? omajid Sep 12, 2018 at 22:59

Whenever you use a pipe out in ffmpeg, you need the -f fmt parameter to avoid the error you are seeing.

You can get a list of possible formats by typing ffmpeg -formats .

If you want a wav file for instance, add -f wav .

In your example, arguments should be:

-i input.mp3 -f wav pipe:1

You can replace wav with flac or any other audio format you like.

Looks to me like there's a typo in "$ ffmpeg -i input.mp3 pipe:1" . If you just want to invoke ffmpeg with options like -i and so on, leave out the $ character. Just "ffmpeg -i input.mp3 pipe:1" . . You already pass the main program name in StartInfo.FileName . So you should probably leave that out too. Try just "-i input.mp3 pipe:1" as your Arguments .

Have you used ffmpeg before? Do you know what you want to do with it? Running ffmpeg -i input.mp3 pipe:1 doesn't work on the command line either, so it wont work when you call it that way in your program either. Can you figure out the ffmepg command to do what you want and then use it in your program once it works from the command line? omajid Sep 12, 2018 at 22:58 "-i input.mp3 pipe:1" seems like it helps a little now the log is Unable to find a suitable output format for 'pipe:1' pipe:1: Invalid argument mr_blond Sep 12, 2018 at 22:58 I used it for converting files with comands like "$ ffmpeg -i input.mp3 output.wav". I want to convert file from mp3 to wav and send the output into pipe. But you are right, I don't know how to tell ffmpeg thet I want to convert it. mr_blond Sep 12, 2018 at 23:03 Can you test if ffmepg -i input.mp3 -f wav pipe:1 | cat > output.wav on the command line produces a working wav file? If it does, then -f wav is what you want. omajid Sep 12, 2018 at 23:12

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .