[mythtv-users] MythTV Raspberry Pi2 - draft frontend setup steps

Curtis Gedak gedakc at gmail.com
Sat Jan 9 21:59:37 UTC 2016


First, a huge *Thank You* to Lawrence Rust for his work to get
MythFrontend working on the Raspberry Pi 2 computer.  Lawrence's work
and the many user posts on this mailing list encouraged me to join in
the endeavour to create a cheap MythTV Frontend on RPI2.

TL;DR - Following are the steps I used to set up a MythTV Frontend on
        a Raspberry Pi 2 to watch recordings.  The MythTV recordings
        were 1080i and 720p MPEG2 ATSC Over-The-Air recorded in
        Canada.  By the end of the steps many of the recordings I
        watched demonstrated smooth video and sound.

These steps were gathered starting with Lawrence's
[mythtv_for_rpi.txt][1] document and by following the
[MythTV Raspberry Pi2 frontend testers][2] mailing list thread posted
on Nov. 17, 2015.  I used Lawrence's
[mythtv-v0.27.5-115-g00c0993-RPI2-jessie.tar.bz2][3] file dated
December 23, 2015.

[1]: http://www.softsystem.co.uk/download/mythtv/mythtv_for_rpi.txt
[2]:
http://www.gossamer-threads.com/lists/mythtv/users/592434?search_string=raspberry;#59243
[3]:
http://www.softsystem.co.uk/download/mythtv/mythtv-v0.27.5-115-g00c0993-RPI2-jessie.tar.bz2


Hardware
--------

 - Raspberry Pi 2
 - Wireless USB Keyboard and Mouse
 - Ethernet cable connection
 - BenQ LCD Monitor 1680x1050 connected via HDMI
 - Speakers (unamplified) connected via 3.5mm headphone jack


Raspberry Pi 2 MythTV Frontend Set Up Steps
-------------------------------------------

On Raspberry Pi 2:

 1. Insert a Micro SD card containing NOOBS v1.5.0 into the RPI2.

 2. Power up / Boot RPI2

    Install Raspbian (Jessie)

         Language (l):  English (US)
         Keyboard (9):  us

    At completion click OK and RPi2 will reboot

 3. Ensure software is up-to-date

        sudo apt-get update && sudo apt-get upgrade

 4. Fix ping command not available for pi user.
    (ping is broken for non-root users in recent Jessie)

        sudo chmod u+s /bin/ping

 5. Use "sudo raspi-config" to change the following settings:

        3. Boot Options
            B2 Console Autologin              # If GUI needed use startx
        5. Internationalisation Options
            I1 Change Locale
                en_CA.UTF-8
            I2 Change timezone
                America - Edmonton
            I3 Change Keyboard Layout
                Generic 105-key (Intl) PC     # To fix tilde ~ key
                     English (US)
                         Right Alt (AltGr)
                             No compose key
                               Yes - Ctrl+Alt+BS to terminate X svr
        9. Advanced Options
            A1 Overscan     # I think this is the default setting
                Enable
            A3 Memory Split
                gpu_mem=256
            A9 Audio
                1 Force 3.5mm ('headphone') jack

     Choose Reboot when finished.

 6. Set ALSA sound to maximum volume (was 40, set to 100).

        alsamixer

    Use Escape key to exit.

        speaker-test -c2 -twav

    _Note that sound volume through my unamplified speakers is still
    low.  I think using amplified speakers with the RPI2 is needed to
    reach a reasonable volume loudness._

    SWAPSPACE: Another item mentioned in the mailing list thread was
    to disable swap to lessen the wear and tear on the micro SD card.
    I did not disable swap.


On GNU/Linux desktop computer (I'm using kubuntu 12.04):

 7. Download Lawrence's latest build of MythTV.

        wget
http://www.softsystem.co.uk/download/mythtv/mythtv-v0.27.5-115-g00c0993-RPI2-jessie.tar.bz2

 8. Copy archive to Raspberry Pi

        rcp mythtv-v0.27.5-*-RPI2-jessie.tar.bz2 pi at raspberrypi:~


On Raspberry Pi 2:

 9. Install MythTV on Raspberry Pi 2

        export MYTHTVDIR=~/mythtv-rpi
        mkdir -p $MYTHTVDIR
        tar -C $MYTHTVDIR -xavf mythtv-v0.27.5-*-RPI2*.tar.bz2

10. Install Jessie dependencies

        sudo apt-get install libudf0 libass5 \
         libxcb-icccm4 libxcb-image0 libxcb-render-util0 libxcb-sync1 \
         libxcb-randr0 libxcb-keysyms1 fonts-liberation \
         libdate-calc-perl mysql-client libexiv2-13


On GNU/Linux desktop computer:

11. Remote shell into RPI2.

        ssh -YC pi at raspberrypi

12. Setup mythfrontend via SSH to RPI2.

        QT_QPA_PLATFORM=xcb\
         LD_LIBRARY_PATH=$HOME/mythtv-rpi/lib\
         QT_PLUGIN_PATH=$HOME/mythtv-rpi/plugins\
         ~/mythtv-rpi/bin/mythfrontend -w -geometry 1280x720 -p

    At setup I chose:

        Country:    Canada
        Language:   English (Canada)

    Click Save

    On MythTV Servers screen my "MythTV AV Media Server 0.27" was
    listed and highlighted so I clicked on Save.

    If all works well then the normal MythTV Frontend will appear on
    your desktop computer.  I checked and saw the correct "Setup ->
    General" values.

        Hostname:       <your MythTV Backend server IP address>
        Yes - Ping test server?
        Port:           3306
        Database name:  mythconverg
        User:           mythtv
        Password:       <your mythtv MySQL database password>

    _Note that you can get the mythtv MySQL password from the MythTV
    Frontend Setup General screen._

    Exit out of this Frontend with Escape key.


On Raspberry Pi 2:

13. Start Myth Frontend

        export MYTHTVDIR=~/mythtv-rpi
        QT_QPA_EGLFS_FORCE888=1 QT_QPA_PLATFORM=eglfs\
         LD_LIBRARY_PATH=$MYTHTVDIR/lib\
         QT_PLUGIN_PATH=$MYTHTVDIR/plugins\
         PYTHONPATH=$MYTHTVDIR/lib/python2.7/site-packages\
         $MYTHTVDIR/bin/mythfrontend

    Try to watch recordings.

    _Note that at this point when watching recordings the video and
    audio playback was choppy with lots of stuttering.  I placed these
    lines in a bash script called "~/runFE.sh" to save typing each
    time I start the MythTV Frontend._

14. Configure Frontend audio setup

    Select Setup -> Audio

    Ensure:

         Audio output device:    ALSA:default
         Speaker configuration:  Stereo

    Click Next

    Ensure:

         Mixer device:         ALSA:default
         Mixer controls:       PCM
         Master mixer volume:  100%
         PCM mixer volume:     100%

    Click Finish

15. Configure Frontend video setup

    Select Video -> Playback

    Click Next 2 times to get to Playback Profiles (3/8)

    Ensure:

        Current Video Playback Profile:  OpenGL High Quality

    If you make changes then click Next 5 times then click Finish to
    save and exit playback settings.

    Escape to top level menu.

    Try Mythfrontend to watch recordings again.

    _Note that I did not make any changes so watching recordings was
    the same as noted earlier._

16. Purchase MPEG-2 license from Raspberry Pi Store and apply.

    My license took 1 day to arrive via email.  To apply:

        sudo nano /boot/config.txt

    and append your decode_MPG2 line.  For example:

        decode_MPG2=0x########

    Reboot and confirm that license applied correctly with:

        vcgencmd codec_enabled MPG2

    Try Mythfrontend to watch recordings again.

    _Note that on my system when watching recordings the video and
    audio were much smoother, but still suffered occasionally from
    stuttering or choppiness._

    _Note2: The [News_Extract_2min.mpg][4] and [Today_30sec.mpg][5]
    videos from Peter also suffered from minor stuttering in the video
    and audio._

    [4]: https://dl.dropboxusercontent.com/u/45325311/News_Extract_2min.mpg
    [5]: https://dl.dropboxusercontent.com/u/45325311/Today_30sec.mpg

17. Apply mild over-clock settings as suggested by Lawrence.

        sudo nano /boot/config.txt

    Append the following lines:

        arm_freq=1000
        core_freq=450
        gpu_feq=300
        sdram_freq=467
        over_voltage=2

    Reboot and try Mythfrontend to watch recordings again.

    _Note that at this point when watching recordings the video and
    sound were mostly smooth.  I did encounter one recording
    (Superstore pilot) that showed random pixelation and small sound
    gaps._

    _Note2: The [News_Extract_2min.mpg][4] and [Today_30sec.mpg][5]
    videos from Peter played video and audio smoothly.  However when
    subtitles were turned on then the video and audio stuttered._


Testing Results
---------------

## The Good

Many, not all, recordings demonstrate no video stuttering or audio
choppiness when playing either 1080i or 720p MythTV recordings.

On Screen Display (OSD) works with no artifacting or stuttering.

Commercial skip works as well as on my Intel Core i5 2500K MythTV
Backend/Frontend combination.

Since my LCD monitor is only 1680x1050 the edges of the video image
are not visible on the screen.  This is the same as with my Intel
MythTV Backend/Frontend combination and is likely due to how the
monitor handles a 1080 HDMI feed.

## The Bad

One 1080i recording (SuperStore) showed random pixelation and
tiny gaps in audio, I will see about collecting information for this
file and posting separately in the "MythTV Raspberry Pi2 frontend
testers" thread.

If subtitles are enabled the occasionally there is a short stutter in
the video and audio.

## The Question

I believe Peter mentioned he used X11 and XCB with FFMEGP to play
recordings.

Could someone share the changes I need to make (for example to the
MythTV Video Playback Profile) to try this out?


Preliminary Conclusion
----------------------

This initial work is very promising.  Though I have not watched many
recordings, it appears that smooth video and sound is within the realm
of possibility using a MythTV Frontend running on a Raspberry Pi 2.
:-)


Thanks again to Lawrence for his MythTV work on the Raspberry Pi 2.
If there is something I can do to help then please don't hesitate to
ask.

--
Curtis Gedak
Linux Crumbs
http://gedakc.users.sourceforge.net



More information about the mythtv-users mailing list