Once in your life you should attempt to build mythtv, just to help you remember that once something complicated is working, never to touch it ever again. For some reason I’m doing my build on Centos 64bit (that has hardly any codecs prepackaged) as opposed to Debian that all the sane people are using. Warning In terms of my methodology, it’s best not to copy anything I’m about to do on anything other than a home system you just want to work as I’m not building rpms, I’m installing from source and even using cpan for the Perl dependencies. This is my first draft and I’m mainly putting it online so I can keep a log of what I’ve done and to reference it when asking people annoying questions about errors I’ve had.
If someone does take the work I’ve done here and writes a better guide (building rpms as you go – don’t just use some random repo) then let me know in the comments.
First install some libs and tools we’ll need at various stages
yum install gnutls-devel mysql mysql-devel perl-DBD-MySQL perl-ExtUtils-MakeMaker perl-IO-Socket-INET6 perl-IO-Socket-SSL libxml2 libxml2-devel python-lxml MySQL-python pulseaudio-libs-devel fftw-devel alsa-lib-devel avahi-compat-libdns_sd-devel gdb gsm gsm-devel opencv opencv-devel openjpeg openjpeg-devel speex speex-devel libtheora libtheora-devel libv4l-devel libv4l libvorbis libvorbis-devel bzip2-devel texi2html SDL SDL-devel taglib taglib-devel flac flac-devel perl-XML-Simple perl-XML-XPath perl-Image-Size perl-SOAP-Lite perl-JSON perl-DateTime perl-Test-Pod lsof -y
Lets build yasm first
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar -zxf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --prefix=/usr/local
make -j3 && make install
cd ..
Then lets build faac
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
tar -zxf faac-1.28.tar.gz
cd ../faac-1.28
./configure --prefix=/usr/local
vim ./common/mp4v2/mpeg4ip.h
# comment out line 126 with /* */
make -j3 && make install
cd ..
Now lets build lame
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -zxf lame-3.99.5.tar.gz
cd ../lame-3.99.5
./configure --prefix=/usr/local
make -j3 && make install
cd ..
And then x264
git clone git://git.libav.org/libav.git
cd x264
# dont forget --enabled-shared on the next bit
./configure --prefix=/usr/local --enable-shared
make -j3 && make install
cd ..
And we need qt, the normal centos version doesn’t have QTWebKit
wget http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.tar.gz
tar -zxf qt-everywhere-opensource-src-4.8.2.tar.gz
cd qt-everywhere-opensource-src-4.8.2
./configure -fast -no-accessibility -qt-sql-mysql -no-sql-sqlite -no-sql-odbc -no-libtiff -no-libmng -nomake examples -nomake demos -no-nis -no-cups -no-phonon -no-svg
# this make takes a long time on the HP Microserver I'm using, best to leave it running and come back much later
make -j3 && make install
cd ..
Libvpx
wget http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2
tar -jxf libvpx-v1.1.0.tar.bz2
cd libvpx-v1.1.0
./configure --enable-vp8 --enable-shared --prefix=/usr/local
make -j3 && make install
cd ..
xvid
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.bz2
tar -jxf xvidcore-1.3.2.tar.bz2
cd xvidcore/build/generic
./configure --prefix=/usr/local
make -j3 && make install
cd ..
FIXME: Subtitle support
# EDIT libass wont compile so I had to disable it in ffmpeg
# wget http://fribidi.org/download/fribidi-0.10.9.tar.gz && tar -zxf fribidi-0.10.9.tar.gz && cd fribidi-0.10.9
# ./configure --prefix=/usr/local && make -j3 && make install
# cd ..
# wget http://libass.googlecode.com/files/libass-0.10.0.tar.gz
# tar -zxf libass-0.10.0.tar.gz
# cd libass-0.10.0
# ./configure --prefix=/usr/local && make -j3 && make install
#
# [...]
# In file included from ass_font.c:35:
# ass_shaper.h:33: error: expected declaration specifiers or ‘...’ before ‘FriBidiParType’
# ass_shaper.h:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘resolve_base_direction’
# [...]
FIXME: Libcelt audio codec support
# yum install celt051 celt051-devel
# more fail, despite this ffmpeg could never find it
# ERROR: libcelt not found
At this point I confess that I had been sat at the computer a long time and was starting to become a little tired with trying to compile dependencies for ffmpeg and fighting with obscure error messages so decided to build ffmpeg without libcelt and without anything else that complained form this point on, the aim being just to get the damn thing working. So at this point the following aren’t working in the ffmpeg build
libdxva2 enabled no [windows only]
libva enabled no
libvdpau enabled no
AVISynth enabled no [windows only]
frei0r enabled no
libaacplus enabled no
libass enabled no
libcaca enabled no
libcdio support no
libcelt enabled no
libdc1394 support no
libfdk-aac enabled no
libiec61883 support no
libilbc enabled no
libmodplug enabled no
libnut enabled no
libopencore-amrnb support no
libopencore-amrwb support no
libopus enabled no
librtmp enabled no
libschroedinger enabled no
libstagefright-h264 enabled no
libtwolame enabled no
libutvideo enabled no
libvo-aacenc support no
libvo-amrwbenc support no
libxavs enabled no
openal enabled no
makeinfo enabled no
So, FFmpeg next
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --disable-w32threads \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-shared \
--enable-gray \
--enable-avresample \
--enable-vda \
--enable-vdpau \
--enable-bzlib \
--enable-fontconfig \
--enable-gnutls \
--enable-libfaac \
--enable-libfreetype \
--enable-libgsm \
--enable-libmp3lame \
--enable-libopencv \
--enable-libopenjpeg \
--enable-libpulse \
--enable-libspeex \
--enable-libtheora \
--enable-libv4l2 \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libxvid \
--enable-openssl \
--enable-zlib \
--enable-pic \
--enable-sram
make -j3
# at this point if it doesn't fail after 30 seconds with some cryptic messages then you deserve a drink
# it will take a few minutes, about time to make a cup of tea
make install
And then finally I crossed that other line of bad practise and messed around with cpan outside of my package managers control. If you’re doing this on your own home server then it’s your choice but best not to do this anywhere that matters if you can avoid it.
yum install perl-CPAN -y
cpan
cpan> install YAML
cpan> install HTTP::Request
cpan> install LWP::UserAgent
cpan> install Date::Manip
cpan> install Net::UPnP::QueryResponse
# this last one should be done by the above
# cpan> install Net::UPnP::ControlPoint
cpan> quit
FIXME: And then finally mythtv. ignore CEC and ASI support. I have some issues to fix here
wget http://www.mythtv.org/download/mythtv/0.25.2
tar -jxf mythtv-0.25.2.tar.bz2
cd mythtv-0.25.2
# I had to give up with --enable-libx264 --enable-libmp3lame --enable-libfaac which all caused errors when making
#
# ./libavutil/libm.h:62: error: static declaration of ‘lrint’ follows non-static declaration
# ./libavutil/libm.h:76: error: static declaration of ‘round’ follows non-static declaration
#
# So sadly I just ended up with
./configure --prefix=/opt/mythtv --enable-nonfree --qmake=/usr/local/Trolltech/Qt-4.8.2/bin/qmake
make -j3 && make install
cd ..
If everything had gone right, this would have ended up with a mythtv install that’s only missing the following options, let me know if you can improve the steps in this guide to add more
libCEC device support no [/usr/include]
FireWire support no
ASI support no
# Sound Output Support
JACK support no
libfftw3 support no
# Video Output Support
xv support no
VDPAU support no
VAAPI support no
CrystalHD support no
OpenGL video no
libass subtitle support no
# Misc Features
OpenGL ES 2.0 no
# External Codec Options
xvid no
vpx no
After this it’s a case of
make -j3 && make install
And then the plugins
wget http://www.mythtv.org/download/plugins/0.25.2
tar -jxf mythplugins-0.25.2.tar.bz2
cd mythplugins-0.25.2
cpan
cpan> install DateTime::Format::ISO8601
cpan> quit
./configure --enable-all --prefix=/opt/mythtv --qmake=/usr/local/Trolltech/Qt-4.8.2/bin/qmake
Which leaves we with
MythNetvision requires the Python OAuth library (oauth)
Disabling MythNetvision due to missing dependencies.
Configuration settings:
qmake /usr/local/Trolltech/Qt-4.8.2/bin/qmake
MythArchive plugin will be built
MythBrowser plugin will be built
MythGallery plugin will be built
MythGame plugin will be built
MythMusic plugin will be built
MythNetvision plugin will not be built
MythNews plugin will be built
MythWeather plugin will be built
MythZoneMinder plugin will be built
OpenGL support will not be included in MythGallery
EXIF support will not be included in MythGallery
Dcraw support will not be included in MythGallery
libcdio support will not be included in MythMusic
FFTW v.3 support will be included in MythMusic
we then
make -j3 && make install
From this point onwards I’m borrowing heavily from http://www.mythtv.org/wiki/Installing_MythTV_on_Fedora with the odd change for Centos
adduser mythtv
passwd mythtv
Edit the firewall to allow traffic on port 80 and 443 from our network
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -tcp -s 129.168.1.0/24 --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -tcp -s 129.168.1.0/24 --dport 443 -j ACCEPT
service iptables restart
Setup mysql
yum install mysql-server
chkconfig --level 345 mysqld on
service mysqld start
# observe the dire warnings
/usr/bin/mysql_secure_installation
# when asked: set a mysql root password
# when asked: remove the anonymous user
# when asked: limit root user login to localhost
# when asked: remove test database
# when asked: reload tables
mysql -u root -p < mythtv-0.25.2/database/mc.sql
vim /etc/mysql.cnf
# recommended settings for mysql from http://www.mythtv.org/wiki/Installing_MythTV_on_Fedora
key_buffer = 16M
table_cache = 128
sort_buffer_size = 2M
myisam_sort_buffer_size = 8M
query_cache_size = 16M
The setup program is a X application but I'm only interested in mythweb. I need a Linux workstation area for at home anyway, so I'll install KDE and I'll use nomachine to run the remote desktop instead of tunnelling X.
yum groupinstall "X Window System" "KDE Desktop"
wget http://64.34.173.142/download/3.5.0/Linux/nxnode-3.5.0-9.x86_64.rpm
wget http://64.34.173.142/download/3.5.0/Linux/FE/nxserver-3.5.0-11.x86_64.rpm
rpm -i nxserver-3.5.0-11.x86_64.rpm nxnode-3.5.0-9.x86_64.rpm nxclient-3.5.0-7.x86_64.rpm
Sadly at this point things come to a halt
$ /opt/mythtv/bin/mythtv-setup
/opt/mythtv/bin/mythtv-setup: error while loading shared libraries: libmythtv-0.25.so.0: cannot open shared object file: No such file or directory
$ ls /opt/mythtv/lib/libmythtv-0.25.so.0.25.0
/opt/mythtv/lib/libmythtv-0.25.so.0.25.0
It's probably obvious to someone who does more compiling and linking than I do (I do just about none normally). I decided to take a break from the computer at this point and go out for food, figured I'd hit publish so my mythtv using friends can have a giggle.