Page 1 of 1

Pi3/MythLight/Stretch 1080i30 MPEG-2 OTA ATSC Playback Stutters

Posted: Sat Mar 30, 2019 9:21 pm
by jac1d
I have a feeling this may be Raspbian related rather than MythTV related. I am going to cross post my detailed post from the MythTV forums here in the hopes it rings a bell with someone who may not be a member of the Myth forum.

--
MY ISSUE: 1080i broadcast sources (stable, very few errors) do not play back smoothly on a Pi3 with MythLight.

PI HARDWARE:
[email protected]:~ $ awk '/^Revision/ {sub("^1000", "", $3); print $3}' /proc/cpuinfo
a02082

Which Google tells me is:
a02082 Q1 2016 3 Model B 1.2 1 GB (Mfg by Sony)

GPU MEMORY

I've tried 384, 320 and 256. It is now back at 256MB as none of it had any measurable affect.

From /boot/config.txt:
gpu_mem=256

BACKGROUND:

I recently moved and my .29 combined backend/frontend is no longer in the living room so I decided to set up a Raspberry Pi 3 frontend. It went surprisingly well and came together quickly using the MythLight packages referenced on the wiki/MythTV_Light

AUDIO IS PASS-THRU

I have my AC3 passing through to my soundbar over an optical SPDIF cable, and after a bit of tweaking all is well there. The Pi is connected over 100 Mbps Full Duplex ethernet to the closet where the backend is located.

MPEG-2 KEY IS INSTALLED AND CONFIRMED

I have purchased, installed and confirmed the MPEG-2 playback key.

[email protected]:~ $ !v
vcgencmd codec_enabled MPG2
MPG2=enabled

USING OPENMAX HIGH PROFILE

I have tried both OPENMAX Normal and OPENMAX High. It makes no difference on my system.

GENERAL OPERATION OF MENUS ETC IS OK - PLAYBACK STATS ARE NOT RIGHT

General operation and navigation of the system is fine, but playback is problematic. I only have OTA stations and one of them is 720p. Playback of 720p is generally smooth and occasionally it falls behind 60FPS but usually only to 58 and then immediately recoveres (using the Menu -> Playback -> Playback Stats option when watching a recording). I would say it is totally normal and acceptable.

1080i SOURCES DO NOT PLAY SMOOTHLY

All of my other source channels are in 1080i30 MPEG-2. Looking at the stats during playback, the FPS is NOT reaching 30 very often. Occasionally it meets or exceeds 30 but generally it is running in the 23-25 fps range and results in very jerky video due to the dropped frames.

RUNNING RASPBIAN STRETCH FROM STOCK NOOBS NETWORK INSTALL FROM LAST TWO WEEKS

I am running:
[email protected]:~ $ cat /etc/issue
Raspbian GNU/Linux 9 \n \l

From a stock Noobs network install.

[email protected]:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.8 (stretch)
Release: 9.8
Codename: stretch

KERNEL IS UPDATED TO 4.19 VIA RPI-UPDATE

I have updated the firmware and kernel with rpi-update per the MythLight/MythTV on Pi wiki:

(I did also try it on a fresh install without using rpi-update and still had the same issue with the original kernel and firmware)

[email protected]:~ $ uname -a
Linux raspberrypi 4.19.30-v7+ #1209 SMP Tue Mar 26 13:14:20 GMT 2019 armv7l GNU/Linux

PERFORMANCE GOVERNOR IS SET

The performance governor is set:

[email protected]:~ $ for GOV in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor; do cat $GOV; done
performance
performance
performance
performance

THE TV & CEC

The TV is a 2013 vintage Sony LCD and the output to the TV is 1080p. I have tried dropping the output resolution of the Pi to 720p60 but it makes no difference in the playback of 1080i content. The TV correctly reports the source as 720p but the dropped frames issue is identical.

I am using CEC and the stock Sony remote to control it (after programming a few of the oddly named Sony button press results in the Myth keybindings config). Works fine.

The soundbar is a Vizio 2.1 system connected over optical SPDIF and works fine with stereo or AC3 pass-through.

I HAVE TRIED VARIOUS ALSA SOUND CONFIGS AND NULL

