Get_iplayer under Debian Squeeze

Since I’ve been using my tablet on commutes to catch up on Have I Got News For You and Jools Holland, I’ve needed a way to download from iPlayer. I happened across get_iplayer via a bit of Googling. All looked relatively straightforward to set-up. However I did find some codec issues, as the BBC do like to move the goalposts somewhat. As you’re going to be doing quite a bit of privileged commands I’ll leave it up to you as to how you want to get round this with a sudo -s or fully blown root session. It’s your call. Have a look after the jump for the full destructions to get up and running.

First we need to enable some backports from Wheezy

sudo echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list

Then we need to get some of the dependencies and to toolchain to compile from source.

apt-get update
apt-get upgrade
apt-get -t squeeze-backports install libxvidcore4
apt-get install wget make automake autoconf libtool g++ bzip2 python unzip patch subversion ruby build-essential git-core checkinstall yasm texi2html libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvdpau-dev libvorbis-dev libvpx-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev libmp3lame0 libavcodec-extra-53 libssl-dev

Next, we need to build OpenSSL in order to be able to handle encrypted streams from the beeb via ffmpeg

wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xvzf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config
make
make test
make install
cd ..

Now for ffmpeg’s sister RTMPdump . This enables you to capture rtmp and rtmps streams on the fly and dump them into a file for processing

git clone git://git.ffmpeg.org/rtmpdump rtmpdump
cd rtmpdump
make SYS=posix CRYPTO=OPENSSL
make install
cd ..

Now we need to compile a few libs and tools for manipulating files, starting with ID3 for rather unsurprisingly ID3 tag reading.

wget http://downloads.sourceforge.net/project/id3lib/id3lib/3.8.2/id3lib-3.8.2.tar.gz
tar xvzf id3lib-3.8.2.tar.gz
cd id3lib-3.8.2
wget http://connie.slackware.com/~alien/slackbuilds/id3lib/build/id3lib-3.8.3_gcc4.diff
patch -p1 < id3lib-3.8.3_gcc4.diff
./configure --enable-shared
make
make install
ldconfig
cd ..

From here moving onto ID3V2

wget http://prdownloads.sourceforge.net/id3v2/id3v2-0.1.11.tar.gz
tar xvzf id3v2-0.1.11.tar.gz
cd id3v2-0.1.11
make -Wno-write-strings
make install
cd ..

Then on to ACC encoders

wget http://downloads.sourceforge.net/project/opencore-amr/vo-aacenc/vo-aacenc-0.1.2.tar.gz
tar xvzf vo-aacenc-0.1.2.tar.gz
cd vo-aacenc-0.1.2
./configure
make
make install
cd ..

And then Ogg

wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar xvzf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure
make
make install
cd ..

And Vorbis

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar xvzf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure
make
make install
cd ..

Getting there! Yasm is still needed to deal with some of the older gcc3 flags within ffmpeg.

wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xvzf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
cd ..

As is the x264 codec pack, as most suff is moving towards being within an 264 container

git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-shared
make
make install
cd ..

Finally LibVPX wraps up the codec installing

wget http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2
tar xvjf libvpx-v1.1.0.tar.bz2
cd libvpx-v1.1.0
./configure
make
make install
cd ..
ldconfig

Now that we have all of the latest dependencies in we can get on with the jucier bit, ffmpeg itself.

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
make
checkinstall -D make install
make install
cd ..

Now onto get_iplayer itself. I've just pulled this via wget, untarred it into my home directory and have written out some preferences to it's prefs file to make life a little easier 🙂

wget ftp://ftp.infradead.org/pub/get_iplayer/get_iplayer-2.82.tar.gz
tar xvzf get_iplayer-2.82.tar.gz
ln -s /home/bump/get_iplayer-2.82/get_iplayer /usr/bin/get-iplayer
get-iplayer --prefs-add --ffmpeg="/usr/local/bin/ffmpeg" --flvstreamer="/usr/local/bin/rtmpdump" --id3v2="/usr/local/bin/id3v2" --fileprefix="--" --outputtv="/data/iplayer/tv" --outputradio="/data/iplayer/radio" --tvmode="flashhd,flashvhigh,flashhigh,flashstd,flashnormal" --radiomode="flashhd,flashaachigh,flashaacstd,flashaudio,flashaaclow" --metadata=xbmc --expiry=3600 --subdir --thumb --thumbsize=6

Now to kick over the web interface. There is a method of getting this to run under Apache, however it was more fiddling than I needed to do, as this runs on my file server, so I'd have to actually install apache as opposed to using the perl miniserver

nohup perl /home/bump/get_iplayer-2.82/get_iplayer.cgi --port=1935 --get_iplayer=/home/bump/get_iplayer-2.82/get_iplayer > /dev/null 2>&1

Then write out your crontab to have the PVR run every hour and the cache refreshed.

crontab -e
0 * * * * /home/bump/get_iplayer --pvr >> /tmp/get_iplayer.log
55 * * * * /home/bump/get_iplayer --refresh --type=all >> /tmp/get_iplayer.log
Crtl+o
Ctrl+x

That's it, you're now all up and running. So navigate to your servers IP address and add :1935 on the end, get browsing and adding to your PVR list.

More options to pass to get_iplayer can be found at https://github.com/dinkypumpkin/get_iplayer/wiki/documentation


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *