----- Original Message -----
From: "Rodney Baker"
mplayer -dumpstream -dumpfile <fifo> -playlist "<url>" ffmpeg -i <fifo>
.
What I would like to know is if there is a way to redirect the output from mplayer directly to ffmpeg without having to use the named pipe and two konsole sessions. So far nothing I've tried has worked. I'm guessing that there is likely to be more than one way to do this in a single step but I haven't been able to make it work yet.
Because you have to do a little too much for a single command line in a web browser helper app definition, you might as well just put the commands into a script and run "myscript <url-in> <mp3-file-out>" streamrip: --- #!/bin/bash [ $# = 2 ] || { echo "usage: ${0##*/} <input playlist url> <output mp3 filename>" ; exit 1 ; } FIFO=/tmp/${0##*/}_${$}_fifo mkfifo $FIFO mplayer -dumpstream -dumpfile $FIFO -playlist "$1" & ffmpeg -i $FIFO "$2" rm $FIFO --- If you can't predict the output filename because this will be a browser helper, then you have to generate a generic one and rename it yourself later: "streamrip <url>" generates /shared/tunes/streamrip/<datetime>.mp3 #!/bin/bash [ $# = 1 ] || { echo "usage: ${0##*/} <input playlist url>" ; exit 1 ; } FIFO=/tmp/${SELF}_${$}_fifo mkfifo $FIFO mplayer -dumpstream -dumpfile $FIFO -playlist "$1" & ffmpeg -i $FIFO /shared/tunes/${0##*/}/`date +%Y%m%d%H%M%S`.mp3 rm $FIFO If mplayer -really-quiet is really quiet you could use /def/fd/1 or /dev/stdout or /dev/tty Some of those are somewhat portable to other *ix and old versions of linux, some only work on recent linux. #!/bin/bash [ $# = 1 ] || { echo "usage: ${0##*/} <input playlist url>" ; exit 1 ; } mplayer -really-quiet -dumpstream -dumpfile /dev/fd/1 -playlist "$1" | ffmpeg -i - /shared/tunes/${0##*/}/`date +%Y%m%d%H%M%S`.mp3 That is, do this test: mplayer -really-quiet -dumpstream -dumpfile /dev/null -playlist "$1" 2>/dev/null That captures the stream to /dev/null and stderr to /dev/null, and tells mplayer to be quiet, and allows stdout from mplayer to go to the screen as usual. If you see anything on the screen at all, any messages from mplayer, then you can't use a stdout|stdin pipeline simple as that. Unless there is some other option to mplayer to silence it. You will get junk inserted into your stream data. Enhancements: You might use Xdialog to prompt for an output mp3 filename instead of generating the generic one: #!/bin/bash [ $# = 1 ] || { echo "usage: ${0##*/} <input playlist url>" ; exit 1 ; } OUT=`Xdialog --title "Save stream $1 as: (output mp3 file name)" --fselect ~ 28 48 2>/dev/null` [ -z "$OUT" -o $? != 0 ] && exit mplayer -really-quiet -dumpstream -dumpfile /dev/fd/1 -playlist "$1" | ffmpeg -i - $OUT There is also kdialog, zenity, xmessage, gtkdialog, etc... for providing the gui input box. Not sure if any others have a file browser though, which is handier for this than a plain input box. Similarly, you could use *dialog to prompt for the input url if none was supplied on the command line, instead of merely printing an error message as I'm doing above. You might be able to get ID3 data from the stream and massage that into a filename, and fallback to a generic filename if no id3 data available, but that would take more scripting and more detailed knowledge of mplayer or some other utility. I wouldn't do any of this junk however. http://streamripper.sourceforge.net -- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org