How do I pipe ffmpeg to opusenc on Windows?
Andrew Mclaughlin
On Linux you can do something like this:
(bash)
ffmpeg -i foo.mp3 -f wav - | opusenc --bitrate 64 - bar.opusThis is neat, because it means you don't have to write the WAV data to disk before passing it to opus, so the encoding happens on the fly in memory instead.
I have both ffmpeg and opusenc installed on Windows, and since Powershell has pipes I expected to be able to do something similar, so I'm trying this:
(PS)
> ffmpeg -y -i .\foo.mp3 -f wav - | .\opusenc.exe --bitrate 64 - bar.opusWhat I'm expecting to happen: ffmpeg should be piping wav audio directly to opusenc for encoding
What happens instead: it seems to only run ffmpeg without passing the data on to opusenc, indicated by constant RAM growth of the PS process and no output from opusenc.
11 Answer
Use the regular cmd.exe instead of Powershell. The exact same command works in cmd, but does not in PS:
> ffmpeg -y -i .\foo.mp3 -f wav - | .\opusenc.exe --bitrate 64 - bar.opus