marvin.im

Raspberry Pi 3 - Debian Jessie compiling TVHeadend from sources

foreword

I’ve switched from a Raspberry Pi 1 Model B to a Raspberry Pi 3 Model B because my DVB USB device recordings on RPI1 were clipped.

I hope this changes using the much stronger RPI3.

My DVB USB device: Sundtek MediaTV Pro III

let’s start

preparations

Just download and flash the Raspbian LITE image from https://www.raspberrypi.org/downloads/raspbian/

sudo apt-get update
sudo apt-get install -y vim wget
date
sudo dpkg-reconfigure tzdata
date
sudo raspi-config
sudo reboot

installing MediaTV Pro III (skip this if you use another tv device)

wget http://www.sundtek.de/media/sundtek_netinst.sh && \
chmod 777 sundtek_netinst.sh && sudo ./sundtek_netinst.sh

cat << EOL | sudo tee /etc/sundtek.conf
use_hwpidfilter=on
device_attach=systemctl restart tvheadend
EOL

building TVHeadend from sources

since the official wiki building page seems a bit outdated here are my notes

Install:

sudo apt-get update
sudo apt-get install -y build-essential git pkg-config libssl-dev bzip2 libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavresample-dev gettext dvb-apps cmake

git clone https://github.com/tvheadend/tvheadend.git
cd tvheadend
./configure && make && sudo make install

sudo adduser --system --ingroup video hts

add a new systemd service and add the contents from beneath

sudo vim /etc/systemd/system/tvheadend.service

/etc/systemd/system/tvheadend.service

[Unit]
Description=tvheadend
After=network.target
Wants=sundtek.service
After=sundtek.service

[Service]
Type=forking
PIDFile=/run/tvheadend.pid
ExecStart=/usr/local/bin/tvheadend -f -p /run/tvheadend.pid -C -u hts -g video
ExecStop=/usr/bin/rm /run/tvheadend.pid
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

after that we enable the service

sudo systemctl enable tvheadend

more

uninstall

as root

systemctl stop tvheadend && systemctl disable tvheadend;
rm /etc/systemd/system/tvheadend.service;
rm -rf /home/hts/; deluser hts;
rm -rf /usr/local/bin/tvheadend
rm -rf /usr/local/share/tvheadend
rm -rf /usr/local/share/man/man1/tvheadend.1