[mythtv-users] Command line to stream audio/video from
joe.borne at gmail.com
Wed Jan 9 16:07:01 UTC 2008
> > The menu part is easy since I know how to launch a command from a menu
> > BUT....does anyone know how to start a stream from the command line?
> Mplayer can play streams so you could just create menu items that
> invoke mplayer.
> Alternatively you could do the following:
> 1) Create a playlist file (extension .m3u I think) which contains the
> URL of the stream.
> 2) Create a mythvideo entry that has a custom command line to call
> invoke mplayer with the playlist file. In that command line you can
> also tell it how much to buffer before it starts plaaying etc. I have
> an example at home if you'd like me to post it later.
Phil, I'd be interested in seeing your implementation of this.
Here is how I handle this. I've written a bash script that parses several of
the major movie trailer websites and puts the entries into a custom menu I
have inserted into MythTV.
A typical menu entry looks like this:
<text>The Dark Knight</text>
<action>EXEC MplayerWrap '
Now MplayerWrap is just that, a wrapper that uses wget to download the
trailer into a specified directory, fires up mplayer and plays it, then
deletes it. I keep it in /usr/local/bin/.
rm -f *.mov
URL=`echo $1 |sed 's,\&\;,\&,g'`
# Blind download, it works but you have no idea how long you'll be waiting.
# wget $URL ;
# "Fred Flintstone" quality progress bar, ugly but works.
xterm -e wget $URL ;
# Pretty GUI version - ooooooh. NOTE - this line does not currently work on
Fedora Core 6. For functionality zenity must be compiled from source at
version 2.2 or higher, plus the sed statement must be adjusted. I'm working
on this. All debian/ubuntu based distros work out of the box.
# wget $URL 2>&1 | sed -e 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\
[KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --progress
--title="Downloading Trailer..." --auto-close --width=700 ;
mv *.mov* trailer.mov
mplayer -fs -zoom -quiet
# Use this line to stream the media rather than download.
# mplayer -fs -zoom -quiet -user-agent NSPlayer $URL
rm -f /video/MythCinema-MovieTrailers/trailers/trailer.mov
You can easily alter this behavior to play the video directly off the net as
a stream by commenting out the wget lines/mplayer line and uncommenting the
streaming line. All the sed line does up there is fix the ampersands from
the xml valid format of "&" to a standard "&" so that wget and mplayer
don't freak out. You can also play with the "-cache" option to adjust your
I have another player script written for Xine if anyone wants it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mythtv-users