Raspberry Pi OS 64-bit and mythtv

For discussion of topics specific to MythTV on Raspberry Pi devices
User avatar
monkeypet
Junior
Posts: 49
Joined: Tue Feb 11, 2014 7:18 pm
United States of America

Raspberry Pi OS 64-bit and mythtv

Post by monkeypet »

I got the Raspberry Pi OS BETA 64-bit version installed and running today on a Raspberry Pi 4. Download the image from https://downloads.raspberrypi.org/raspios_arm64/images/. Then boot it up, it should boot all the way up to the desktop.
Next follow the compile mythtv from source instructions on the wiki, https://www.mythtv.org/wiki/Build_from_Source. You should be up and running quickly after the compilation finishes. There is a noticeable difference in the smoothness of MPEG2 playback in mythfrontend. Anyways, I wanted to give people on the fence some encouragement if they wanted to try the BETA 64-bit OS version.

Also I overclocked it to

Code: Select all

arm_freq=2000
over_voltage=6
I discussed my journey to getting smooth MPEG2 playing on the Raspberry Pi 4 on this thread, viewtopic.php?f=46&t=3791
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

What did you do about the dependencies? did ansible work? What build options did you use (.buildrc)?
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

jfabernathy wrote:
Mon Aug 09, 2021 9:12 am
What did you do about the dependencies? did ansible work? What build options did you use (.buildrc)?
I finally got time to answer my own questions:

ansible didn't work because it requires a package that doesn't exist in Raspberry Pi OS 64bit. libcrystalhd-dev

So I installed from the list of dependencies manually.
I built the mythtv-light as documented on the wiki. my .buildrc file is:

Code: Select all

MYTHTV_CONFIG_OPT_EXTRA="--disable-vdpau --enable-opengl --disable-vaapi --arch=aarch64"
I also had to install a package called qt5-default

I only test mythfrontend but it looks much better than the 32bit version. I used video profile OpenGL Normal with 4 CPUs.
rodr
Junior
Posts: 29
Joined: Sun Apr 12, 2015 5:57 pm
Australia

Re: Raspberry Pi OS 64-bit and mythtv

Post by rodr »

I was just thinking about this, so very nice to see this topic. I'm optimistic about improved performance from a 64-bit mythtv frontend, having noticed that glxgears on the arm64 beta OS has 4-5 times the frame rate as on armhf.

Was wondering if 64-bit mythtv can be built for a 64-bit kernel and 32-bit userland (that is, booting the standard Raspberry Pi OS with arm_64bit=1 in /boot/config.txt). The underlying need is that I also want the same Pi 4 to be able to run chromium with Widevine support, and there is no 64-bit Widevine yet.

Any thoughts/suggestions?
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

Can't help you with this one. I normally use my RPI4 as a Mythtv-backend only and use my FireTV Stick 4K as my frontend. That way I can play anything.
rodr
Junior
Posts: 29
Joined: Sun Apr 12, 2015 5:57 pm
Australia

Re: Raspberry Pi OS 64-bit and mythtv

Post by rodr »

Yeah I'm leaning towards a RPi4 frontend because I also need it to be a VPN client and otherwise have full control over TCP/IP. Sadly it didn't work as a backend for me due to unstable support for the WinTV DualHD.
rodr
Junior
Posts: 29
Joined: Sun Apr 12, 2015 5:57 pm
Australia

Re: Raspberry Pi OS 64-bit and mythtv

Post by rodr »

Anyway I did build successfully. Dependencies:

Code: Select all

