Master from source on Raspberry 4 4GB

For discussion of topics specific to MythTV on Raspberry Pi devices
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Master from source on Raspberry 4 4GB

Post by jfabernathy »

Since all the pubs are closed due to Covid-19 I'm spending more time experimenting with mythtv on my Raspberry Pi 4B 4GB.

So when I've installed v30 on my RPi4 I've used mythtv-light for the frontend and the helper script posted on the forum for the remaining pieces.

But if I'm building master from source do I just build mythtv as normal or do I need to use mythtv-light?

I'm just using the instructions from the wiki page https://www.mythtv.org/wiki/Build_from_Source. There are a few dated instructions like the ./configure --enable-omx-rpi does not work. but I have found that:

Code: Select all

./configure --disable-vdpau --enable-opengl --disable-vaapi

does work.
The resulting make seems to compile clean.

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

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

Just a couple of things I've noticed so far. just compiling as I stated above does produce a working backend and frontend. The helper script works for most things. Since the make install puts things in /usr/local/bin instead of /usr/bin I had to fix the systemd service to point to /usr/local/bin/mythbackend

The script didn't get mythweb working either. I'm just looking at that.

The mythtv wiki on raspberry points out some issues with v31 and running mythfrontend from the CLI. Same instructions seem to work and are needed for master.

Jim A
User avatar
pgbennett
Developer
Posts: 504
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Master from source on Raspberry 4 4GB

Post by pgbennett »

I suggest building the mythtv-light package and installing that. Instructions are here:

https://github.com/MythTV/packaging/blo ... Readme.rst
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

pgbennett wrote:
Mon Mar 16, 2020 10:44 pm
I suggest building the mythtv-light package and installing that. Instructions are here:

https://github.com/MythTV/packaging/blo ... Readme.rst
I'm going to try your suggestion next. I have had some success with treating it like building from source for an x86_64. I think my biggest issues have been related to the default make putting things in /usr/local/... and the helper script on this forum expecting things in /usr/...
There is obvious video performance issues with master and v31 on Raspberry pi 4 that were not there with v30 on RPi4.

I can see that mythtv-light was good to have when the RPi was not capable of running a combo FE/BE like the RPi4 is.
I'm just curious if you are using an Rpi4B with 4GB of DRAM why you would need a Light version?

This is more of a research project for me to educate myself. I already have a very good RPi4B 4GB running a combo FE/BE with v30 in my RV camper when I travel and it's great.
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Master from source on Raspberry 4 4GB

Post by MikeB2013 »

Current master and fixes/31 require a modified ./configure line as mythfrontend is now run from console using QT_QPA_PLATFORM=eglfs mythfrontend, but see later in this post.

For mythfrontend/backend, ignoring mythplugins for now:

Code: Select all

./configure --prefix=/usr --disable-vdpau --enable-opengl --disable-vaapi --cpu=cortex-a7 --arch=armv7 --extra-cflags=-mfpu=neon --extra-cxxflags=-mfpu=neon
Note the use of --prefix=/usr, this causes install to go in /usr/ rather than /usr/local/

Now for running mythfrontend.
Depending on the TV connected to the Raspberry Pi, it is possible that mythfrontend invoked by

Code: Select all

QT_QPA_PLATFORM=eglfs mythfrontend
may use a resolution and refresh rate which is not the best for playback and LiveTV.
This is due to qt under eglfs deciding on the resolution based on edid from the TV.
On my Pi4 connected to a 4K TV tvservice -s reports at the console:

Code: Select all

