[solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
[solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
I am noticing the playback of MPEG2 HD 1080 recording using hdhomerun not as smooth. It is definitely watchable and my family probably won't notice it because it is too obvious, but you can definitely see some artifacts in the playback.
I have the Raspberry Pi 4, 4GB running Raspian Buster with myhtv-light v31. Resolution is set to 1080p. I changed the GPU memory allocation to 256GB. Also using V4L playback profile. Enabled the openGL with fake KMS. Everything else is default. The mythlight binaries are the precompiled ones that I found on the mythtv wiki. The network is wired 1Gbps. Audio is digital passthru over HDMI.
What else can I try? Thx
I have the Raspberry Pi 4, 4GB running Raspian Buster with myhtv-light v31. Resolution is set to 1080p. I changed the GPU memory allocation to 256GB. Also using V4L playback profile. Enabled the openGL with fake KMS. Everything else is default. The mythlight binaries are the precompiled ones that I found on the mythtv wiki. The network is wired 1Gbps. Audio is digital passthru over HDMI.
What else can I try? Thx
Last edited by monkeypet on Fri May 08, 2020 3:23 am, edited 1 time in total.
- jfabernathy
- Senior
- Posts: 612
- Joined: Wed Feb 18, 2015 2:37 pm
- Location: Raleigh, NC
Re: Raspberry Pi 4 MPEG 2 HD playback not smooth
A few things. Did you have 4 CPUs chosen in the V4L profile? Also I have 320 GPU memory. Not sure if it helps.
I'd suggest that you record a few things and note where the video is a little jerky, Then install mythtv-light v30 and see if that is better. I think it is much better and you can run it as part of the RPD desktop, which is a requirement for me.
I've been told that mythfrontend up to v30 was getting hard to maintain, so with v31 the leap was done to newer methods so the code could be maintained. If that is true then I understand it may take a while before v31 on RPi will be as good as v30 which is what I observe on MPEG2 OTA HD recordings.
So in my RV Camper, I use an RPi4 as a mythtv V30 Combo FE/BE and general Linux computer, but at home, I use the Shield TV or FIreTV 4K as a frontend with a remote backend.
BTW on a clean install mythtv-light v30 has the 4 CPUs selected and uses an OpenMAX profile.
I'd suggest that you record a few things and note where the video is a little jerky, Then install mythtv-light v30 and see if that is better. I think it is much better and you can run it as part of the RPD desktop, which is a requirement for me.
I've been told that mythfrontend up to v30 was getting hard to maintain, so with v31 the leap was done to newer methods so the code could be maintained. If that is true then I understand it may take a while before v31 on RPi will be as good as v30 which is what I observe on MPEG2 OTA HD recordings.
So in my RV Camper, I use an RPi4 as a mythtv V30 Combo FE/BE and general Linux computer, but at home, I use the Shield TV or FIreTV 4K as a frontend with a remote backend.
BTW on a clean install mythtv-light v30 has the 4 CPUs selected and uses an OpenMAX profile.
Re: Raspberry Pi 4 MPEG 2 HD playback not smooth
Yeah, i am kicking myself for moving to v31 too soon, it made my very old macmini core2duo 2008 machine not usable as a frontend as it didn't support OpenGL, hence, i tried to swap in the Raspberry Pi 4. I'll try some of the suggestions and update this thread this weekend. Noticeable jitter is when there are faster changing scenes. You can see pixelation or jerkiness during the refresh.jfabernathy wrote: ↑Thu May 07, 2020 3:20 pmI've been told that mythfrontend up to v30 was getting hard to maintain, so with v31 the leap was done to newer methods so the code could be maintained. If that is true then I understand it may take a while before v31 on RPi will be as good as v30 which is what I observe on MPEG2 OTA HD recordings.
Re: Raspberry Pi 4 MPEG 2 HD playback not smooth
So i tried the following and nothing seems to improve the playback compared to prior:
1. Overclocked the Raspberry Pi from 1.7 to 2.
2. Boosted the GPU memory from 256 to 320.
3. Increased 2 to 4 CPU for the profile.
4. Changed the nice to -20 of the frontend, changed the priority to realtime 99.
5. Tried different video playback profile, nothing really made a difference.
6. Use the compton compositor, https://www.raspberrypi.org/forums/view ... p?t=246179
7. Lower the Xwindows resolution to 720p.
I verified on another mythfrontend (laptop not a Rasp Pi) watching the same clip, no issues with it.
Like i said, it isn't too noticeable. My family would probably not notice until i pointed it out.
1. Overclocked the Raspberry Pi from 1.7 to 2.
2. Boosted the GPU memory from 256 to 320.
3. Increased 2 to 4 CPU for the profile.
4. Changed the nice to -20 of the frontend, changed the priority to realtime 99.
5. Tried different video playback profile, nothing really made a difference.
6. Use the compton compositor, https://www.raspberrypi.org/forums/view ... p?t=246179
7. Lower the Xwindows resolution to 720p.
I verified on another mythfrontend (laptop not a Rasp Pi) watching the same clip, no issues with it.
Like i said, it isn't too noticeable. My family would probably not notice until i pointed it out.
Last edited by monkeypet on Fri May 08, 2020 3:21 am, edited 1 time in total.
Re: Raspberry Pi 4 MPEG 2 HD playback not smooth
I fixed it. I disabled booting into the desktop environment and instead directly started mythfrontend. It looks beautiful now. Make sure everything else is working before doing this since losing the desktop makes things a bit harder.
Configure to autologin, then create ~/.xsession file as follows
More details, https://www.mythtv.org/wiki/Raspberry_P ... ow_manager
Also try to overclock it just a bit more perfection, search for this in /boot/config.txt, change to the following, then reboot
Read more about overclocking for details. Overclock at your own risk.
Even more overclocking use the following settings
Note: I was never able to get mine to boot with a arm_freq=2147, arm_freq=2100 is unstable.
Also change max_framebuffers=1 if you are using only one HDMI output. Optional, i don't know if this affects the playback performance.
EDIT1: I am suspecting the X compositor is causing the tearing of the video playback, if you inserted the following into your .xsession, you can see the glitch returning. The following starts the X compositor. If you are seeing garbled startup https://www.raspberrypi.org/forums/view ... a97c0b4d6f in mythfrontend, you need to enable the X compositor.
EDIT2: Try to launch mythfrontend without the X server, I posted instructions below.
EDIT3: The compositor bug above was fixed. Playback performance with or without the compositor are not noticeable.
Configure to autologin, then create ~/.xsession file as follows
Code: Select all
#!/bin/bash
/usr/bin/mythfrontend
Also try to overclock it just a bit more perfection, search for this in /boot/config.txt, change to the following, then reboot
Code: Select all
over_voltage=2
arm_freq=1750
Even more overclocking use the following settings
Code: Select all
over_voltage=6
arm_freq=2000
gpu_freq=750
Also change max_framebuffers=1 if you are using only one HDMI output. Optional, i don't know if this affects the playback performance.
EDIT1: I am suspecting the X compositor is causing the tearing of the video playback, if you inserted the following into your .xsession, you can see the glitch returning. The following starts the X compositor. If you are seeing garbled startup https://www.raspberrypi.org/forums/view ... a97c0b4d6f in mythfrontend, you need to enable the X compositor.
Code: Select all
/usr/lib/raspi-config/cmstart.sh &
EDIT3: The compositor bug above was fixed. Playback performance with or without the compositor are not noticeable.
Last edited by monkeypet on Tue Feb 23, 2021 1:59 am, edited 5 times in total.
- jfabernathy
- Senior
- Posts: 612
- Joined: Wed Feb 18, 2015 2:37 pm
- Location: Raleigh, NC
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
When I run v31 on RPi4 I only run from console and I use the helper scripts that Mike did. You can find them at:
https://github.com/MikeB2013/pi-utils
https://github.com/MikeB2013/pi-utils
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
Wow, thanks so much.
Using the matchbox desktop and not using the raspbian standard one did the trick for me. I was seriously thinking about downgrading away from Myth 31 as Myth 28 on my Pi 3B+ was as smooth as silk, but the pi 4 just looked... horrible! I also swap over to the performance governor and make sure that the V4L2 was set to use all 4 CPUs.
Oh, and on initial viewing, this seems to have fixed my HD viewing as well as mpeg2
Very happy now. All I now need to do is to make a backup ISO image of my frontend's SD card in case it goes AWOL!
Using the matchbox desktop and not using the raspbian standard one did the trick for me. I was seriously thinking about downgrading away from Myth 31 as Myth 28 on my Pi 3B+ was as smooth as silk, but the pi 4 just looked... horrible! I also swap over to the performance governor and make sure that the V4L2 was set to use all 4 CPUs.
Oh, and on initial viewing, this seems to have fixed my HD viewing as well as mpeg2

Very happy now. All I now need to do is to make a backup ISO image of my frontend's SD card in case it goes AWOL!
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
Definitely Raspberry Pi 4 is a usable frontend, some issues i have seen after using it for a over a week...
1. When watching the news recording and if they have graphic overlays, you can see the overlays shaking or vibrating, but you need to observe it carefully.
2. Sometimes pixelation and shading incorrectly on some recordings.
3. Slow jumping when skipping X secs back and forward.
4. Audio/Video sync issues, but not too noticeable.
I am satisfied for now, since most of the above are nits.
1. When watching the news recording and if they have graphic overlays, you can see the overlays shaking or vibrating, but you need to observe it carefully.
2. Sometimes pixelation and shading incorrectly on some recordings.
3. Slow jumping when skipping X secs back and forward.
4. Audio/Video sync issues, but not too noticeable.
I am satisfied for now, since most of the above are nits.
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
OK, after announcing that I was happy with this solution a month ago, I've found that there is still a problem.
It mainly manifests itself on vertically-scrolling credits and doesn't bother me hugely when watching stuff, but it is still there. Running the previous myth release on my Pi 3B+ (without an MPEG2 licence) worked really well, so we must be able to find a fully-fledged solution somewhere.
It mainly manifests itself on vertically-scrolling credits and doesn't bother me hugely when watching stuff, but it is still there. Running the previous myth release on my Pi 3B+ (without an MPEG2 licence) worked really well, so we must be able to find a fully-fledged solution somewhere.
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
I am revising my claim. After using it for awhile i found these problems:
1. Starting up playback, it starts the playback, speed is wrong, need to jump back to correct and/or get the audio/video to sync.
2. Jumping back and forth 30 secs, causing audio to stop, need to restart the playback. Exiting the playback causes the audio to continue.
3. Jumping around causes the audio to go out of sync.
Not completely satisfied yet and not recommending it. See update below.
Kodi has a MythTV PVR plugin, it plays recordings beautifully, you can use it as an alternative to mythfrontend if you can't tolerate the glitchy playback in mythfrontend.
UPDATE 2/22/2021: Mostly working well. I think recent OS updates have made things better. I am changing my "NOT recommending" to cautiously recommended. I can't stand the Kodi interface, I like the native MythFrontend better.
UPDATE 6/29/2021: This is my most used mythfrontend running on a 1080p TV. It works, not perfect, but definitely usable. For a cheap frontend that mostly works and quiet, this is good. I think over the months the Raspberry Pi OS performance has improved. For the price point, it is hard to beat this, if you want a cheap frontend, definitely, try.
Alternatives I have tried includes the FireTV Stick 4k running both Kodi and Leanfront, both works out of the box. The MythTV frontend also worked however, digital audio doesn't work properly for me. I sideloaded all of these.
Last edited by monkeypet on Wed Jun 30, 2021 12:03 am, edited 2 times in total.
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
I just discovered a way to run mythfrontend without an X server. Disable the GUI desktop, using raspi-config, then login and run:
FYI: Kodi can be run this way also, replace mythfrontend with Kodi.
More detailed instructions here:
https://www.mythtv.org/wiki/Raspberry_P ... n_Raspbian
EDIT 1: When i did this, i left the overclocking, the same as I mentioned above. The results seems to be as good as the .xsession method without the compositor. There are still some glitchiness on playback, however, to notice it, you need to watch very very carefully. I also tried to play with the cpu0/cpufreq/scaling_governor switching it from ondemand to performance, however with the overclocking in place, i didn't notice any difference in the playback quality.
EDIT 2: After watching a few shows, i have concluded that both EGLFS method and the custom .xsession without compositor results in the same level of glitchiness during MPEG2 playback. Everything else including the overclocking stayed constant. The setup is still watchable.
EDIT 3: .xsession method with the compositor seems good also. They fixed the compositor bug a very long time back.
Code: Select all
QT_QPA_EGLFS_ALWAYS_SET_MODE="1" QT_QPA_PLATFORM=eglfs mythfrontend -O PowerOffTVOnExit=0 --logpath=/home/pi/logs
More detailed instructions here:
https://www.mythtv.org/wiki/Raspberry_P ... n_Raspbian
EDIT 1: When i did this, i left the overclocking, the same as I mentioned above. The results seems to be as good as the .xsession method without the compositor. There are still some glitchiness on playback, however, to notice it, you need to watch very very carefully. I also tried to play with the cpu0/cpufreq/scaling_governor switching it from ondemand to performance, however with the overclocking in place, i didn't notice any difference in the playback quality.
Code: Select all
echo performance |sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
EDIT 3: .xsession method with the compositor seems good also. They fixed the compositor bug a very long time back.
Last edited by monkeypet on Mon Jan 31, 2022 5:34 pm, edited 1 time in total.
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
Another suggestion is to try the beta 64-bit raspberry Pi OS and compile MythTV from source, I posted some quick instructions here, viewtopic.php?f=46&t=4542.
I believe moving to the 64bit Raspberry Pi OS and with overclocking. The MPEG2 playback is very smooth and no artifacts are left, it is now definitely a usable Mythfrontend. I am just launching the Mythfrontend directly from the GUI/Desktop environment. I wasn't using the EGLS or a custom .xsession methods.
I believe moving to the 64bit Raspberry Pi OS and with overclocking. The MPEG2 playback is very smooth and no artifacts are left, it is now definitely a usable Mythfrontend. I am just launching the Mythfrontend directly from the GUI/Desktop environment. I wasn't using the EGLS or a custom .xsession methods.
Re: [solved] Raspberry Pi 4 MPEG 2 HD playback not smooth
On the Raspberry Pi 4, eventually things stabilized to the point where it was usable as one of my primary MythTV frontends which I used daily. The jump forward and backwards and menu system were a bit laggy, but everything was usable.
I upgraded to the Raspberry Pi 5, after compiling v33 mythtv from the source, everything just worked smoothly out of the box with no tuning, no overclocking, menus responsive, jump forward and backward was quick. But since I had adequate cooling, I am running the Raspberry Pi 5 overclocked from 2.4Ghz to -> 2.9Ghz. Unfortunately, 3.0Ghz wasn't stable for me and kept crashing. Also I am not running 4k since my TV is just HD 1080p.
I upgraded to the Raspberry Pi 5, after compiling v33 mythtv from the source, everything just worked smoothly out of the box with no tuning, no overclocking, menus responsive, jump forward and backward was quick. But since I had adequate cooling, I am running the Raspberry Pi 5 overclocked from 2.4Ghz to -> 2.9Ghz. Unfortunately, 3.0Ghz wasn't stable for me and kept crashing. Also I am not running 4k since my TV is just HD 1080p.