I went back to stereo output via Also to the soundbar over optical. It made no difference in frame rate (wondering if some kind of audio processing delay was causing the video to fall behind).

I used the NULL sound device to see if removing audio would make a difference, there was no change, same 24-26 FPS performance on 1080i playback.

I have now re-enabled my AC3 pass-through. I do not believe audio is implicated due to the above tests.

KODI & SANDISK CARD

I have not installed Kodi to try it, but I have read of multiple other people reporting 1080i playback issues on Raspbian with Myth that can use a Kodi install and play the same source files without issue. I could do this but I do not believe this is a hardware issue. I am using a Canakit Pi3 with the case and heatsinks installed and a Sumsung Evo SD card and power supply they provided. All looks good. I did try a separate Sandisk high performance card when I did the clean install and it made no difference.

THE STATS DON'T LOOK RIGHT TO ME - POSSIBLY A FEW CLUES

Looking at the screen when the playback stats are up, they don't look right. I will try and take some photos on my phone and include them later today.

When watching 720p60 content the buffer size is 8MB and runs 50% full. 720p content is generally stable and smooth.

When watching 1080i30 content, the buffer size reports as 16MB and reports as being 99% free (if I am reading it correctly). Either that or it is 99% full, but I believe the wording indicates the buffer is free.

The storage to buffer throughput for 1080i30 reports as 45-50Mbps. The buffer to decoder throughput is in the 8-14 Mbps range. So the data appears to be arriving at the Pi just fine, with a few seconds in reserve, but the buffer to deoder throughput looks suspect to me as a video knowledgeable person (but not developer). I am in the Vancouver BC market and out OTA channels do not carry sub channels. I know the bit rates can run up to 17 Mbps for a single program on the video PID which makes me think the data isn't getting out of the buffer and in to the decoder fast enough. Just a hunch.

I am also aware that the 24-25 FPS playback rate range that I am seeing is very close to european broadcast frame rates (1080i25 being the norm IIRC). Being that the Pi comes from Europe I'm curious if someone has accidentally hard coded something in relation to 1080i25 or isn't properly detecting 1080i30 content. Just a shot in the dark, but it made me raise an eyebrow.

I am also aware people on earlier versions of Raspbian did not have this issue, which again makes me suspicious that something has changed (supported by the reports Kodi on OpenELEC and others can play the same recordings [but not yet shown by me, TBD]).

If anyone can provide any suggestions on where to go from here, I would greatly appreciate it.

I'll be prompt and as thorough as I can in answering background questions and trying things.

Thanks,

-Jeff

Re: Pi3/MythLight/Stretch 1080i30 MPEG-2 OTA ATSC Playback Stutters

Posted: Sun Mar 31, 2019 7:16 am
by gkreidl
Try kodi and the kodi-pvr-mythtv addon.

Re: Pi3/MythLight/Stretch 1080i30 MPEG-2 OTA ATSC Playback Stutters

Posted: Sun Mar 31, 2019 11:18 pm
by jac1d
While I appreciate the suggestion, the goal was to look in to the issue rather than completely change the software. Based on my research I am confident it will work with Kodi, but that is a fundamentally different interface and user experience than Myth Frontend on Raspbian.

Perhaps I've posted this in the wrong forum and this should be under the Raspbian Desktop OS thread? I've been away from the forum for a few years so I'm not sure how the topics/categories have evolved. Can anyone offer guidance on that?

-Jeff

Re: Pi3/MythLight/Stretch 1080i30 MPEG-2 OTA ATSC Playback Stutters

Posted: Mon Apr 01, 2019 4:34 am
by jac1d
I appear to have found a resolution to the problem. It involves disabling root prioritization (odd, as I run Mythfrontend as the user pi) as well as toggling the sound buffer option below root prioritization, and then switching between OpenMax High and OpenMax Normal. I believe there is a bug or two at play, to be determined.

The exact sequence required isn't quite clear yet, but I can switch the problem on and off by making changes to those three particular settings in some combination. For the sake of posterity and those who find this via search engines in the future, the details are in this post: https://forum.mythtv.org/viewtopic.php?f=46&t=3083

-Jeff