My goal is to use wget to download an flv file, and pipe the output to ffmpeg to convert it to an MP3. This way the user can download the MP3 without waiting for the FLV to download to my server first. I've been playing around with it, and it seems that ffmpeg can only do piping on raw video. So I was working with something like this:
wget -O - 'videoinput.flv' | ffmpeg -y -i - -vcodec rawvideo -f yuv4mpegpipe - | ffmpeg -y -i - -ab 128k audiooutput.mp3
Anybody have experience with this type of on-the-fly ffmpeg encoding process?
A potentially better option to piping from a separate HTTP client is to use ffmpeg's built-in one. At least newer versions can take a URL as an input file argument. This way FFmpeg can pull the file down itself, and for formats that have container data near the end of the file, it can (if the server supports it) grab that portion of the file first, unlike piping from curl or wget, which fetch the file sequentially. See http://ffmpeg.org/ffmpeg-all.html#http
I haven't tested this but should be like this or very close.
"ffmpeg can only do piping on raw video" <-- It isn't.
You can pipe in/out any format ffmpeg supports.
And in your command line example, you extract raw video from the FLV and encode to MP3. It can never be done like this.
Part of the problem you're going to encounter is that some file formats have important file container information at the end of the file. Thus, piping a wget call directly to ffmpeg is a potential file breaker as ffmpeg may choke before the file is fully downloaded.
You're better off looking at a series of commands: wget'ing the file then running ffmpeg on it. It ignores the pipe capabilities, but that's the problem you get working with certain files.
Also, I would take a look at this FAQ answer from FFMPEG's site regarding one set of methods when piping videos using mkfifo and concatenating FLV's: http://www.ffmpeg.org/faq.html#TOC27