RPI4, HDHomerun, UK Freeview ...

Do you want advice about what hardware to buy for use with MythTV? Ask here.

Moderator: Forum Moderators

lynnux
Junior
Posts: 19
Joined: Thu Sep 05, 2019 10:16 pm
Great Britain

RPI4, HDHomerun, UK Freeview ...

Post by lynnux » Tue Sep 10, 2019 10:09 am

I'm in the UK and replacing an 8 channel, mythtv 27, Linux Mint16, Freeview SD only, PC based system.

The proposed system needs to be able to record 4 UK Freeview HD channels (minimum), use Raspberry Pi's, possibly an HDHomerun Quatro tuner and be able to ad-cut and display HD recordings on a 4K and an old but good "HD Ready" TV.

Here's a picture from my mind's eye:
RPI4 Mythtv.gif
RPI4 Mythtv.gif (37.33 KiB) Viewed 964 times
Can any kind soul answer any of these questions for me please?
1. With my old system I split 4 SD DVB-T streams into 8 channels (multi-rec). Can mythtv do the same with HDHR DVB-T2 streams?
2. The HDHR sits on an ethernet switch without access to the internet. I assume it doesn't need to "call home" if used with mythtv?
3. I've put in a usb pctv stick just for EIT schedules as I don't want to use xmltv. Is this stick necessary or can myth get its EIT from the HDHR streams?
4. I've separated the 4K TV's myth frontend from the backend. I have no feel for whether an RPi4 (4Gb) is up to the job of running both?
5. It would be nice (eventually) to watch HD live TV on the "HD Ready" TV. I'm not sure how that would work without bridging eth0 and wlan0 on the RPI4?
6. I used to get bad recordings in certain weather conditions with my old DVB-T usb sticks. The DVB-T2 tuners in the 4K TV never have such problems. Can I safely assume the HDHR has similarly capable tuners?
7. I haven't found any hard tech. info. on the HDHR; just marketing stuff really. Any links gratefully received.

Thanks for any pointers, thoughts, alternatives ...

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Thu Sep 12, 2019 10:38 am

Can't answer about HDHR, but I have a Raspberry Pi4 (4GB) as a combined frontend/backend system with network tuners see viewtopic.php?f=46&t=3232#p15870

This was into a 4K TV but with Pi4 limited to 1080p output using legacy graphics (/boot/config.txt having hdmi_group=1 hdmi_mode=31)

As far as ad-cut (commercial flagging ?) is concerned, this has always been problematic for me on UK Freeview. I have not spent anytime trying to get it to work, I just setup frontend to use forward and reverse skip buttons to go past the commercials.

On Pi running Buster (and Stretch) commercial flagging runs (cannot speak for accuracy) for HD (h264) but fails on SD with segmentation faults, this appears to be arm architecture related, I have raised a mythtv trac ticket on this see https://code.mythtv.org/trac/ticket/13476

It should be noted that the current mythfrontend has not been optimised in anyway for the Pi 4 or Pi3 with Raspbian Buster. So anything higher than 1080p is not really viable at present, but of course this is also the maximum on current UK Freeview.

As a final point my Pi4 (4GB) is running with active cooling .i.e. a fan.

Mike

lynnux
Junior
Posts: 19
Joined: Thu Sep 05, 2019 10:16 pm
Great Britain

Re: RPI4, HDHomerun, UK Freeview ...

Post by lynnux » Tue Sep 17, 2019 8:06 am

Hi Mike, many thanks for the excellent info. and many apologies for the delay in replying (no email notifications on this forum it seems).

> 7 simultanous HD recordings 4 recordings on 1 tuner, 3 recordings on the other tuner.
Wow! I had no idea that was possible. Was that just by setting 4 channels per multiplex in capture card setup?

>This was into a 4K TV but with Pi4 limited to 1080p output using legacy graphics (/boot/config.txt having hdmi_group=1 hdmi_mode=31)
Very interesting. My old PC frontend automatically runs the HDMI output at 1080p 60Hz. Any reason not to use hdmi_group=1 hdmi_mode=16 ?

