Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 http://127.0.0.1:8090/feed1.ffm
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.

share|improve this question

2 Answers 2

mplayer -noconsolecontrols -ao pcm:file=audio.wav soundfile.wav &
share|improve this answer

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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