Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

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

Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by monkeypet »

I got "#### FFmpeg CONFIGURATION #### ERROR: mmal not found" when compiling on Raspberry Pi 4 64bit Debian Bullseye. It seems to work when I add the --disable-mmal flag to configure...

Is there a better method to make it compile? Thanks all.

Code: Select all

pi@raspberrypi:~/build/mythtv/mythtv $ ./configure
cc_default gcc ,
sed 's#@@PREFIX@@#/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install#' ffnvcodec.pc.in > ffnvcodec.pc
install -m 0755 -d '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/include/ffnvcodec'
install -m 0644 include/ffnvcodec/*.h '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/include/ffnvcodec'
install -m 0755 -d '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/lib/pkgconfig'
install -m 0644 ffnvcodec.pc '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/lib/pkgconfig'

#### FFmpeg CONFIGURATION ####
ERROR: mmal not found

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
ERROR FFmpeg configure failed

Code: Select all

pi@raspberrypi:~/build/mythtv/mythtv $ ./configure --disable-mmal
cc_default gcc ,
sed 's#@@PREFIX@@#/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install#' ffnvcodec.pc.in > ffnvcodec.pc
install -m 0755 -d '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/include/ffnvcodec'
install -m 0644 include/ffnvcodec/*.h '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/include/ffnvcodec'
install -m 0755 -d '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/lib/pkgconfig'
install -m 0644 ffnvcodec.pc '/home/pi/build/mythtv/mythtv/external/nv-codec-headers/install/lib/pkgconfig'
Last edited by monkeypet on Tue Feb 01, 2022 2:23 am, edited 1 time in total.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by jfabernathy »

I recommend building it using the packaging of deb-light. It's described at https://github.com/MythTV/packaging/tre ... /deb-light

that readme talks about a ~/.buildrc file. I use one that looks like this:

Code: Select all

MYTHTV_CONFIG_OPT_EXTRA="--disable-vdpau --enable-opengl --disable-vaapi --arch=aarch64"
before I run the build_package.sh I modify the build.sh to force 'make -j5' since you're using an RPI4 to compile.

At the end you'll have a .deb file that you can install.
User avatar
monkeypet
Junior
Posts: 49
Joined: Tue Feb 11, 2014 7:18 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by monkeypet »

I haven't tried to recompile yet. How's your performance for mpeg2 (TV recordings) on Debian Bullseye? Mine looks really bad, jerking, and news graphics will jitter also. I am going to try to recompile mythtv this weekend.
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by mythpi »

We're running our front ends on 64-bit Pre~32 on a 4 GB Pi4 (I have a separate 8GB backend). I've compiled using options similar to jfabernathy's. We watch HD hockey broadcasts with no noticeable stutter or tearing. Our TVs are not 4K, though, just 1080p. We don't run X on any of those systems.

The only problems I've been having are audio cutting out when resuming play from fast-forward (only on one machine), and not getting current position stamped into playback (if you exit playback, then resume, it returns to the beginning). I haven't had time to look at either one in any depth.
User avatar
monkeypet
Junior
Posts: 49
Joined: Tue Feb 11, 2014 7:18 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by monkeypet »

mythpi wrote:
Fri Jan 21, 2022 3:15 pm
We're running our front ends on 64-bit Pre~32 on a 4 GB Pi4 (I have a separate 8GB backend). I've compiled using options similar to jfabernathy's. We watch HD hockey broadcasts with no noticeable stutter or tearing. Our TVs are not 4K, though, just 1080p. We don't run X on any of those systems.

The only problems I've been having are audio cutting out when resuming play from fast-forward (only on one machine), and not getting current position stamped into playback (if you exit playback, then resume, it returns to the beginning). I haven't had time to look at either one in any depth.
Yeah, I have a similar setup but running in X and overclocked, but still looks horrible. I'll play around more this weekend. For now, I am using kodi and the mythtv PVR plugin, playback looks fine on it.
User avatar
monkeypet
Junior
Posts: 49
Joined: Tue Feb 11, 2014 7:18 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by monkeypet »

Playback is less jerky if I just start mythfrontend from the .xsessions file instead of booting into the full desktop.

Configure to autologin, then create ~/.xsession file as follows

Code: Select all

#!/bin/bash
/usr/bin/mythfrontend
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by mythpi »

This puzzles me. I keep seeing people referring to overclocking, etc., and having trouble with jerky playback. But that doesn't match my experience.

I don't overclock, and am not even using the performance scaling_governor (it's set to ondemand).

My pi_mythfrontend.json looks like this:

Code: Select all

{
    "device": "/dev/dri/by-path/platform-gpu-card",
    "outputs": [
        { "name": "HDMI1", "mode": "1920x1080@60" }
    ]
}
And my command to start mythfrontend boils down to this:

Code: Select all

QT_QPA_EGLFS_ALWAYS_SET_MODE="1" QT_QPA_PLATFORM=eglfs QT_QPA_EGLFS_KMS_CONFIG=./pi_mythfrontend.json mythfrontend --noupnp --logpath /tmp
Which I invoke using the following systemd unit file so that I can restart it over ssh:

Code: Select all

[Unit]
Description=MythTV Frontend Service
Documentation=https://github.com/MythTV/mythtv
After=network-online.target
Wants=network-online.target
Requires=network.target

[Service]
WorkingDirectory=/home/pi
ExecStart=/bin/bash /home/pi/bin/run_mythfrontend.sh
Restart=always
User=pi
Group=pi
StartLimitInterval=180
StartLimitBurst=3
RestartSec=5

[Install]
WantedBy=multi-user.target
All run after booting to the command line (no X server running). I'm using an "OpenGL Normal" profile.
System config uses vc4-kms-v3d with max_framebuffers=2, and both are hard-wired (1Gb) connections.

Most playback is smooth and tear-free (including HD hockey broadcasts), although I have a minor issue with audio dropping out sometimes on hitting play after fast forwarding (only on one of 2 frontends). Oh, and forgot to mention both TVs are 1080p.

Hope this helps someone...
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by jfabernathy »

Thanks for posting your working solution. The way you run mythfrontend is the same as the way I do it. However, I have not figured out how to autostart. Your systemd unit is what I was looking for.

I also agree that overclocking does not really help mythfrontend. All it did for me was raise the temperature to the point that I had to add a fan instead of the passive case I was using.

I have had issues with this method on 4K UHD TVs. The QT_QPA_PLATFORM=eglfs command fails about half the time. It's random at least on my system. However, if I use a FHD TV instead it works 100%.
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by mythpi »

Check your pi_mythfrontend.json. If you're still using the MikeB script, it uses "/dev/card0" or "/dev/card1" for the device.

What I found was that on Bullseye/64 it was switching back and forth between the two as the active unit seemingly at random, and that using "/dev/dri/by-path/platform-gpu-card" grabbed the currently in use one every time.

Every once in a while I get a situation where the menus seem to be very slow to fade in and out. I simply restart mythfrontend and the problem goes away (note that my systemd unit is currently set to auto-restart, so I simply exit mythfrontend using the remote, and it comes back in about 10 seconds).

Glad I could help you, as your posts have helped me a few times :D
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by jfabernathy »

mythpi wrote:
Sun Jan 30, 2022 1:51 am
Check your pi_mythfrontend.json. If you're still using the MikeB script, it uses "/dev/card0" or "/dev/card1" for the device.

What I found was that on Bullseye/64 it was switching back and forth between the two as the active unit seemingly at random, and that using "/dev/dri/by-path/platform-gpu-card" grabbed the currently in use one every time.
The use of "/dev/dri/by-path/platform-gpu-card" really solved my problem. I'll try to go back and fix some of my guides on the forum that I posted back before bullseye. That may avoid some confusion for other. Thanks again.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by jfabernathy »

mythpi wrote:
Sun Jan 30, 2022 1:51 am
Every once in a while I get a situation where the menus seem to be very slow to fade in and out. I simply restart mythfrontend and the problem goes away (note that my systemd unit is currently set to auto-restart, so I simply exit mythfrontend using the remote, and it comes back in about 10 seconds).
So I just started noticing the slow menu phenomenon. And restarting by exiting mythfrontend does fix it but I noticed a weird problem which may be related to my remote. When I exited mythfrontend, I saw on the screen the RPI4 console and on it was showing the output from a previous command I had entered. I think that during the exit and restart that any up arrow that inadvertently got pressed caused a previous command to be executed on the console. I think I solved it sort of but stopping the mythtv-frontend.service and then entering a series of commands that really do nothing but display to the console like ls, vdir, or ps. How I noticed this was when I was using the remote in mythfrontend and it suddenly stopped running. When I looked at the console I saw the sudo systemctl stop mythtv-frontend.service command I had entered during the last session.

Currently, I'm just chalking this up to weird and hoping I have it working now. The remote I'm using is a Logitech Harmony Smart hub remote and basically acts as keyboard. So if I'm at a console prompt, the up arrow will bring up the last command and select will execute it.
User avatar
monkeypet
Junior
Posts: 49
Joined: Tue Feb 11, 2014 7:18 pm
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by monkeypet »

mythpi wrote:
Sat Jan 29, 2022 9:26 pm
This puzzles me. I keep seeing people referring to overclocking, etc., and having trouble with jerky playback. But that doesn't match my experience.

I don't overclock, and am not even using the performance scaling_governor (it's set to ondemand).
Thanks for sharing this. I think the main difference is that you are running mythfrontend without X whereas, I am running it with X. I tried to run it in the full desktop environment but it was choppy/jerky after I upgraded to bullseye. So I disabled the full desktop environment and run it from the .xsession file which disables the full desktop environment but still in Xwindows. This configuration works and playback is smooth.

However, I am still overclocking since i haven't reverted the overclock yet.
rodr
Junior
Posts: 29
Joined: Sun Apr 12, 2015 5:57 pm
Australia

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by rodr »

For what it's worth I built fixes/31 on the 64-bit official Bullseye release with:

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                           \
  libmariadb-dev-compat python3-future                                                          \
  python3-requests python3-requests-cache python3-mysqldb python3-lxml python3-oauth            \
  python3-simplejson python3-future python3-oauth                                               \
  python3-pycurl 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 qtscript5-dev libqt5webkit5-dev                           \
  libfftw3-3 libqt5sql5-mysql
and

Code: Select all

./configure --disable-vdpau --enable-opengl --disable-vaapi --enable-libmp3lame --arch=aarch64
It seems stable as just a frontend with the full desktop GUI but I've not done extensive testing yet. No overclocking.

What's also very nice is that the same OS can run Chromium 32-bit with Widevine (packages chromium-browser:armhf and libwidevinecdm0). Have tested that with YouTube TV.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by jfabernathy »

FYI, I saw that the Raspberry PI OS 64bit is now out of beta and this should bring better support for MythTV on the RPI4.

https://www.raspberrypi.com/news/raspbe ... os-64-bit/

In that article is mention of the WidevineCDM and how to switch between 32 and 64 bit versions of Chromium.
The 64-bit version of Chromium, installed by default, has no version of the WidevineCDM library and therefore, it is not possible to play streaming media such as Netflix or Disney+. To instead choose the 32-bit version just do the following within a terminal window:

sudo apt install chromium-browser:armhf libwidevinecdm0
To return to the 64-bit version

sudo apt install chromium-browser:arm64 libwidevinecdm0-
I have not built mythtv on the release version of RPI OS 64, but the last time I did on beta, I used ansible to install all the dependencies and it worked fine. I've been reporting issues with the mythtv ansible package and I think all have been fixed.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Trouble compiling mythtv on Raspberry Pi4 Debian Bullseye 64bit

Post by jfabernathy »

This morning I created a SATA SSD with Raspberry PI OS 64bit using the newly release production version and then installed MythTV frontend and backend on it. Works great.

1. The dependencies can be satisfied using ansible following the information on the Building From source wiki page.https://www.mythtv.org/wiki/Build_from_Source and the MythTV Ansible github page. https://github.com/MythTV/ansible

2. I built the mythtv-light package which I like better than just building the source. I following the guide at https://github.com/MythTV/packaging/tre ... /deb-light

3. My .buildrc file has this in it:

Code: Select all

MYTHTV_CONFIG_OPT_EXTRA="--disable-vdpau --enable-opengl --disable-vaapi --arch=aarch64" 
4. After that completes I just install the newly created packages using sudo apt install ./mythtv-light_whatever-the-filename-is

5. If you want the backend use the pi-mythbackend-helper.sh from the pi-utils.
https://github.com/MikeB2013/pi-utils

6. For my build, I modified pi-mythbackend-helper.sh and changed the variable for mythtv branch to fixes/32 and I changed the php variable to 7,4

7. After I rebooted, I setup XMLTV for schedules direct and configured mythtv-setup using another pi-utils script, run_mythsetup.sh

8. only real thing left for the backend is putting in an override.conf for mythtv-backend.service so it will wait for the networked tuners to initialize.

9. I've been doing a lot of this setup using the Desktop environment, but I now use sudo raspi-config to setup boot into console only with autologin. In fact I usually just use ssh to do all the setup and keep the pi in console mode all the time. But is nice to have the capability to startx and have the full desktop for doing a few things like Bluetooth setup for my remote.

The mythfrontend should be run using a script previously discussed above.viewtopic.php?f=46&t=4741&p=23399#p23382
Post Reply