>As far as ad-cut (commercial flagging ?) is concerned, this has always been problematic for me on UK Freeview. I have not spent anytime trying to get it to work, I just setup frontend to use forward and reverse skip buttons to go past the commercials.
I spent a bit of time getting ads to cut well using link deleted/wiki/Commercial_detection_with_silences. It was well worth it as it rarely gets things wrong with defaultish presets (see attachment) on the commercial UK channels I watch (Yesterday & Channel 4).

>On Pi running Buster (and Stretch) commercial flagging runs (cannot speak for accuracy) for HD (h264) but fails on SD with segmentation faults, this appears to be arm architecture related, I have raised a mythtv trac ticket on this see link deleted
That's saved me a lot of disappointment! Thanks. [strike]Does the failure happen with or without an mpeg2 license? I'm guessing you'd need it for SD even though the MPEG2 copyright has now lapsed in the UK.[/strike]

>It should be noted that the current mythfrontend has not been optimised in anyway for the Pi 4 or Pi3 with Raspbian Buster. So anything higher than 1080p is not really viable at present, but of course this is also the maximum on current UK Freeview.
1080p is good enough for me!

>As a final point my Pi4 (4GB) is running with active cooling .i.e. a fan.
Yes indeed. A test without any heatsink using my HD TV stick using VLC showed the CPU temp in the high 70s C very quickly. (I think the on-board regulator got even hotter.)

My hard disk and HDHomerun have just arrived. I shall be running them up soon with the help of your very useful scripts - BIG thanks for those Mike!

Bob
Attachments
silence.preset.txt
(3.85 KiB) Downloaded 4 times
Last edited by lynnux on Tue Sep 17, 2019 9:10 am, edited 1 time in total.

lynnux
Junior
Posts: 19
Joined: Thu Sep 05, 2019 10:16 pm
Great Britain

Re: RPI4, HDHomerun, UK Freeview ...

Post by lynnux » Tue Sep 17, 2019 9:07 am

@MikeB2013
Sorry Mike, Ignore my question re commflag and MPEG2 license - I just looked at your gdb log and can see it's clearly not that.
Bob

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Tue Sep 17, 2019 11:16 am

There is no mpeg2 license for Pi4, the processor cores are capable of decoding mpeg2 in software.

Later versions of mythtv (29,30 and on) have Max Recording (aka multirec) setting in mythtv-setup>Input Connections>Interactions between Inputs, the setting used to be in Capture Cards Recording options from memory. Default for Max Recordings is 1, I usually set to 5 or 10 depending on input type. My VBOX Network tuners can max out built-in cpu processing capacity at around 5 per tuner (I can set it higher but it can lead to bad recordings due to processor overload in the VBOX). For native tuners e.g. USB sticks, PCI-e tuner I usually set to 10, this potentially ignores other limitations such as disk i/o, network bandwidth. One of my VBOX units has 4 tuners, but only a 100Mbit/s network interface, so I limit Max Recordings to 5 per tuner (allowing 20 simultaneous recordings, which if it ever happened would likely saturate the network interface).

Based on past experience, I have just used 50Hz to match UK broadcast . If you see picture judder every few seconds at 60Hz try changing to 50Hz. My TVs are setup to "just scan" on the hdmi input.

Forum reply emails are off by default, you can subscribe on a per forum basis.

Mike

lynnux
Junior
Posts: 19
Joined: Thu Sep 05, 2019 10:16 pm
Great Britain

Re: RPI4, HDHomerun, UK Freeview ...

Post by lynnux » Wed Sep 18, 2019 7:56 am

Many thanks for those nuggets Mike.

Framerate: I shall experiment. My old system and TV exhibited motion tearing which I never entirely eliminated and put down to lack of kosher Nvidia drivers. The tearing just disappeared with the new TV - it seems to handle anything with consummate ease.

Forum subs: I just clicked the "Topic Tools" -> Subscribe topic . The notification shows in the User Control Panel but, so far , nothing in my inbox. Not a biggie though.

blm-ubunet
Junior
Posts: 81
Joined: Sun Jun 15, 2014 1:08 am
Cambodia

Re: RPI4, HDHomerun, UK Freeview ...

