I have problem with playing some files on some (most) devices. Unfortunately, I haven’t been able to get to narrow it down enough to pinpoint the source of the problem. But step by step:
Setup and versions:
I have PMS running in docker with 1.24.5.5173
Plex Web is version 4.63.0
OS: Ubuntu Server 20.04 LTS
The whole system runs on a core i5 with 32 GB of RAM
Symptoms:
On October 23rd. A friend of mine (I share my library) reported, that he cannot watch certain movies with his TV-app (until then there was never a problem). He confirmed that the same movies work on his phone-app.
Since then I gradually started noticing, that certain TV show episode are not played on certain devices. It got so bad, that by now, said episodes can only be watched on my 2015 TV plex app (last update 2018) and on plex client apps on windows (Media Server Downloads | Plex Media Server for Windows, Mac, Linux, FreeBSD and More) and linux (Plex Media Player for Linux | knapsu.eu) and on the later two only if I use direct play. AFAIK the TV Plex app is always using direct play. → Unforunately, the files affected are the more recent ones.
With the afore mentioned files playing on Android plex app or web browser are not possible even if they are set to direct play.
With “other” files transcoding and direct play is not an issue at all. Server ist nowhere near capacity even with 4 simultaneus transcodes.
Files
I wasn’t able do identify a common element in the “problematic” files. Appart from them being in general larger than the ones that work (not always consistent).
Observable Parameters
On the Dashboard in
Bandwith section the “working” files do show the “remote” line spiking to several Mbps. When I start a “problematic” file the “remote” line spikes to max 35 Kbps.
The top section “playing” will show that a problematic file is playing. After about 3 Minutes it stops.
I will try to figure out more specifics an will update the thread. If you can help in the meantime I’d appreciate it a lot.
OK, there are some posts on the net that hint to the fact that this is an issue and the developers either cannot or will not do anything about it.
So I wrote a script, to convert all my eac3 encoded files to aac:
#!/bin/bash
############### DISCLAIMER ##################
# ######### USE AT YOUR OWN RISK! ###########
# I am not a professional programmer I have tested this script on my server and it is working.
# I DO NOT TAKE ANY RESPONSIBILITY FOR LOST OR CORRUPTED DATA!
# Read the code an undestand what it does before using it.
############### why and what ################
# No matter what I did inlcuding support by PLEX-Team I could not get eac3 files getting transcoded.
# Browser and Android-App do not have a eac3 decoder. Therfore you cannot play eac3 encoded files there.
# My solution: find all files with eac3 encoding and reencode them as aac while preserving all other streams.
# This is what this script does.
#
############### requirements ################
# in order for this script to work you need to install "mediainfo" from repositories.
# "sed" and "grep" should already be installed other whise do so:
# $ sudo apt install mediainfo sed grep
# copy this file to your preferred location.
#
############### good practice ###############
# since it is a script change owner and rights as follows
# $ sudo chown root:root
# $ sudo chmod 700
#
############### run it ###############
# I use crontab to run it once a day (at 11am)
# Caution: depending on the amount of files and your computer the first run can take VERY LONG
# $ sudo crontab -e
# add line:
# 0 11 * * * /my/location/convertscript.sh
# ############## SCRIPT ##############
# my tempfolders for generated files
tempfolder=/home/stefan/docker/admin/temp/
# change to tempfolder
cd $tempfolder
# note: if you have just one folder you want to check the first loop is an overkill (just run "mediainfo")
# an array for folders you want to check an populate it
folders=(Folder1 Folder2 Folder3)
# for every folder in the array get the mediainfo of the files (goes through subdirectories too)
for i in "${folders[@]}"
do
# write path/filename and audio encoding of all files in a csv file
mediainfo "--Inform=General;%CompleteName%,%Audio_Format_List%\r\n" /path/to/files/${i} >> List.csv
done
# find all path/filename (i.e. lines in the file) that are eac3 encoded and write them to a "toconvert" file that
grep -E 'E-AC-3' List.csv > toconvert.csv
# line by line remove all text after (and including) the first coma and write it to a txt (you now have a file with path and filename of each mediafile you want to convert).
sed 's/,.*//' toconvert.csv > toconvert.txt
# set variable n to number of lines (i.e. files) to convert
n=$(grep "" -c toconvert.txt)
# converting files in a loop - changin ${n} to e.g. 10 you can control how many files get converted per run. If n < than your chosen number (e.g. 10) there will be errors but it will run.
for i in { seq 1 ${n} }
do
# set variable with the path/filename of the ith line
file=$(sed -n ${i}p toconvert.txt)
# convert the file to .temp file
ffmpeg -y -i "$file" -map 0:a? -map 0:s? -map 0:v -c:a aac -c:s copy -c:v copy -nostdin "${file}".mkv
# delete original
rm "${file}"
# rename the created *.mkv.mkv file to the just deleted one
mv "${file}".mkv "$file"
done
# delete all files in temp folder to have it empty for next run
rm $tempfolder/*.*
EAC3 (among other codecs) is handled by the EasyAudioEncoder (EAE).
In order for EAE to work correctly, the transcoder temp folder needs to be mounted without the noexec parameter.
This is the most likely cause of it not working on your system.
This isn’t a developer problem. This is an administrator problem.
The problem exists because the docker container was placed on a local drive which was not mounted with the exec option -or- was specifically mounted with the noexec option.
Moving files to one’s home directory allows it to work because /home , being part of /, has exec privilege.
File permissions and ownership are owned by plex:plex so that the codec manager can update as new updates are installed.
Changing audio codecs is a rather brute-force solution to fixing a 10-second administrative change.
I have currently 44 containers running - no way I keep up with the run command only
While I further brooding about the problem, something didn’t make sense: Why would only EAE need seperate permissions? All others work just fine… (not sure if you can answer that).
I have checked fstab. All disks are mounted with defaults explicitly. AFAIK in defaultsexec is the default value.
I do have a lot of RAM to spare (in every system I build - makes life easier). So in order to achieve fast transcoding I would like to be able to keep it there. Is this possible? Or do I have to create a RAM-disk (tmpfs /media/ramdisk tmpfs defaults,size=20% 0 0) for this? I’m going to check this next week in case you cannot answer this.
In addition, I also have hardware transcoding enabled (not shown in my code snippet).
You can use docker run or docker compose to CREATE the container.
How you administer it after that is up to you because the container is registered with dockerd
EAE needs EXECUTE permission because it is a program. All the other codecs are shared library .SO files loaded into the transcoder.
.so files can be rw.
Executables must carry their own execute bit. (755) vs (644)
The EAE is a program created by Plex, tested and approved by Dolby, using the Dolby-licensed runtme libraries. It is a fully free-standing entity.
It is for these reasons, EAE must be executable as a program.
tmpfs on /media/ramdisk type tmpfs (rw,relatime,size=16403368k)
The only thing that is actually being read from the options in fstab is the size (rw was there before I added it to the options in fstab). Any thoughts on this or shall I check linux support forums?
I copied your line (with adjusted RAM size) into fstab and changed owner of /ramdisk to my user:group for docker and permissions to 777. Still nothing.
mount gives me
tmpfs on /mnt/ramdisk type tmpfs (rw,relatime,size=16403368k)
still no exec.
So I thought I try to transcode it in my APPDATA directory which is on my main drive (should have exec right?) and shoud have the right owner and permissions… Or am I wrong with my assumption?
UUID=1 / ext4 defaults 0 0 #main drive (Samsung V-NAND SSD 883 DCT)
UUID=2 /boot/efi vfat defaults 0 0 #this was there when I setup the system, so I left it
/swap.img none swap sw 0 0 #this was there when I setup the system, so I left it
UUID=3 /var/hda/files ext4 defaults 1 2 #data storage: 4 disks 40 TB in RAID 10 i.e. 20 TB effectively
tmpfs /mnt/ramdisk tmpfs defaults,size=50% 0 0
docker-compose of plexms container (without “Service” and “Network” definition).
plexms:
container_name: plexms
hostname: my_hostname
restart: always
image: ghcr.io/linuxserver/plex #plexinc/pms-docker:plexpass
volumes:
- $APPDATADIR/plexms:/config #APPDATADIR is on /home/my_user/docker/appdata
- $APPDATADIR/plexms/transcode:/transcode2 #Testfolder to see if transcoding with EAE works on the main drive - so far no luck.
- $DATADIR/Music:/var/hda/files/Music
- $DATADIR/Pictures:/var/hda/files/Pictures
- $DATADIR/Serien:/var/hda/files/Serien
- $DATADIR/Dokus:/var/hda/files/Dokus
- $DATADIR/Audiobooks:/var/hda/files/Audiobooks
- $DATADIR/Movies:/var/hda/files/Movies
# - /dev/shm:/transcode # transcoding with EAE on RAM without specific RAM disk, "normal" transcoding works.
- /mnt/ramdisk:/transcode # transcoding with EAE on RAM with specific disk - no luck so far, "normal" transcoding works.
ports:
- "$PLEX_PORT:32400/tcp"
- "3005:3005/tcp" #probably a good idea to review these open ports.
- "8324:8324/tcp"
- "32469:32469/tcp"
- "1900:1900/udp"
- "32410:32410/udp"
- "32412:32412/udp"
- "32413:32413/udp"
- "32414:32414/udp"
- "$PLEX_WEB_TOOLS_PORT:33400"
environment:
- PUID=$PUID
- PGID=$PGID
- TZ=${TZ}
- HOSTNAME="my_hostname"
- PLEX_CLAIM_FILE=/run/secrets/plex_claim
- ADVERTISE_IP=http://${SERVER_IP}:${PLEX_PORT}/
secrets:
- plex_claim
networks:
- t2_proxy
# security_opt: #only for now. as soon as the current issue is resolved I'll enable this option again.
# - no-new-privileges:true
devices:
- /dev/dri:/dev/dri # for hardware transcoding
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.my_hostname-rtr.entrypoints=https"
- "traefik.http.routers.my_hostname-rtr.rule=Host(`plex.$DOMAINNAME`)"
## Middlewares
- "traefik.http.routers.my_hostname-rtr.middlewares=chain-authelia@file"
## HTTP Services
- "traefik.http.routers.my_hostname-rtr.service=my_hostname-svc"
- "traefik.http.services.my_hostname-svc.loadbalancer.server.port=$PLEX_PORT"
checked owner user:group on mediafile, transcoder folder (and subsolders) and even EAE folder and files - they are identical. Moreover I changed all afore metioned folders and files to chmod 777 (just to be sure; including session folder once created; I know, only necessary for folders and files that need to be written to).
Is the rabbit hole going deeper or did we explore all options by now? If so, I’ll go with my brute-force method.
Again thank you for your time and efforts - much appreciated!
→ adjusted title of thread to reflect the issue more precisely