Build working OpenPHT 1.9.0 from source on Ubuntu Bionic (18.04 LTS)

Recently, I have upgraded to Ubuntu 18.04 LTS and OpenPHT stopped working due to library incompatibilities. I did not have much time initially, so I used OpenPHT .AppImage from here:

However, the .AppImage version had issues with the hardware acceleration on my Intel NUC.
I was getting an error in the log: ERROR: VAAPI::CheckSuccess error: unknown libva error

Today, I had some time and was able to build OpenPHT 1.9 on Ubuntu 18.04 and it works fine.

Few years back when I first created the procedure to build OpenPHT on Ubuntu (Building OpenPHT from source on Ubuntu 14.04 ¡ RasPlex/OpenPHT Wiki ¡ GitHub), user blindy created a helpful openpht-install script using the steps to automate the process.
The instructions and script can be downloaded from here:
Ubuntu script to install OpenPHT

However blindy has not updated his script for Ubuntu Bionic yet. You can either use his script with the modifications below or use my original procedure from the wiki and add the following steps to fix the compilation errors:

I have added the following lines to the downloaded opehpht-install script right after cloning the OpenPHT repository “git pull” line :

if (( $(echo “$(lsb_release -r -s) 18.04” | awk ‘{print ($1 <= $2)}’) )); then
wget https://github.com/RasPlex/Dockerfiles/raw/master/patches/plexht-0001-cec-update-to-libcec-4.patch
wget https://github.com/RasPlex/Dockerfiles/raw/master/patches/plexht-0002-websocketpp-openssl.patch
patch -p1 < plexht-0001-cec-update-to-libcec-4.patch # libcec>=4
patch -p1 < plexht-0002-websocketpp-openssl.patch # openssl>=1.1
fi

Also, I have updated the lines building the plexhometheater.sh executable file. Check /opt/openpht/bin/openpht to see the original executable. Some paths have changed.

In the openpht-install script after “make clean” line change the lines with:

sudo sh -c “echo #!/bin/sh > ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo #sleep 30 >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo export XBMC_HOME=${OPENPHTINSTALLDIR}/share/openpht >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo export LD_LIBRARY_PATH=${OPENPHTINSTALLDIR}/lib/openpht/system/players/dvdplayer >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo #pactl suspend-sink 1 1 >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo #export AE_SINK=ALSA >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo ${OPENPHTINSTALLDIR}/lib/openpht/plexhometheater >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo sh -c “echo #pactl suspend-sink 1 0 >> ${LOADERSCRIPTDIR}/plexhometheater.sh”
sudo chmod +x ${LOADERSCRIPTDIR}/plexhometheater.sh
sudo chown $USER:$USER ${LOADERSCRIPTDIR}/plexhometheater.sh

echo ${LOADERSCRIPTDIR}/plexhometheater.sh to run OpenPHT

I use the following lines to autostart openpht after reboot in ~/.config/autostart/plex.desktop

[Desktop Entry]
Encoding=UTF-8
Version=1.9.0
Type=Application
Name=Plex Home Theater
Comment=Starts Plex Home Theater automatically
Exec=sh -c “sleep 30; /usr/bin/pasuspender – env AE_SINK=ALSA /home/plex/plexhometheater.sh”
StartupNotify=false
Terminal=false
Hidden=false

If you don’t want to use ALSA, but Pulse Audio instead, modify the Exec line above just to start /home/plex/plexhometheater.sh.
I use ALSA for SPDIF pass-through via the external USB soundcard on my Intel NUC.

Let’s hope that the developers will create official build for Ubuntu 18.04 soon, but you can use this build while you wait for the official. This build will not interfere with the official build, you can run both along side each other.

1 Like

I have found an issue with the OpenPHT menu freezing randomly after some time, affecting both my build and the .AppImage build on the Ubuntu Bionic. It could be my xorg.conf, Intel NUC or something Bionic specific, but it was not freezing before the upgrade. I also have a split VPN tunnel, but disabling it did not resolve the issue.

Items can be played fine, but the menu freezes randomly while browsing different sections or when just left overnight. I see the following messages in the logs:

08:32:28 T:140357237515584 DEBUG: OnKey: up (f080) pressed, action is Up
08:32:28 T:140357237515584 DEBUG: CGUIPlexMediaWindow::FetchItemPage for index = 14 / 26, Page (0-0)
08:32:29 T:140356360328960 INFO: NetworkService: Ignoring a packet from this uninteresting interface 127.0.0.1.
08:32:54 T:140356588754688 INFO: Previous line repeats 4 times.
08:32:54 T:140356588754688 DEBUG: CPlexGlobalTimer::Process firing callback manualServerManager - spent -1 in queue
08:32:54 T:140356588754688 DEBUG: CPlexGlobalTimer::DumpDebug ******
08:32:54 T:140356588754688 DEBUG: CPlexGlobalTimer::DumpDebug 0 - serverDataLoader (650)
08:32:54 T:140356588754688 DEBUG: CPlexGlobalTimer::DumpDebug 1 - networkServiceBrowser (185189)
08:32:54 T:140356588754688 DEBUG: CPlexGlobalTimer::Process waiting 650 milliseconds for serverDataLoader…
08:32:54 T:140355974461184 DEBUG: CPlexGlobalTimer::SetTimeout adding timeout: manualServerManager at pos 1 [60000]
08:32:54 T:140355966068480 DEBUG: Previous line repeats 1 times.
08:32:54 T:140355966068480 DEBUG: CurlFile::Open(0x7fa6d4262da0) http://127.0.0.1:32400/
08:32:54 T:140355966068480 INFO: easy_aquire - Created session to http://127.0.0.1
08:32:54 T:140355966068480 ERROR: CCurlFile::Open failed with code 401 for http://127.0.0.1:32400/
08:32:54 T:140355966068480 WARNING: CPlexManualServerManager::OnJobComplete failed to find a server on http://127.0.0.1:32400/
08:32:54 T:140355966068480 DEBUG: CPlexManualServerManager::OnJobComplete all manual server checks done, updating serverManager
08:32:54 T:140355966068480 DEBUG: CPlexServerManager::UpdateReachability Updating reachability (force=NO)

I will post if I find something, meanwhile if someone has any idea how to fix the issue I will appreciate it.

Update: The fix for the issue was to change the Vertical Blank Sync from Let the driver choose to Enabled during video playback.
I noticed that the issue only happens in Full Screen and not in maximized windowed mode. It seems like there is an issue in 18.04 between the video driver (i915 built-in the kernel) and the window manager (xfwm 4.12, compositor is disabled). Before the upgrade I did not have issues with settings Let the driver choose for the vertical blank sync.

Update 2: I have changed the Vertical Blank Sync to Let the driver choose, but created the following file (I think TearFree -> true fixed the freezing issue):
cat /etc/X11/xorg.conf.d/20-intel.conf

Section “Device”
Identifier “Intel Graphics”
Driver “intel”
#Option “SwapbuffersWait” “true”
Option “AccelMethod” “sna”
Option “TearFree” “true”
Option “DRI” “3”
EndSection

Thanks for the update. I haven’t updated my OpenPHT for years, so ill give it a shot when i get some time.

Thanks. I have been using OpenPHT 1.9 on Ubuntu Bionic 18.04 LTS for over a month now without any issues.
I have switched to using the Pulse Audio pass-through, which now seems to be working properly on the Intel NUC for me after changing the resampling frequency to 48000 in the PA daemon.conf.

Hello!
Last week I was seaching a native linux (Ubuntu) client and I found this thread.
I’ve made a fork of the OpenPHT repository with the need files to create a standard .deb packages (the debian directory and the necessary files)[1] and I’ve created two packages (18.04 & 18.10) on my ppa[2].
Source packages are available in the PPA.

The state of art will be patching the source to use the dist version of ffmpeg, maybe in a future I’ll take a look on it. :slight_smile:
Another interesting point can be producing a snap package, but I still need to study how to create them.

I’m testing the deb package right now and seems to works without any problem.

Have fun!

[1] GitHub - StefanoBalocco/OpenPHT: OpenPHT is a community driven fork of Plex Home Theater - debian/ubuntu packages fork
[2] https://launchpad.net/~stefanobalocco/+archive/ubuntu/multimedia/

2 Likes

Thanks! I’ve been looking for a 32-bit linux plex client for ubuntu 18.

However, no luck. I installed from your PPA, has a great looking splash, then dies.

Is it possible with Ubuntu to Passthrough DTS-HD and True-HD Audio?

I have generelly problems to Passthrough Audio… I setup Passthrough but not sound comes…

What can i do?

Thanks for the report. I’ve a 64-bit system so I didn’t tested on 32bit.
Which Ubuntu 18 are you using? 18.04 or 18.10?

Hello,

anyone here can help me to setup Ubuntu 18.04 to Passthrough DTS-HD and TrueHD Audio?

Nun HD Audio like DTS, Dolby Digital works… but HD Audio play´s Stereo or extrem ugly sound comes out.

What are the correct steps to set it working?

Thanks for an helping hand

I’m using 18.04 LTS…

shot-2019-04-30_14-51-23

Any ideas?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.