WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

TV HAT and watching UK Freeview

Sat Apr 04, 2020 11:48 am

I have been trying for the past few weeks to build a reliable system for watching the UK Freeview channels. What I have found is that decoding stops after a period of time (10 minutes to 24 hours). This has happened to me on SD and HD channels.

I have tried different RPi's (both RPi3B) and different HATs. I have also tried:
  • Raspbian + Kodi + Tvheadend
  • Raspbian + Kodi + NextPvr
  • Kodi + Tvheadend
  • OSMC + Tvheadend
  • LibreElec + Tvheadend
There is nothing obvious (to me) in the Kodi logs except that it appears that the back end (Tvheadend / NextPvr) stops providing data to Kodi, hence decoding stops. This either causes Kodi to drop back to the menu or to restart entirely.

In all cases I have increased the GPU memory to 300Mbytes.

I presume that other people have managed to get this working. What am I missing?

User avatar
DougieLawson
Posts: 38774
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: TV HAT and watching UK Freeview

Sat Apr 04, 2020 5:40 pm

What version of Raspbian?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

Re: TV HAT and watching UK Freeview

Sat Apr 04, 2020 7:19 pm

DougieLawson wrote:
Sat Apr 04, 2020 5:40 pm
What version of Raspbian?
Buster

snowballEarth
Posts: 39
Joined: Wed Feb 18, 2015 9:05 pm

Re: TV HAT and watching UK Freeview

Sun Apr 05, 2020 10:54 am

I haven't tried Kodi's Tvheadend server addon in a while.

Have you tried Tvheadend from the Raspbian repository as the backend server?

sudo apt install tvheadend

Test having the aerial and tuner feeding into a Pi, with only Raspbian Lite with tvheadend (from repo) installed for now. Then on another device on the network, install Kodi with tvheadend pvr client addon. I have that running continuously myself, separately from other devices. It doesn't drop for me, fortunately.

Could aerial reception or connections be an issue? Is it optimally positioned, if indoor aerial? Are other cables, or electromagnetic sources interfering with signal?

WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

Re: TV HAT and watching UK Freeview

Sun Apr 05, 2020 8:53 pm

snowballEarth wrote:
Sun Apr 05, 2020 10:54 am
I haven't tried Kodi's Tvheadend server addon in a while.

Have you tried Tvheadend from the Raspbian repository as the backend server?

sudo apt install tvheadend

Test having the aerial and tuner feeding into a Pi, with only Raspbian Lite with tvheadend (from repo) installed for now. Then on another device on the network, install Kodi with tvheadend pvr client addon. I have that running continuously myself, separately from other devices. It doesn't drop for me, fortunately.

Could aerial reception or connections be an issue? Is it optimally positioned, if indoor aerial? Are other cables, or electromagnetic sources interfering with signal?
Yes I have tried tvheadend as you suggest but only ever on the same device as the client. I will give that a go over the next day or two.

The aerial feed is fine. It also feeds the TV and the current PVR.

Thanks for the suggestions.

johndavies
Posts: 205
Joined: Fri Dec 20, 2013 1:00 pm

Re: TV HAT and watching UK Freeview

Mon Apr 06, 2020 2:28 pm

You can watch and even record Freeview WITHOUT using tvheadend. You do not have PVR facilities and only have a 24 hour window for recording. It is fairly easy to set up a vlc playlist which allows you to watch Freeview programmes with audio and video. Since I can record BBC programmes using get-iplayer and some of ITV 's present and past output using youtube-dl, this a minor inconvenience.
On a Raspberry Pi 3 using Stretch and the Pi TVhat with the codecs you can purchase from the Foundation vlc will only show video whereas omxplayergui (and I assume, omxplayer),mpv and mplayer will show both sound and video. You cannot install the codec on a Raspberry PI 4 with Buster so you need to convert .ts files to .mp4 ones. I use a dvb1 usb stick with this so i do not know if a Pi TVhat would do any better. The conversion process should only take a few minutes. I have written a few posts describing how I was able to find a program which could convert channels.conf into a playable vlc channels list. It may be more convenient to copy the channel data for your favourite channels. You do need to add dvb-t2 to channels which play HD channels dvbjet is the program which can copy non-overlapping programmes within a 24 hour window. You may not need to go through the process of adding HD channels to the channels.conf file. My local transmitter(uk-SuttonColdfield) did not show HD channels in its channels.conf file; yours might so check its channels.conf file. Once you have set up tvheadend it is fairly easy to use. I have recently tried using the command line more often and moved away from tvheadend because the Pi TVhat would not work from the command line when it was installed.


https://www.raspberrypi.org/forums/view ... d#p1515393


https://www.raspberrypi.org/forums/view ... t#p1544783




https://www.raspberrypi.org/forums/view ... #p1557698s

WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

Re: TV HAT and watching UK Freeview

Thu Apr 09, 2020 9:29 am

I set up a Pi0 with Raspbian (not lite though), the TV HAT and tvheadend connected to a Pi3 via USB. The Pi3 bridged from ethernet to USB for networking, which allowed access to the Pi0 from my LAN.

I installed Kodi on the Pi3 and pointed it at the Pi0 for TV services.

With this set-up, yesterday I set the Pi3 to tune to BBC1 HD and left it overnight. This morning when I checked on it, the video had frozen sometime during the night (~6am I think) although Kodi was still responsive.