pi@pi4-20200317:~ $ tvservice -s
state 0xa [HDMI CUSTOM RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
running mythfrontend via
QT_QPA_PLATFORM=eglfs mythfrontend tvservice -s reports (via ssh from another machine)

Code: Select all

pi@pi4-20200317:~ $ tvservice -s
state 0xa [HDMI CUSTOM RGB lim unknown AR], 4096x2160 @ 30.00Hz, progressive
which will give very poor playback and LiveTV.

I have a script which resolves this issue (you may still have to set hdmi_mode and hdmi_group in /boot/config.txt depending on your TV and broadcast standard).
This script (run_mythfrontend.sh) and a companion script (run_mythsetup.sh) for mythtv-setup where mythbackend is being run on Pi4 are available from my github at https://github.com/MikeB2013/pi-utils. I suggest both scripts are put in /home/pi/ (make sure they are executable chmod +x <scriptname>). The github repository also contains an updated version of pi-mythbackend-helper.sh which automatically updates xmltv to the latest version on github.

To make mythfrontend run automatically on boot, put /home/pi/run_mythfrontend.sh as the last line in /home/pi/.bashrc

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

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

Thanks, Mike

This gives me a lot to play with today. Between this, my mythth-light builds, and celebrating St. Patrick's Day with a new fifth of Irish Whiskey, I should be busy.

Thanks again to all.

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

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

MikeB2013 wrote:
Tue Mar 17, 2020 1:00 pm
For mythfrontend/backend, ignoring mythplugins for now:

Code: Select all

./configure --prefix=/usr --disable-vdpau --enable-opengl --disable-vaapi --cpu=cortex-a7 --arch=armv7 --extra-cflags=-mfpu=neon --extra-cxxflags=-mfpu=neon
Mike
for the Raspberry PI 4 would the "--arch=armv7" be changed to "armv7l" and "--cpu=cortex-a7" be changed to "cortex-a72"

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

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

MikeB2013 wrote:
Tue Mar 17, 2020 1:00 pm
Now for running mythfrontend.
Depending on the TV connected to the Raspberry Pi, it is possible that mythfrontend invoked by

Code: Select all

QT_QPA_PLATFORM=eglfs mythfrontend
may use a resolution and refresh rate which is not the best for playback and LiveTV.
This is due to qt under eglfs deciding on the resolution based on edid from the TV.
On my Pi4 connected to a 4K TV tvservice -s reports at the console:

Code: Select all

pi@pi4-20200317:~ $ tvservice -s
state 0xa [HDMI CUSTOM RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
running mythfrontend via
QT_QPA_PLATFORM=eglfs mythfrontend tvservice -s reports (via ssh from another machine)

Code: Select all

pi@pi4-20200317:~ $ tvservice -s
state 0xa [HDMI CUSTOM RGB lim unknown AR], 4096x2160 @ 30.00Hz, progressive
which will give very poor playback and LiveTV.

Mike
I ran into this Pi4 not working at 60Hz when investigating Kodi 18 on Raspbian. A Raspbian developer said that the RP4 picks 30Hz on some 4K TVs due to not supporting some feature that some TVs like Samsung use. I was looking for a way to lock the TV/RP4 connection to 1080P because that's all my OTA content is from HDHR Duo. His answer was use another TV. Not very helpful. The link to that discussion is below:

https://www.raspberrypi.org/forums/view ... 3&t=253581

Jim A
User avatar
pgbennett
Developer
Posts: 504
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Master from source on Raspberry 4 4GB

Post by pgbennett »

jfabernathy wrote:
Tue Mar 17, 2020 1:24 am
I can see that mythtv-light was good to have when the RPi was not capable of running a combo FE/BE like the RPi4 is.
I'm just curious if you are using an Rpi4B with 4GB of DRAM why you would need a Light version?
The light version is still a full build of everything. What it excludes is setting up the database and creating services to automatically start up the backend. It also does not set up a weekly database backup. Personally I use the light package for my linux backends and frontends and set up the databases and services separately.
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Master from source on Raspberry 4 4GB

Post by MikeB2013 »

jfabernathy wrote:
Tue Mar 17, 2020 1:42 pm
MikeB2013 wrote:
Tue Mar 17, 2020 1:00 pm
For mythfrontend/backend, ignoring mythplugins for now:

Code: Select all

./configure --prefix=/usr --disable-vdpau --enable-opengl --disable-vaapi --cpu=cortex-a7 --arch=armv7 --extra-cflags=-mfpu=neon --extra-cxxflags=-mfpu=neon
Mike
for the Raspberry PI 4 would the "--arch=armv7" be changed to "armv7l" and "--cpu=cortex-a7" be changed to "cortex-a72"

Jim A
Whilst it is possible to optimse the arch, cpu and other flags specifically for Pi4 (I have not done this), at present mythtv-light builds will run on Pi2/3 and 4, hence the general optimisation.
LibreElec, for example, had the last time I looked a different set of optimisations

Code: Select all

LibreElec
# The TARGET_CPU variable controls which processor should be targeted for
  # generated code.
    case $TARGET_ARCH in
      arm)
        # Valid TARGET_CPU for Raspberry Pi based devices are:
        # arm1176jzf-s cortex-a7 cortex-a53
        if [ "$DEVICE" = "RPi" -o "$DEVICE" = "Slice" ]; then
          TARGET_CPU="arm1176jzf-s"
        elif [ "$DEVICE" = "RPi2" -o "$DEVICE" = "Slice3" ]; then
          TARGET_CPU="cortex-a7"
        elif [ "$DEVICE" = "RPi4" ]; then
          TARGET_CPU="cortex-a53"
          TARGET_CPU_FLAGS="+crc"
        fi

        # TARGET_FLOAT:
        # Specifies which floating-point ABI to use. Permissible values are:
        # soft hard
        TARGET_FLOAT="hard"

        # Valid TARGET_FPU for Raspberry Pi based devices:
        # This specifies what floating point hardware (or hardware emulation) is
        # available on the target. Permissible names are:
        # vfp neon-vfpv4 neon-fp-armv8
        if [ "$DEVICE" = "RPi" -o "$DEVICE" = "Slice" ]; then
          TARGET_FPU="vfp"
        elif [ "$DEVICE" = "RPi2" -o "$DEVICE" = "Slice3" ]; then
          TARGET_FPU="neon-vfpv4"
        elif [ "$DEVICE" = "RPi4" ]; then
          TARGET_FPU="neon-fp-armv8"
        fi
        TARGET_FEATURES="32bit"
        ;;
    esac

MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Master from source on Raspberry 4 4GB

Post by MikeB2013 »

jfabernathy wrote:
Tue Mar 17, 2020 2:25 pm
MikeB2013 wrote:
Tue Mar 17, 2020 1:00 pm
Now for running mythfrontend.
Depending on the TV connected to the Raspberry Pi, it is possible that mythfrontend invoked by

Code: Select all

QT_QPA_PLATFORM=eglfs mythfrontend
may use a resolution and refresh rate which is not the best for playback and LiveTV.
This is due to qt under eglfs deciding on the resolution based on edid from the TV.
On my Pi4 connected to a 4K TV tvservice -s reports at the console:

Code: Select all

pi@pi4-20200317:~ $ tvservice -s
state 0xa [HDMI CUSTOM RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
running mythfrontend via
QT_QPA_PLATFORM=eglfs mythfrontend tvservice -s reports (via ssh from another machine)

Code: Select all

pi@pi4-20200317:~ $ tvservice -s
state 0xa [HDMI CUSTOM RGB lim unknown AR], 4096x2160 @ 30.00Hz, progressive
which will give very poor playback and LiveTV.

Mike
I ran into this Pi4 not working at 60Hz when investigating Kodi 18 on Raspbian. A Raspbian developer said that the RP4 picks 30Hz on some 4K TVs due to not supporting some feature that some TVs like Samsung use. I was looking for a way to lock the TV/RP4 connection to 1080P because that's all my OTA content is from HDHR Duo. His answer was use another TV. Not very helpful. The link to that discussion is below:

https://www.raspberrypi.org/forums/view ... 3&t=253581

Jim A
It can be difficult to find out what your TV/Monitor supports (documentation these days from some manufacturers is poor), and can be compounded by bad edid data (again something which is quite common).

To use a 4K TV at 4K resolutions on a Pi4 you need hdmi_enable_4kp60=1 in /boot/config.txt.

To force 1080p you can set in /boot/config.txt
hdmi_group=1
and
hdmi_mode=31 #1920x1080 @50Hz
or
hdmi_mode=97 #1920x1080 @60Hz

You can get a list of what modes your TV/monitor supports
tvservice -m CEA
and/or
tvservice -m DMT

Note currently mythfrontend works fine at 1920x1080 up to 60Hz, which is the maximum for most broadcasts.
One thing you may want to try is in mythfrontend>Setup>Video>Playback>Current Video Playback Profile>V4L2 Codecs>Standard & OpenGL YV12>Decoder is set to Standard, change to V4L2 acceleration (decode only). It may give better playback quality.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

Thanks to the suggestions here I have now built a RPi4 4G with Raspbian Buster and mythtv-light_32~Pre-184-ga74700c346-1_armhf_buster

I built it using the deb-light instructions and once it completely built I installed that package. Then I used Mike's pi-mythbackend-helper.sh script to install all the other pieces. I did modify the helper script to use 'master'

I used --disable-vdpau --enable-opengl --disable-vaapi --cpu=cortex-a7 --arch=armv7 --extra-cflags=-mfpu=neon --extra-cxxflags=-mfpu=neo as my options in $HOME/.buildrc

To get the screen right I had to use hdmi_group=1 and hdmi_mode=16:9 in my /boot/config.txt to force 1920x1080P @60Hz

I set raspi-config to boot to cli with autologin and used the pi-utils-master scripts run_mythsetup.sh and run_mythfrontend.sh

I used the video settings recommended above about V4L2.

So at this point the system is usable with decent video quality. I'm just curious what changed so that it is now required to run at the CLI?

Using Mythtv v30 on RPi4 I could get this level of performance while under the X11 GUI. I had to force the GUI desktop resolution to 1920x1080, but mythfrontend worked with that and gave excellent quality on OTA 1080i and 720P recordings.
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Master from source on Raspberry 4 4GB

Post by MikeB2013 »

mythfrontend from master or fixes/31 will run under Desktop (X) but for me, I get the same issues as with V30, i.e. picture breakup during with fast panning shots and judder with rolling news straplines. Being in the UK I have DVB-T/T2/S/S2, so a mixture of mpeg2 and H.264.
These problems disappear if I run from console with eglfs and use V4L2 Codecs.

Try it from Desktop and see how it performs for you.

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

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

MikeB2013 wrote:
Wed Mar 18, 2020 10:22 am
mythfrontend from master or fixes/31 will run under Desktop (X) but for me, I get the same issues as with V30, i.e. picture breakup during with fast panning shots and judder with rolling news straplines. Being in the UK I have DVB-T/T2/S/S2, so a mixture of mpeg2 and H.264.
These problems disappear if I run from console with eglfs and use V4L2 Codecs.

Try it from Desktop and see how it performs for you.

Mike
It's interesting how the content type changes how it behaves. For me on V30 I thought things were great on the RPi4B 4GB. But I was testing only MPEG2 OTA 1080i or 720p content from HDHR Quatro/Duo. I'd hear people talk about how bad it was. My biggest issue was making sure the X11 Desktop stayed at 1080P using Preference -> Screen Configuration. At that point I tested recording 4 shows at the same time while watching a previously recorded one. These were all high quality Network broadcast. So I thought the problem was solved.
The quality of mythfrontend on fixes/31 and master without desktop is no way as good as v30 using Desktop for me and my type of content.

I'll test from Desktop on Master and see how bad it is.
User avatar
jfabernathy
Senior
Posts: 577
Joined: Wed Feb 18, 2015 2:37 pm
Location: Raleigh, NC
United States of America

Re: Master from source on Raspberry 4 4GB

Post by jfabernathy »

MikeB2013 wrote:
Wed Mar 18, 2020 10:22 am
mythfrontend from master or fixes/31 will run under Desktop (X) but for me, I get the same issues as with V30, i.e. picture breakup during with fast panning shots and judder with rolling news straplines. Being in the UK I have DVB-T/T2/S/S2, so a mixture of mpeg2 and H.264.
These problems disappear if I run from console with eglfs and use V4L2 Codecs.

Try it from Desktop and see how it performs for you.

Mike
This is interesting. I just tried what you recommended about playing a video from the Desktop. I did and it performed exactly the same as it did from console with eglfs and V4L2 Codecs.
The video is both cases has issues with high speed motion like a head shot where the person started shacking their head. It looks like the frames per second is suddenly 10-15 fps.
But this is true console or Desktop. Exactly the same on OTA MPEG2 HD content. This type of content had no issues on v30 from Desktop.
EDIT: on Desktop test I changed Preferences -> Screen Configuration to 1920x1080@60 before running mythfrontend on Desktop
Post Reply