Post by blm-ubunet » Sun Sep 22, 2019 9:41 pm

Off topic but you mentioned Nvidia & tearing & I assume VDPAU..

Video tearing with nvidia VDPAU is indicative of driver using Blitter instead of Overlay mode.
VDPAU (nvidia) only guarantees tearfree video if using Overlay.

Blitter results from using a composited desktop.. composite manager that does not understand "Un-Redirect Full Screen" or is broken (mate mutter etc).
Mate's Compton can work okay but it isn't pain free.
A lot of the desktop composite managers do not interoperate well with Nvidia in particular so that's why people recommend basic simple desktops like xfce for HTPC on linux.

You can turn on the HUD in nvidia-settings to reveal bits of that.

lynnux
Junior
Posts: 19
Joined: Thu Sep 05, 2019 10:16 pm
Great Britain

Re: RPI4, HDHomerun, UK Freeview ...

Post by lynnux » Wed Sep 25, 2019 10:03 am

Thanks @bim-ubunet, it was a long time ago but I don't think I ever got VDPAU working with that old PC. In fact I got so traumatised with Nvidia graphics I've never bought any Nvidia kit since!

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Fri Sep 27, 2019 5:30 pm

Can now confirm having obtained SiliconDust HD HomeRun CONNECT QUATRO model HDHR5-4DT with firmware 20190621 that it works very well using mythtv backend on Pi 4, and reasonably on Pi 2 and Pi 3. Ethernet speed on Pi 2 and Pi 3 limit number of simultaneous recordings due to ethernet being on the USB 2 bus.

I recommend two changes in mythtv-setup Capture Card :
Increase Signal timeout from default of 1000 to at least 5000, slows channel scanning but it is more reliable for signals from my local transmitter - UK Freeview SandyHeath.

Increase Tuning timeout from default of 3000 to 10000, just to cover the cases when multiple recordings start at the same time, under some load conditions the recorder can be marked as failed, this does not happen often. The higher value of 10000 does not affect normal operation as the timeout is cancelled as soon as tuning is achieved.

These changes are not limited to HD HomeRun, but apply, in my experience, to all types of DVB-T/T2 tuners (USB, PCI-e).

Mike

lynnux
Junior
Posts: 19
Joined: Thu Sep 05, 2019 10:16 pm
Great Britain

Re: RPI4, HDHomerun, UK Freeview ...

Post by lynnux » Sat Sep 28, 2019 11:51 am

@MikeB2013
Thanks for the info / advice, much appreciated.
Yes, the HDHR is working EXTREMELY well for me too on Pi 4.
So far I've managed to simultaneously record 5 HD channels and watch one of them (pseudo Live TV) all on one Pi4.

Random Setup Notes:
  1. I have found ad-detection/pre-roll (silence.py) works well on SD & HD content; runs quickly too.
  • I ripped off the heatsink from an old PC gpu and stuck it on the Pi. Drops the temp. by ~30'C. Max temp viewing HD with OpenMax High Quality ~59'C @ 21'C ambient. Multiple simultaneous recordings make little difference to temp.
  • Just watching Live TV (no recordings or any other load) works well for a few minutes then gets progressively jerky and becomes unusable. Memory usage (htop) rises at the same time. Recording and then watching (replaying) the program a few seconds later works well though.
  • Setting up RPI3B+ mythfrontend (192.168.1.80) to use RPi4 backend (192.168.1.107) results in frontend Mythsocket Failed to connect ... (127.0.0.1:6543) despite the normal setup procedures - strange as netstat reports established connection for mysqld. Early days though...
  • Channel Icons - Downloading failed miserably. Not a one! Fixed up by manually copying icons from old setup and fixing channels table with mysql workbench - oof!
  • Something somewhere is regularly driving the Pi4 (4GB) into swap, which is 55MB currently and rising. From the helper script this will now be on /var/swap on hard disk so no biggie but it isn't right. It seems to happen overnight. No crontab jobs. Probably not mythtv. /etc/dphys-swapfile-> CONF_SWAPSIZE=100 To be investigated.
  • Just noticed several of these HDHR errors in mythbackend.log:
    Sep 28 09:52:22 RPI-MYTHTV mythbackend: mythbackend[29234]: E HDHRStreamHandler mpeg/mpegstreamdata.cpp:336 (AssemblePSIP) MPEGStream[5](0xffffffffa827c230): Error: AFCOffset(4)+StartOfFieldPointer(181)>184, pes length & current cannot be queried
    Doesn't seem to cause much trouble. Maybe related to BBC FOUR off air during the day? TBI
  • I'm still not certain how many channels you can record with the HDHR Quatro (certainly greater than 4) or how to set Capture Card/Video Sources/Input Connections correctly.
    So far I have:
    1 USB Stick Capture Card
    2 HDHR Capture Cards using the same HDHR Quatro
    1 Video Source (USB Stick)
    1 Video Source (HDHR0)
    1 Input Connection (USB Stick)
    2 Input Connections both using HDHR0 (Interaction between Inputs = 4)
    This is a mess because I had to setup icon entries in the channel table for identical channels from 2 video sources (USB and HDHR). I shall remove the USB Stick Capture card altogether , it's not necessary and performs poorly compared with the HDHR.
