So I'm in a situation in which I want to feed a .wav (or other kind of sound) file to a named pipe/FIFO, and use the pipe as ffmpeg's input source (with a ffserver feed as an output).

This is as far as I've gotten (ffserver is already running, and I think is unrelated to my issue):

$ mkfifo audio.wav

$ mplayer -ao pcm:file=audio.wav soundfile.wav &
[2] 30864
Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
MPlayer 1.0rc4-4.5.2 (C) 2000-2010 MPlayer Team

[2]+  Stopped                 mplayer -ao pcm:file=audio.wav soundfile.wav

$ avconv -f wav -i audio.wav
avconv version 0.8, Copyright (c) 2000-2011 the Libav developers
  built on Mar 16 2012 15:30:40 with gcc 4.5.2

(Hangs here, won't output anything else)

However, ffmpeg ends up stuck right there, with the process seemingly hanging, and it doesn't seem like ffmpeg is doing anything, and the end feed seems to be inactive. The warning up there relating to ff_codec_bmp_tags seems unrelated as well.

I've read a few forum threads in which people seem to have success with something very close to this, but I suppose there's something I'm doing wrong. If anyone could help me as to why this is happening, I'd really appreciate it. Is there some flag I should be using to indicate it's a FIFO I'm using a source?

Thanks in advance.


mplayer wants to use your terminal, that is the reason why it is stopped in the background ([2]+ Stopped) and everything blocks. I suggest using separate terminals for the programs. Either just normal terminal windows or via screen or tmux. Another option is using nohup mplayer.

  • That's not it, unfortunately. That's just mplayer waiting for something to connect on the receiving end of the FIFO, since a named pipe won't start passing any data unless both of its ends are connected and the receiving end is requesting buffers. – Sergio Morales Mar 19 '12 at 14:32
  • @SergioMorales Have you really tried it? If I do the following mkfifo pipe.tmp ; cat pipe.tmp & cat is not stopped visibly because of the empty pipe (I get no message from my shell). mplayer & produces explicitly suspended (tty output) in zsh. And continues without any problem after fg with the message Playing soundfile.wav, of course it blocks after this silently if the pipe is full. – jofel Mar 19 '12 at 14:59
mplayer -noconsolecontrols -ao pcm:file=audio.wav soundfile.wav &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.