Using a named pipe as ffmpeg/avconv's input for streaming
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
.
Related videos on Youtube
David Primmer
Updated on September 18, 2022Comments
-
David Primmer over 1 year
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.
-
David Primmer about 12 yearsThat'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.