Bob

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Sat Sep 28, 2019 2:22 pm

1. Channel Icons, are a pain with OTA, mythtv used to get them from a web site, but the web site changed their terms of use which prevented downloading of the icons.

2. "Sep 28 09:52:22 RPI-MYTHTV mythbackend: mythbackend[29234]: E HDHRStreamHandler mpeg/mpegstreamdata.cpp:336 (AssemblePSIP) MPEGStream[5](0xffffffffa827c230): Error: AFCOffset(4)+StartOfFieldPointer(181)>184, pes length & current cannot be queried"

This is a common message and is not restricted to HD HomeRun, I see it often on other tuner types. It can be ignored.



3. "Setting up RPI3B+ mythfrontend (192.168.1.80) to use RPi4 backend (192.168.1.107) results in frontend Mythsocket Failed to connect ... (127.0.0.1:6543) despite the normal setup procedures - strange as netstat reports established connection for mysqld. Early days though..."

I presume you see the mythfrontend startup screen, selecting Search should find the Pi 4 mythbackend (using upnp). If for some reason it still does not work check the following using mythtv-setup on the Pi4 (use sudo systemctl stop mythtv-backend)
1. General>Host Address Backend Setup>
Security Pin (required) is set to 0000
Primary IP address /DNS Name is set to the ip address 192.168.1.107 (select it from the dropdown)
Exit saving changes and start mythbackend (sudo systemctl start mythtv-backend)
If PI3 still cannot connect (I have never has this)
create a config.xml file on the PI3 as follows:

Code: Select all

mkdir -p ~/.mythtv
cd .mythtv
create a file called config.xml with the following contents change localhost to the ip address 192.168.1.107

Code: Select all

<Configuration>
  <LocalHostName>my-unique-identifier-goes-here</LocalHostName>
  <Database>
    <PingHost>1</PingHost>
    <Host>localhost</Host>
    <UserName>mythtv</UserName>
    <Password>mythtv</Password>
    <DatabaseName>mythconverg</DatabaseName>
    <Port>3306</Port>
  </Database>
  <WakeOnLAN>
    <Enabled>0</Enabled>
    <SQLReconnectWaitTime>0</SQLReconnectWaitTime>
    <SQLConnectRetry>5</SQLConnectRetry>
    <Command>echo 'WOLsqlServerCommand not set'</Command>
  </WakeOnLAN>
</Configuration>
or copy it from /etc/mythtv/config.xml on the Pi4

Mike
Last edited by MikeB2013 on Sat Sep 28, 2019 3:06 pm, edited 1 time in total.

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Sat Sep 28, 2019 2:33 pm

For "Something somewhere is regularly driving the Pi4 (4GB) into swap, which is 55MB currently and rising. From the helper script this will now be on /var/swap on hard disk so no biggie but it isn't right. It seems to happen overnight. No crontab jobs. Probably not mythtv. /etc/dphys-swapfile-> CONF_SWAPSIZE=100 To be investigated."