sudo apt-get install git g++ make build-essential nasm automake libtool ccache pkg-config       \
  libtool-bin uuid-dev libfreetype6-dev libmp3lame-dev libxv-dev libxxf86vm-dev libxinerama-dev \
  libxrandr-dev libxml2-dev libavahi-compat-libdnssd-dev libexiv2-dev libasound2-dev            \
  libegl1-mesa-dev liblzo2-dev libhdhomerun-dev libsamplerate0-dev libxnvctrl-dev libzip-dev    \
  libva-dev libdrm-dev libvdpau-dev libass-dev libxvidcore-dev libx264-dev libvpx-dev           \
  libbluray-bdj libavc1394-dev libiec61883-dev libpulse-dev libfftw3-dev libssl-dev             \
  libsystemd-dev libgnutls28-dev libcec-dev libbluray-dev libx265-dev libmariadbclient-dev      \
  libmariadb-dev-compat python-future python3-future python-requests python-requests-cache      \
  python3-requests python3-requests-cache python3-mysqldb python3-lxml python3-oauth            \
  python-simplejson python3-simplejson python-future python3-future python3-oauth               \
  python3-pycurl python-requests python3-requests-cache libdbi-perl libdbd-mysql-perl           \
  libnet-upnp-perl libwww-perl libio-socket-inet6-perl libdate-manip-perl libxml-simple-perl    \
  libxml-xpath-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl        \
  libjson-perl libvorbis-dev libflac-dev libflac++-dev libtag1-dev libcdio-dev                  \
  libcdio-paranoia-dev libminizip-dev qt5-default qtscript5-dev libqt5webkit5-dev               \
  libfftw3-3 libqt5sql5-mysql
Configuration:

Code: Select all

./configure --disable-vdpau --enable-opengl --disable-vaapi --enable-libmp3lame --arch=aarch64
Performance is very good, much better than my 32-bit Raspberry Pi OS experience.
gedakc
Junior
Posts: 96
Joined: Fri Jul 18, 2014 1:28 am
Canada

Re: Raspberry Pi OS 64-bit and mythtv

Post by gedakc »

@rodr did you need to overclock to get good performance?
rodr
Junior
Posts: 29
Joined: Sun Apr 12, 2015 5:57 pm
Australia

Re: Raspberry Pi OS 64-bit and mythtv

Post by rodr »

gedakc wrote:
Fri Sep 03, 2021 5:38 pm
@rodr did you need to overclock to get good performance?
Nope, no overclocking for me.
gedakc
Junior
Posts: 96
Joined: Fri Jul 18, 2014 1:28 am
Canada

Re: Raspberry Pi OS 64-bit and mythtv

Post by gedakc »

rodr wrote:
Sat Sep 04, 2021 2:32 am
gedakc wrote:
Fri Sep 03, 2021 5:38 pm
@rodr did you need to overclock to get good performance?
Nope, no overclocking for me.
That's helpful to know. I might give this another try with my RPi4 4GB. At the moment I'm using it as a MythTV backend running under Raspberry Pi OS 32-bit, but would prefer it to also work well as a frontend.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

I'm moving my Mythtv combo FE/BE that I use in the RV to Raspberry Pi OS 64 bit. I just spent a month traveling and had issues using 32 bit. If I just have the RPI 4 doing the backend and my FireTV 4K doing the Frontend it works fine, but because we didn't always have WiFi or Mobile Data, the FireTV was difficult to force Leanfront for mythfrontend to start up due to the FireTV wanting the network up. I could deal with it but my wife could not.

So I setup only the RPI4 FE and BE and that caused video breakup and RPI4 overheating and throttling. I was overclocking to get the needed performance so that was a problem.

Once I got home I put the beta of RPi OS 64 bit and built Mythtv-light from source and built the backend using Pi-utils pi-mythbackend-helper.sh that I've mentioned before.

To help with the temperature issue, I only overclocked to 1,750 Ghz and over_voltage=2. The temp stays under the throttling limit easily and the playback is very good. My test so far was recording 4 HD programs while watching one of those behind about 1 minute. Very stable picture and very watchable. I used OpenGL profile with 4 CPUs and medium quality on deinterlacing.

Tomorrow I'll move the setup back to my RV for some extensive testing before my next trip.

