Wednesday, July 24, 2013

Multicast HDHomeRun Content with VLC

Below is bash script to tune your HDHomeRun device to a channel and multicast the video with VLC. You can then consume the video throughout your house or business with XBMC clients or VLC clients.

Copy and paste the script into your favorite editor. Update the HDHOMERUN variable with your device's ID. Save the script. I named mine HDHomeRunMulticaster.sh. Make the script executable chmod +x HDHomeRunMulticaster.sh. Execute the script passing the tuner number (0 through 2 for HDHomeRun Prime), the EIA channel number, and the program number. For example: ./HDHomeRunMulticaster.sh 0 73 2.

#!/bin/bash
# Tune HDHomeRun and multicast the video
# Example ./HDHomeRunMulticaster.sh 0 73 2
#
HDHOMERUN="12345678"
TUNER=$1
CHANNEL=$2
PROGRAM=$3
if [[ -z "$TUNER" ]]
then
 echo "Missing the tuner number. Please pass a tuner number."
 exit 1
fi
if [[ -z "$CHANNEL" ]]
then
 echo "Missing a channel. Please pass a channel number."
 exit 1
fi
if [[ -z "$PROGRAM" ]]
then
 echo "Missing program number. Please pass a program number."
 exit 1
fi
echo "Setting HDHomeRun device: $HDHOMERUN to channel: $CHANNEL program: $PROGRAM"
hdhomerun_config $HDHOMERUN set /tuner$TUNER/channel $CHANNEL
hdhomerun_config $HDHOMERUN set /tuner$TUNER/program $PROGRAM
hdhomerun_config $HDHOMERUN save /tuner$TUNER - | cvlc --sout udp:239.255.12.42 -
hdhomerun_config $HDHOMERUN set /tuner$TUNER/channel none

You'll need the HDHomeRun configure command. If running Ubuntu you can get it with: sudo apt-get install hdhomerun-config.

To consume the video using VLC open a network stream to URL: udp://@239.255.12.42. To consume the video using XBMC use steps 1 and 3 from my Multicast Video to XBMC using VLC blog post.

Saturday, July 20, 2013

Multicast Video to XBMC using VLC

XBMC is capable of playing multicast video. It is a simple set-up.

  1. Create a text file called Stream.strm on your XBMC client with this line udp://239.255.12.42:1234
  2. On your server start the multicast with this command cvlc --sout udp:239.255.12.42 /mnt/disk0/mythtv/pretty/Fringe_2013-01-11_9-00_PM_The_Boy_Must_Live.mpg
  3. On your XBMC client go to Videos, Files, Add Videos, Browse and select the text file you created in step 1.

With this set-up you could watch a video on multiple XBMC clients in your home or business.