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.

Post a Comment