BTW, I use Schedules DIrect and run it late overnight when WiFi is usually available in campgrounds since most are asleep.
kzembower
Newcomer
Posts: 5
Joined: Sat Jan 23, 2021 4:42 pm
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by kzembower »

Hi, jfabernathy, Happy New Year!

Do you have a write-up of your procedures to create the RPi4 OS 64-bit MythTV backend and FireTV frontend, like you did at https://mythtv-rp4.blogspot.com/2020/11 ... rpi-4.html for a previous system? I found the really helpful, but it's time to requild my system and I'd like to use the FireTV frontend that you described.

Thanks, again, for all your help and contributions.

-Kevin Z
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

kzembower wrote:
Sat Jan 01, 2022 8:48 pm
Hi, jfabernathy, Happy New Year!

Do you have a write-up of your procedures to create the RPi4 OS 64-bit MythTV backend and FireTV frontend, like you did at https://mythtv-rp4.blogspot.com/2020/11 ... rpi-4.html for a previous system? I found the really helpful, but it's time to requild my system and I'd like to use the FireTV frontend that you described.

Thanks, again, for all your help and contributions.

-Kevin Z
I need to reset my brain as I have not worked on this is a while. The last I played with RPI4 and MythTV was testing 64bit Bullseye as both a backend and frontend. So you could use that. You can either build from source as I did or occasionally I post to my Google Drive the .deb file that I built. The frontend on Master Pre-32 has greatly improved to where I can't tell the difference between RPI4 or FIreTV 4K. You can still use FIreTV with that backend. The mythtv-backend helper script still works. Maybe a couple of defines that need to change. I'm going from memory here. Give me a day or so and I'll try to build Master on 64bit Bullseye again and post the .deb. You can read other recent posts in the Raspberry Pi sub-forum. let me know any specific questions. If you only want a backend, it's significantly easier.

That original write up you referenced still works and once you have it setup. Just use the FIreTV 4K with the side loaded .apk for mythfrontend or Leanfront and you're all set.The backend performance on the RPi4 is great so you don't need the latest unless the new V32 android frontend is better. I have not tested that.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

Here's a quick attempt for the latest instructions:

Get the Raspberry Pi OS 64 bit (Bullseye) from here:
https://downloads.raspberrypi.org/raspi ... -arm64.zip

Start with the Desktop then use raspi-config to change boot to console autologin once everything is installed.

Get my mythtv-light for Bullseye, Link to mythtv-light_32~Pre-3299-g7993f10c54-0_arm64_bullseye.deb here:
https://drive.google.com/file/d/1TdeH28 ... sp=sharing Or a newer one:
https://drive.google.com/file/d/1eSxz0I ... sp=sharing

install .deb with

Code: Select all

sudo apt install ./mythtv-light_32~Pre-3299-g7993f10c54-0_arm64_bullseye.deb
Now you need to setup database and the rest of the backend. Get these utilities:
https://github.com/MikeB2013/pi-utils
Use only the pi-mythbackend-helper.sh for installing the backend stuff, BUT modify the script as below:
change the mythtv_git_branch

Code: Select all

# Globals
mythtv_git_directory=/tmp/build
mythtv_git_branch=master 
after you setup to run console only, use the "run_mythsetup.sh" from pi-utils and setup as normal mythtv. XMLTV is also installed so you can setup that, as normal.
However, the run_mythfrontend.sh needs updating for Bullseye. My quick change version is below:

Code: Select all

#!/bin/bash

#check for any arguments on command line, if so use for mythfrontend command, so we can use different parameters
#e.g. run_mythfrontend.sh --logpath /home/pi --loglevel debug
# if no arguments set --logpath /tmp
if [ -z "$*" ] ; then
	ARGUMENTS="--logpath /tmp -O libCECEnable=0"
else
	ARGUMENTS="$*"
fi
#ASSUMING RPI4 only

echo "Starting MythTV Frontend -- this may take a few seconds -- Please wait"

