Poor-man's DLNA/AirTunes
Quick bit of hackery to setup a HTPC to listen for RTP streams. This allows you to quickly stream a video or music to the machine, without having to much around with DLNA. I'm using it alongside XBMC on my HTPC.
Create /etc/X11/Xsession.d/99vlc:
[ -e $HOME/.vlc.pid ] && kill `cat $HOME/.vlc.pid` ; rm $HOME/.vlc.pid
vlc --no-embedded-video --width=1920 --height=1080 rtp:// -I dummy &
pid=$!
echo $pid > $HOME/.vlc.pid
From the machine you wish to stream from, run:
vlc <source-media> --sout '#rtp{dst=<destination-host>,port=5004,mux=ts,ttl=1}'
The above command doesn't perform any transcoding, so your network useage could be quite high, depending on what you're streaming.
An alternative (h264+mp4} would be:
vlc <source-media> --sout '#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{dst=<destination-host>,port=5004,mux=ts,ttl=1}'
Or even (Theora+Ogg-Vorbis):
vlc <source-media> --sout '#transcode{vcodec=theo,vb=800,scale=1,acodec=vorb,ab=128,channels=2,samplerate=44100}:rtp{dst=<destination-host>,port=5004,mux=ts,ttl=1}'
It's not yet perfect - I haven't figured out how to clear the video output after the stream ends. VLC also stays running after the user logs out, which could cause an issue for the next user. Will need to look into a better way of handling that.
Add new comment