You need the swap file on the hard disk and the other stuff in /var/, otherwise your micro SD card can wear out.
It is safe to increase the CONF_SWAPSIZE to 2048 from 100, although I am not seeing much use of swap and I am building mythtv from source on my Pi4 as well as running it as a backend.

There is one mythtv job which runs daily, the mythtv-database daily backup, which unless you have setup Storage Group for db_backups will go in /srv/mythtv/recordings/.

Mike

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Sat Sep 28, 2019 3:04 pm

Here is how I setup Capture Cards, Video Source and Input Connections for my HDHomeRun.
If you already have Capture Cards defined, you can safely "Delete all capture cards", do not use "Delete all capture cards on xxxx", no need to rescan as the tuning data is held under the Video Source.
I fully configure each Capture Card including Video Source and Input Connections before moving onto the next Capture Card.
For each HDHomeRun Tuner
a) Capture Card: New capture card
b) Create Video Source (only needed once per Capture Card type), if already created skip this
c) Input Connections: I set Display name (optional),video source,Interactions between inputs>Max Recordings

For Interactions between inputs, I have Max Recordings set to 10 on my Pi4, with Schedule as group unchecked.
It is possible to leave Max Recordings set at 1 and check Schedule as a group, this allows mythtv to automatically add virtual tuners to satisfy recording load. I have not done any extensive testing on this newer configuration option.

You can safely delete any previously created Video Source which is now unused, by moving down to it so it is highlighted and then press "m" key, at which point you have the option to edit or delete.

Mike

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Sat Sep 28, 2019 4:07 pm

"I ripped off the heatsink from an old PC gpu and stuck it on the Pi. Drops the temp. by ~30'C. Max temp viewing HD with OpenMax High Quality ~59'C @ 21'C ambient. Multiple simultaneous recordings make little difference to temp."

I hope OpenMax High Quality is just a typo, as I only see OpenMax Normal on my Pi4 (or Pi3, Pi2) running Raspbian Buster.

"Just watching Live TV (no recordings or any other load) works well for a few minutes then gets progressively jerky and becomes unusable. Memory usage (htop) rises at the same time. Recording and then watching (replaying) the program a few seconds later works well though."

This looks like a settings issue on Pi4 and/or mythfrontend.
For the Pi4 the default uses OpenGL DRM VC4 V3D driver on top of the dispmanx display stack (vc4-fkms-v3d) which allows use of Normal or High Quality video playback, you can select OpenMax Normal but although it appears to work it does not and falls back to using software decoding using ffmpeg for everything.

To use the legacy graphics mode OpenMax Normal, like that on Pi 3 or Pi2, you need to turn off vc4-fkms-v3d. This is done using sudo raspi-config>7 Advanced Options>A7 GL Driver> G1 Legacy
You also need to set gpu_mem to 128 or greater I use 320, again this is in raspi-config>7 Advanced Options> A3 Memory Split

You might also need, depending on your TV, to turn off overscan, again raspi-config 7 Advanced Options> A2 Overscan
After using raspi-config you need to reboot for these changes to be effective.

Now for mythfrontend

Use Setup Wizard as normal to set Audio (leave at default) and Video use OpenMAX Normal, Finish to save settings.

Then move down to Video>Playback>Current Video Playback Profile (should be set to OpenMAX Normal) >openmax & openmax>
Max CPUs to 4,
Primary deinterlacer to Linear Blend.

Primary deinterlacer of Advanced (HW) is known to cause problems.

Don't forget to add "echo "performance" |sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" to the end of your .profile file. This changes the cpu governor from "ondemand" to "performance" which minimises screen judder.

Mike

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

Re: RPI4, HDHomerun, UK Freeview ...

Post by MikeB2013 » Sat Sep 28, 2019 4:15 pm

One thing you might also want to do on the Pi4 is run sudo rpi-update which will bring in the latest firmware and kernel. I would not normally recommend this, but the Pi4 is a fast moving target for changes as bugs are being found and fixed. The firmware and kernel from rpi-update are in advance of the usual distribution update through sudo apt update and sudo apt upgrade.

Mike

Post Reply