Even if the aerial signal is not optimal (which I don't believe anyway), I would not expect Kodi to just stop like that but to recover. During my other experimentation, Kodi has sometimes rebooted or dropped back to the TV menu.

User avatar
DougieLawson
Posts: 38774
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: TV HAT and watching UK Freeview

Thu Apr 09, 2020 9:43 am

What have you got in /boot/config.txt on your Zero?
What's running on it?
Does it have the rootfs on a SDCard?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

Re: TV HAT and watching UK Freeview

Thu Apr 09, 2020 1:05 pm

DougieLawson wrote:
Thu Apr 09, 2020 9:43 am
What have you got in /boot/config.txt on your Zero?

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

dtoverlay=dwc2
dtoverlay=disable-wifi

DougieLawson wrote:
Thu Apr 09, 2020 9:43 am
What's running on it?
Raspbian buster and tvheadend
DougieLawson wrote:
Thu Apr 09, 2020 9:43 am
Does it have the rootfs on a SDCard?
Yes

User avatar
DougieLawson
Posts: 38774
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: TV HAT and watching UK Freeview

Thu Apr 09, 2020 2:38 pm

Where's the overlay for the TV HAT in /boot/config.txt?

Code: Select all

dtoverlay=rpi-tv
Have you run sudo apt update; sudo apt dist-upgrade -y to get Raspbian Buster up to date with the 4.19.97 kernel?

I'm sorry I can't test it here, my only spare ZeroW doesn't have any header pins soldered into it. My TV HATs run on an 3A+ and a 3B (with the 7" display).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

Re: TV HAT and watching UK Freeview

Fri Apr 10, 2020 7:09 am

I added the rpi-tv overlay when I was trying different things. I don't really need it now as the TV HAT is recognised automatically without it.

I have done an update/upgrade recently so everything should be up to date.

WhyNine
Posts: 32
Joined: Thu May 30, 2019 7:00 pm

Re: TV HAT and watching UK Freeview

Fri Apr 10, 2020 8:59 am

Kodi stopped decoding video at 2.21am this morning. I had logging turned on but there are no errors around that time. The last entries in the log file are:

Code: Select all

2020-04-10 02:19:46.453 T:1558671584   DEBUG: Previous line repeats 1370 times.
2020-04-10 02:19:46.454 T:1558671584   DEBUG: CPtsTracker: pattern lost on diff 80000.000000, number of losses 386
2020-04-10 02:19:46.520 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:19:51.695 T:1558671584   DEBUG: Previous line repeats 128 times.
2020-04-10 02:19:51.695 T:1558671584   DEBUG: CPtsTracker: detected pattern of length 1: 40000.00, frameduration: 40000.000000
2020-04-10 02:19:51.717 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:20:05.809 T:1701671136   DEBUG: Previous line repeats 351 times.
2020-04-10 02:20:05.809 T:1701671136   DEBUG: CRepositoryUpdater: busy playing. postponing scheduled update
2020-04-10 02:20:05.815 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:20:46.486 T:1558671584   DEBUG: Previous line repeats 1017 times.
2020-04-10 02:20:46.487 T:1558671584   DEBUG: CPtsTracker: pattern lost on diff 80000.000000, number of losses 387
2020-04-10 02:20:46.528 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:20:51.373 T:1558671584   DEBUG: Previous line repeats 122 times.
2020-04-10 02:20:51.374 T:1558671584   DEBUG: CPtsTracker: detected pattern of length 1: 40000.00, frameduration: 40000.000000
2020-04-10 02:20:51.445 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:21:46.685 T:1558671584   DEBUG: Previous line repeats 1379 times.
2020-04-10 02:21:46.685 T:1558671584   DEBUG: CPtsTracker: pattern lost on diff 80000.000000, number of losses 388
2020-04-10 02:21:46.725 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:21:51.533 T:1558671584   DEBUG: Previous line repeats 120 times.
2020-04-10 02:21:51.534 T:1558671584   DEBUG: CPtsTracker: detected pattern of length 1: 40000.00, frameduration: 40000.000000
2020-04-10 02:21:51.541 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:21:59.654 T:1558671584   DEBUG: Previous line repeats 191 times.
2020-04-10 02:21:59.654 T:1558671584    INFO: CVideoPlayerVideo - Stillframe detected, switching to forced 25.000000 fps
2020-04-10 02:21:59.654 T:1558671584   DEBUG: CPtsTracker: pattern lost on diff 200000.000000, number of losses 389
2020-04-10 02:21:59.671 T:1492107488   DEBUG: CMMALPool::Configure pool:0x6d93e3a0 1920x1080 (1920x1088) pix:-1 size:128 fmt:OPQV
2020-04-10 02:22:04.584 T:1558671584   DEBUG: Previous line repeats 3 times.
2020-04-10 02:22:04.584 T:1558671584   DEBUG: CPtsTracker: detected pattern of length 1: 40000.00, frameduration: 40000.000000
2020-04-10 02:22:05.809 T:1701671136   DEBUG: CRepositoryUpdater: busy playing. postponing scheduled update
Tvheadend on the Pi0 is still tuned to the mux, as can be seen in the Status->Streams.

I would expect that the Kodi log would show more than this, for example if there were errors in the stream (caused by a dodgy signal) or if it was unable to read the data from the Pi0.

Return to “HATs and other add-ons”