echo performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

CURRENT_RES="1920x1080"
echo "Setting screen to $CURRENT_RES"

CARD="card1"

#file created everytime this script is run,avoids checking previous and current resolution everytime
bash -c "cat >/home/pi/pi_mythfrontend.json" <<ENDOFSCRIPTINPUT
{
    "device": "/dev/dri/${CARD}",
    "outputs": [
        { "name": "HDMI1", "mode": "${CURRENT_RES}" }
    ]
}
ENDOFSCRIPTINPUT

#for QT debug add to command line QT_QPA_EGLFS_DEBUG=1 QT_LOGGING_RULES=qt.qpa.*=true
QT_QPA_EGLFS_ALWAYS_SET_MODE="1" QT_QPA_PLATFORM=eglfs QT_QPA_EGLFS_KMS_CONFIG=/home/pi/pi_mythfrontend.json mythfrontend $ARGUMENTS
# fixup keyboard after exit from mythfrontend, bug in QT causes segment fault which kills keyboard input
kbd_mode -u
# restore cursor
setterm  --cursor on

exit 0
Don't forget to put in the wait for pingable stuff that Stephen did or your tuners will not be up before the backend.
https://lists.archive.carbon60.com/myth ... 986#625984 The key part of the test is below:
The fix is a bit complicated - you have to make a systemd unit that
tests for the Ethernet interface actually being up and able to pass
traffic, and then have mythbackend wait on that unit before it is
started. The tools to do this are on my web server. If you are not
running a server version of Ubuntu and have not disabled
NetworkManager, run the following commands to set it all up. Watch
out for line wrapping - my email client does that with longer lines
such as the wget commands, so the wget and the URL after it should be
on one line.
sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/wait-until-pingable.py
chmod u=rwx,g=r,o=r wait-until-pingable.py
systemctl enable NetworkManager-wait-online.service
systemctl start NetworkManager-wait-online.service
cd /etc/systemd/system
mkdir mythtv-backend.service.d
chmod u=rwx,g=rx,o=rx mythtv-backend.service.d
cd mythtv-backend.service.d
wget http://www.jsw.gen.nz/mythtv/mythtv-bac ... gable.conf
chmod u=rw,g=r,o=r mythtv-backend-wait-until-pingable.conf
cd ..
wget http://www.jsw.gen.nz/mythtv/local-netw ... le.service
chmod u=rw,g=r,o=r local-network-pingable.service
Here you will need to change the text in
local-network-pingable.service where it says "switch.jsw.gen.nz" and
replace that with the IP address or DNS name of your first network
tuner (if the tuner is pingable), or otherwise something on your
network such as your switch or router that is normally pingable when
your MythTV box is booting.
Use nano or your favourite editor:
nano local-network-pingable.service
Then save the change and exit from nano or your editor and do these
commands:
systemctl enable local-network-pingable.service
systemctl start local-network-pingable.service
systemctl status local-network-pingable.service
The systemctl status command should show that the
local-network-pingable.service has started and the ping worked. If
not, fix that before proceeding. Then do these commands:
systemctl daemon-reload
exit
After that, on boot mythbackend will wait for either the ping to work,or the 30 second timeout specified in the
local-network-pingable.service file. If you want to change that
timeout, it is the "30" after the ping address.
===================
Last edited by jfabernathy on Sun Jan 02, 2022 3:49 pm, edited 5 times in total.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Raspberry Pi OS 64-bit and mythtv

Post by jfabernathy »

I'll just add one more thing about the instructions above. I do not know if the current state of mythweb allows it to be setup by the script pi-mythbacken-helper.sh. I know I have had it working for a while since the php 8.0 fixes went in. But I have not rebuilt from fresh install in a while since all I'm doing is rebuilding mythtv-light and updating the .deb file. The new webfrontend (localhost:6544) is coming along nicely and you can do most of what I do with mythweb with that.
Post Reply