Installing LibreELEC 8.2.5 with MythTV PVR Client on a Raspberry Pi 2/3/3B+
Summary
NOTE: A newer tutorial is available for Installing LibreELEC 11.0.6 with MythTV PVR Client on a Raspberry Pi 2/3/3B+.
This tutorial describes how to install LibreELEC 8.2.5 with MythTV PVR Client on a Raspberry Pi 2/3/3B+ computer. Also covered is changing to Confluence skin, installing a Log Viewer, installing Video Add-ons, enabling Closed Captions, and customizing keyboard and remote control actions.
Why install LibreELEC 8.2.5 when newer versions are available?
The reason in my experience is because an RPi2 (without overclocking) with the newer LibreELEC 9.0.x images is not able to smoothly play North American Over-The-Air MPEG2 1080i content that is recorded by MythTV or Tvheadend Personal Video Recorders (PVRs). The faster RPi3 and RPi3B+ are able to smoothly play these recordings using LibreELEC 9.0.x images.
These steps were documented using a Raspberry Pi 2 Model B with a MythBackend server configured with Mythbuntu 14.04 which uses MythTV 0.27.
Update 2019-09-03: Add Disable Auto CEC TV Power On section to prevent a CEC enabled TV from being automatically turned on after a power outage.
Update 2019-06-20: There is a work-around for the non-smooth playback of 1080i MPEG2 (interlaced) content in Kodi 18+ by changing the in-playback Video settings Deinterlace method to MMAL - Bob. See Background for more details.
Contents
- Background
- A. Download and Uncompress LibreELEC to MicroSD Card
- B. Insert MicroSD Card and Power on Raspberry Pi
- C. Disable LibreELEC updates
- D. Disable Wireless Networks
- E. Enable Confluence Skin
- F. Disable Add-on Upgrades
- G. Enable MPEG-2 Hardware Video Decoding
- H. Enable 3.5mm Headphone Jack Audio
- I. Set Time Zone Details
- J. Add Program Add-on Log Viewer
- K. Install MythTV PVR Client
- L. Configure MythTV Style Skip Backward/Forward
- M. Enable Closed Captions
- N. Activate MCE Remote Subtitle Button
- O. Add Custom Key Mappings for Subtitle Control
- P. Add Video Add-on TED Talks
- R. Disable Auto CEC TV Power On
- Conclusion
- References
Background
Usually I like to keep my Raspberry Pi computers up-to-date with the latest versions of Kodi. My base computer for testing is a RPi2 because other family members also have these.
With the upgrade to Kodi 18.x, the RPi2 lost the ability to smoothly play North American Over-The-Air MPEG2 1080i content that is recorded by MythTV or Tvheadend Personal Video Recorders (PVRs). This occurred even if the file was placed on a USB flash drive or USB hard drive and played directly without the use of either MythTV or Tvheadend.
I wondered if the problem was limited to LibreELEC 9.0.x, but discovered that each distro with Kodi 18.x had the same issue.
RPi Distro Kodi Smooth 1080i MPEG2 Playback?
--------------------- ---- ----------------------------
LibreELEC 8.2.5 17.6 Yes
LibreELEC 9.0.1 18.1 No
LibreELEC 9.0.2 18.2 No
OSMC 2019.05.01 18.2 No
Raspbian 2018-11-13 18.2 No
Note that if a RPi3 or RPi3B+ was used with the above distros then smooth 1080i MPEG2 playback was achieved. The problem with smooth playback on Kodi 18.x seems to be limited to the RPi2.
Note that Kodi includes at least two keyboard menu options that help with diagnosis that can be toggled on/off during video playback:
- O - Display Codec Information (letter "o" not number "0")
- Ctrl+Shift+O - Display Codec Information 2 (additional info. E.g., bitrates, cache, and skips/drops)
For the near term I plan to stay on LibreELEC 8.2.5 with Kodi 17.6 to maintain smooth playback of 1080i MPEG2 content.
Workaround for Kodi 18+
The problem with non-smooth playback of 1080i MPEG2 (interlaced) content on low spec computers (e.g., RPi2) seems to arise from a change in Kodi 18 to the automatically selected deinterlace method from MMAL - Bob or Bob(2x) to MMAL - Advanced or Adv(2x). Changing the Kodi in-playback Video settings for deinterlace method to MMAL - Bob seems to fix the issue.
Steps to change deinterlace method for Confluence skin:
- Play a 1080i MPEG2 (interlaced) video
- Press M to bring up the playback menu
- Choose the Film reel icon to bring up the in-playback Video Settings
- Change Deinterlace method to MMAL - Bob (was Auto select)
- Scroll down and choose Set as default for all media and choose Yes when prompted.
- Choose Close
- Press Escape to return to playing video
See also:
- Kodi forum: Linux - v18 - Choppy video playback
- LibreELEC forum: Libreelec 9 on Raspberry Pi3 B+ skipping frame
- OSMC forum: V18 update - adv(x2) deinterlace lagging/jerky
A. Download and Uncompress LibreELEC to MicroSD Card
Linux users can use the following instructions to download and write the LibreELEC image to the microSD card.
For other operating systems, such as Windows, or newer versions of LibreELEC see LibreELEC Downloads.
-
Download LibreELEC disk image for RPi2/3/3B+:
Download LibreELEC 8.2.5.
At time of installation I downloaded LibreELEC-RPi2.arm-8.2.5.img.gz which included Kodi v17.6.
-
Insert the MicroSD card into your computer.
-
Determine the which /dev/device it is.
dmesg | tail
Example output:
$ dmesg | tail [ 227.218363] sdhci-pci 0000:01:00.2: PCI INT A -> GSI 16 (level, low) -> IRQ 16 [ 227.218396] sdhci-pci 0000:01:00.2: Refusing to bind to secondary interface. [ 227.218413] sdhci-pci 0000:01:00.2: PCI INT A disabled [ 227.218884] jmb38x_ms 0000:01:00.3: enabling device (0000 -> 0002) [ 227.218906] jmb38x_ms 0000:01:00.3: PCI INT A -> GSI 16 (level, low) -> IRQ 16 [ 227.218931] jmb38x_ms 0000:01:00.3: setting latency timer to 64 [ 227.617315] mmc1: new SDHC card at address 0001 [ 227.617720] mmcblk1: mmc1:0001 SD8GB 7.32 GiB [ 227.621661] mmcblk1: p1 p2 [ 228.753036] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
From above output the device is /dev/mmcblk1 (we ignore the partition portion p2).
WARNING: It is very important to identify the correct device. Use of the wrong device path can result in loss of data and/or the operating system.
-
Ensure that the device is unmounted by checking the output from df to see if the device is in use.
Example output:
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 6734812 5612328 780368 88% / udev 499152 4 499148 1% /dev none 506428 8 506420 1% /tmp tmpfs 101288 844 100444 1% /run none 5120 0 5120 0% /run/lock none 506428 72 506356 1% /run/shm none 506428 572 505856 1% /var/log none 506428 0 506428 0% /var/tmp /dev/mmcblk0p1 15615056 1183088 14431968 8% /media/mmcard16gb /dev/mmcblk1p1 261868 111280 150588 43% /media/0F39-638F /dev/mmcblk1p2 7177771 83036 7094735 2% /media/0c0676d8-24f7-43c4-8bed-d19e6ea3a147
If the device is in use then unmount each mount point.
Using the example above we unmount two locations from mmcblk1:
sudo umount /media/0F39-638F sudo umount /media/0c0676d8-24f7-43c4-8bed-d19e6ea3a147
-
Write the image to the microSD Card.
Be sure to use the correctly identified device! In this example the device path is /dev/mmcblk1.
zcat ~/Downloads/LibreELEC-*.img.gz | sudo dd of=/dev/mmcblk1 bs=4M sync
-
Remove the microSD Card.
B. Insert MicroSD Card and Power on Raspberry Pi
At first power up the image will be resized to use the entire microSD card, and then the RPi will reboot.
-
At Welcome to LibreELEC screen choose Next.
-
At Hostname prompt change or leave name LibreELEC and choose Next.
I chose hostname LibreELEC-TV.
-
At Networking screen with Wired and Wireless networks listed choose Next.
-
At Sharing and Remote Access screen under Configure Services enable SSH and disable Samba. Choose Next.
Enable Samba if you wish to access Windows network shares, or to have the hostname easily discoverable on the network.
Note that username is root and pasword is libreelec.
-
At Thank you screen choose Next.
NOTE: If you plan to create an image file for use on other RPi's and you wish to minimize the compressed file size then this is a good time to shutdown LibreELEC. Then you can move the microSD card to another computer and use zerofree
to write zeros to the unused portions of the ext4 partition on the microSD card. For example sudo zerofree /dev/sdf2
. This will help reduce the size of the image file.
C. Disable LibreELEC updates
In the past I have occasionally experienced problems when LibreELEC automatically upgraded. To avoid the sudden appearance of these problems I prefer to disable automatic updates. That way I can manually install the updates at a time of my choosing.
Note that this setting does not seem to be available in the Confluence skin so we change it from the Estuary skin.
Update 2019-06-21: This setting is available in the Confluence skin at Programs -> LibreELEC Configuration.
Disable LibreELEC Updates:
-
Navigate to Settings (gear icon) -> LibreELEC -> System -> Updates.
-
Change Automatic Updates to manual.
-
Press Escape twice to back out to main screen.
How to Manually Update LibreELEC:
-
Download your chosen version of the LibreELEC image file from LibreELEC Downloads.
-
Copy the file to the microSD card
/storage/.update/
folder.
For example:
scp -p LibreELEC-RPi2.arm-9.0.2.img.gz root@192.168.1.68:/storage/.update/
-
Reboot LibreELEC.
D. Disable Wireless Networks
The reason for disabling wireless networks is to reduce the power required by the RPi3 and RPi3B+. These options are disabled by default on a RPi2 because it does not have the hardware to support wireless networks or bluetooth.
Note that these settings do not seem to be available in the Confluence skin so we change these from the Estuary skin.
Update 2019-06-21: These settings are available in the Confluence skin at Programs -> LibreELEC Configuration.
-
Navigate to System (gear icon) -> LibreELEC -> Network -> Wireless Networks.
-
With Active highlighted press Enter to toggle status.
-
Navigate to Bluetooth.
-
With Active highlighted press Enter to toggle status.
-
Press Escape twice to back out to main screen.
E. Enable Confluence Skin
The default User Interface skin in Kodi 17.x Krypton is Estuary. Personally I prefer the Confluence skin because in my opinion it works better with all monitors, especially older 720p displays.
-
Navigate to Settings (gear icon) -> Interface Settings -> Skin.
-
Navigate right to Skin and press Enter.
-
Choose Get more....
-
Navigate down, select Confluence and press Enter.
An Installing Confluence... window should display temporarily. -
At Keep Skin? Would you like to keep this change? prompt select Yes and press Enter.
-
Press Escape twice to back out to main screen.
Note that all instructions after this section assume the Confluence skin has been chosen.
F. Disable Add-on Upgrades
I've also experienced issues with add-ons being automatically updated. Hence I prefer to disable these and perform updates manually.
Disable add-on automatic updates and enable unknown sources:
-
Navigate to System -> Settings -> System -> Add-ons.
-
Change Updates to Notify, but don't install updates.
-
Enable Unknown sources and answer Yes to warning.
This is used to install add-ons from zip files. -
Press Escape twice to back out to main screen.
How to Manually Update Add-ons:
-
Navigate to System -> Settings -> Add-ons -> Available updates.
-
For each Add-on you wish to update:
Choose Add-on, choose Update, choose the update version, and wait for update to install.
G. Enable MPEG-2 Hardware Video Decoding
If you plan to view MPEG-2 content such as North American Over-The-Air TV then purchase an MPEG-2 license key from the Raspberry Pi Store. Cost is ~2 British Pounds. The license key will be sent to the email address you provide (can take up to 72 hours).
Note that a VC-1 license key is also available, but it is not needed to view North American Over-The-Air content which is in MPEG-2 format.
-
Lookup the IP Address in Kodi for the Raspberry Pi.
Navigate to System -> System info.
Make note of the IP address.
In this example we will use 192.168.1.68.
Press Escape to back out to the main screen.
-
Open a terminal window on a different GNU/Linux computer and make a secure shell connection to the IP address of your Raspberry Pi.
Be sure to use the IP address for your RPi on your network.
ssh root@192.168.1.68
The default password is libreelec all lowercase.
-
In the SSH session mount the /flash directory with read and write privileges.
mount -o remount,rw /flash
-
Edit the /flash/config.txt file to add the MPEG-2 license key.
nano /flash/config.txt
Locate the decode_MPG2 line, remove the # and space at the front, and add your MPEG-2 license key.
decode_MPG2=0x8ff5a5c7
If you wish to share a microSD card image with multiple RPi's then you can string together a maximum of 8 licenses. For example:
decode_MPG2=0x8ff5a5c7,0xd4cb22af,0xe05b40bc,0xa54335b8,0x5964579b,0xafd24232
-
Fix analog audio crackling with LibreELEC 8.2.4 and 8.2.5 [Optional]
If you experience analog audio crackling, such as when playing OTA MPEG2 1080i recordings, then add the following config.txt parameter.
audio_pwm_mode=0
-
Potential fix for overscan issue [Optional]
If the edges of the kodi display are not visible on the physical screen, then try adding or uncommenting the overscan_scale=1 config.txt parameter.
overscan_scale=1
-
Save and exit the editor with Ctrl+X.
Answer Y to save modified buffer.
Press Enter accept File Name to Write. -
Return the /flash directory back to read only privileges.
mount -o remount,ro /flash
-
Reboot the Raspberry Pi. This will close the SSH session.
reboot
If you wish you can check if the MPEG-2 decoder is enabled via an SSH connection with the following command:
vcgencmd codec_enabled MPG2
The MPEG-2 hardware video decoder should now be enabled.
H. Enable 3.5mm Headphone Jack Audio
Enable both HDMI and 3.5mm headphone jack for audio.
-
Navigate to System -> Settings -> System -> Audio -> Audio output device and press Enter.
-
In Audio output device window navigate to PI: HDMI and Analogue and press Enter.
-
Press Escape twice to back out to main screen.
I. Set Time Zone Details
-
Navigate to System -> Settings -> Interface -> Regional -> Language.
-
Navigate to Timezone country and press Enter.
Set the following:
Region default format: # e.g., Canada Timezone country: # e.g., Canada Timezone: # e.g., America/Edmonton
-
Press Escape twice to back out to main screen.
J. Add Program Add-on Log Viewer
The Program add-on named Log Viewer for Kodi can be very helpful when trouble-shooting issues with add-ons.
-
Navigate System -> Settings -> Add-ons.
If First run help... window pops up, read the message then press OK to dismiss.
-
Navigate to Install from repository -> All repositories -> Program add-ons.
-
Navigate to Log Viewer for Kodi and press Enter.
-
Select Install and press Enter.
When I did this version 2.0.0 was installed. -
Press Escape three times to back out to main screen.
K. Install MythTV PVR Client
If you wish to watch recordings from a MythTV PVR then install this add-on.
See also Configuring MythTV Backend for Remote Frontends.
-
Navigate to System -> Settings -> Add-ons.
-
Navigate to Install from repository -> All repositories -> PVR Clients.
-
Navigate to MythTV PVR Client and press Enter.
-
Select Install and press Enter.
When I did this version 4.15.3.1 was installed. -
On MythTV PVR Client press Enter.
-
Navigate to Configure and press Enter.
Using your own MythTV Backend values for IP Address, Security Pin and Ethernet Address, set the following:
MythTV Backend Hostname or IP 192.168.1.55 ... MythTV Security Pin for API services 0000 MythTV Backend Ethernet address (WOL) 00:0b:0e:0f:00:ed ... Conflict Handling Prefer recording and stop Live TV
Note be sure to use the same security pin as you set in the MythTV Backend.
-
Navigate up to General tab.
-
Navigate right to Preferences tab.
Set the following:
Enable commercial skips (EDL) Never
-
Navigate down to OK button and press Enter.
-
If PVR clients: MythTV PVR Client - Needs to restart is displayed then choose OK.
-
Otherwise press Escape three times to back out to main screen.
L. Configure MythTV Style Skip Backward/Forward
In the default Kodi configuration, skip steps progressively increase in value as the arrow key is pressed, and there is a 750ms delay before performing the skip action. The default skip steps are:
-30 min, -10 min, -5 min, -3 min, -60 sec, -30 sec, -10 sec, starts here, 10 sec, 30 sec, 60 sec, 3 min, 5 min, 10 min, 30 min.
This can be disconcerting to MythTV Mythfrontend users. The Mythfrontend default is -5s back and +30s forward.
To make the skip backward/forward experience closer (-10s/+30s) to Mythfrontend the steps are:
-
Navigate to System -> Settings -> Player -> Videos.
-
Navigate to Skip steps and press Enter.
-
Navigate up/down to each value that is not (-10s/+30s) and press Enter.
The text colour should change from yellow to grey. This indicates the value will not be used in skipping.
Check to ensure the -10 sec and 30 sec entries are yellow.
-
Navigate to OK and press Enter.
-
Navigate to Skip delay (on down arrow icon) and press Enter 3 times.
This will reduce the skip delay from 750 ms to None.
-
Press Escape twice to back out to main screen.
M. Enable Closed Captions
Here we enable the ability to parse for closed captions contained within the recorded ATSC TV shows.
-
Navigate to System - > Settings -> Player -> Language.
-
Navigate to Enable parsing for closed captions and press Enter to toggle to active.
-
Press Escape two times to back out to main menu.
N. Activate MCE Remote Subtitle Button
These steps should enable the Subtitle, Teletext or Closed Caption button on an MCE remote control so you can easily toggle closed captions on and off without having to go through the menu.
-
Open a terminal window on a different GNU/Linux computer and make a secure shell connection to the IP address of your Raspberry Pi.
Be sure to use the IP address for your RPi3 on your network.
ssh root@192.168.1.68
The default password is libreelec all lowercase.
-
Change to the
~/.kodi/userdata/keymaps
directory.cd ~/.kodi/userdata/keymaps
-
Create/edit
remote.xml
file.nano remote.xml
-
Cut and paste the following content.
<?xml version="1.0" encoding="UTF-8"?> <keymap> <FullscreenVideo> <remote> <teletext>ShowSubtitles</teletext> </remote> </FullscreenVideo> </keymap>
-
Save the file with Ctrl+O and exit with Ctrl+X.
O. Add Custom Key Mappings for Subtitle Control
These steps should enable the Subtitle, Teletext or Closed Caption button on an MCE remote control so you can easily toggle closed captions on and off without having to go through the menu.
-
Open a terminal window on a different GNU/Linux computer and make a secure shell connection to the IP address of your Raspberry Pi.
Be sure to use the IP address for your RPi3 on your network.
ssh root@192.168.1.68
The default password is libreelec all lowercase.
-
Change to the
~/.kodi/userdata/keymaps
directory.cd ~/.kodi/userdata/keymaps
-
Create/edit
keymap.xml
file.nano keymap.xml
-
Determine the key presses we wish to remap.
Often the default keymaps for the keyboard and remote controls work well. However sometimes you may wish set up custom keymappings.
PC Keyboard remappings
The T key toggles subtitles.
Keyboard Key New Function ---------------- ------------ F5 Activate the OSD audio settings window Ctrl+Left Subtitle delay minus Ctrl+Right Subtitle delay plus Ctrl+Shift+Left Audio delay minus Ctrl+Shift+Right Audio delay plus
VRC-1100 Vista MCE remote control
Note that this remote is more challenging to change because it acts like a keyboard and mouse combination.
Remote Key Key Code New Function ---------------- ------------ ------------ Explorer (e) KEY_WWW - Power KEY_POWER - Yellow KEY_VCR - Blue KEY_AUDIO - Green KEY_CAMERA - Red KEY_VIDEO - Below Yellow KEY_TUNER - Below Blue KEY_EPG - Below Green KEY_TV - Below Red KEY_DVD - Info KEY_INFO - Close KEY_SUBTITLE - already "Close"d Captioned Clear KEY_DELETE - Enter KEY_ENTER -
INFRARED REMOTE CONTROLS
Note that LibreELEC 9.x InfraRed Remotes now use in-kernel decoding, which is different from the way LibreELEC 8.x worked.
To learn the infrared remote control keycodes, in a terminal window with an ssh session to the RPi start the program irw and it will echo the keycodes as you press keys on the remote control. To exit irw type Ctrl+C.
Mediagate MG-IR02BK / Rosewill RRC-126 MCE rc6 remote control
Remote Key Key Code New Function ---------------- ------------ ------------ Power (moon) KEY_SLEEP - Pictures KEY_CAMERA - Music KEY_AUDIO - Videos KEY_VIDEO - Radio KEY_RADIO - Clear KEY_DELETE - DVD Menu KEY_DVD - Enter KEY_ENTER - Zoom (red) KEY_ZOOM - Angle (green) no code - Audio (yellow) KEY_LANGUAGE - Subtitle (blue) KEY_TITLE Subtitle
Philips 5100 Vista MCE rc6 remote control
Remote Key Key Code New Function ---------------- ------------ ------------ Power (moon) KEY_SLEEP - TV red dot KEY_PVR - Grid KEY_EPG - TV triangle KEY_TUNER - Rectangle slot KEY_DVD - Clear KEY_DELETE - Rectangle T KEY_SUBTITLE - Enter KEY_ENTER - Red KEY_RED - Green KEY_GREEN - Yellow KEY_YELLOW - Blue KEY_BLUE Subtitle
-
To remap the keys, cut and paste the following content.
If
keymaps.xml
file already exists then add only the inner section of lines as only one section is needed for each ofFullScreenVideo
andkeyboard
andremote
.<?xml version="1.0" encoding="UTF-8"?> <keymap> <FullscreenVideo> <keyboard> <!-- PC keyboard --> <F5>ActivateWindow(osdaudiosettings)</F5> <left mod="ctrl">subtitledelayminus</left> <right mod="ctrl">subtitledelayplus</right> <left mod="ctrl,shift">audiodelayminus</left> <right mod="ctrl,shift">audiodelayplus</right> </keyboard> <remote> <!-- Mediagate MG-IR02BK / Rosewill RRC-126 MCE rc6 remote control --> <title>ShowSubtitles</title> <!-- Philips 5100 Vista MCE rc6 remote control --> <blue>ShowSubtitles</blue> </remote> </FullscreenVideo> </keymap>
-
Save the file with Ctrl+O and exit with Ctrl+X.
See also Kodi Add Downloaded Subtitle to DVD Playback.
P. Add Video Add-on TED Talks
Video add-ons enable you to watch content that is streamed over the Internet. One such add-on is TED Talks which we'll show you how to install. Other add-ons can be installed in a similar fashion.
-
Navigate Video -> Add-ons.
-
Navigate Left to access side-bar menu.
-
Navigate to Get more... and press Enter.
-
Navigate to TED Talks and press Enter.
-
Select Install and press Enter.
When I did this version 4.2.12 was installed. -
Press Escape once to back out to the list of your video add-ons.
At this location you can invoke a specific add-on to watch it's content. -
Press Escape once to back out to main screen.
Q. Create Favourites
You can create favourites for video add-ons.
-
Select a TV Show or episode in a video add-on.
-
On a keyboard press the letter C.
-
Choose Add to favourites.
To remove favourites:
-
Select a favourite.
-
On a keyboard press the letter C.
-
Choose Remove.
Favourites are accessed by the star icon next to the Power icon.
These favourites are stored in the /storage/.kodi/userdata/favourites.xml
file.
R. Disable Auto CEC TV Power On
With the default LE settings when the RPi is powered on and connected to a TV that supports CEC, a signal is sent to power on the TV. This can be an annoyance when a power failure occurs because the TV will be automatically turned on when the power is restored. Hence disable this feature.
-
Navigate to System -> Settings -> System -> Input -> Peripherals -> CEC Adapter.
-
Change the following settings:
- Disable - Switch source to this device on startup
- Set to "None" - Devices to power on during startup
- Set to "None" - Devices to power off during shutdown
-
Choose OK to save settings.
-
Press Escape three times to back out to main menu.
Conclusion
Congratulations. You should now have an inexpensive way to watch your MythTV recordings and Video add-on content on a Raspberry Pi 2/3/3B+ computer.
References
While writing this tutorial I found the following resources helpful: