The extras are for direct internet access without Plex.tv in the middle. I have not educated myself on the loadbalancing part - but it is supposed to be good practice…
In the meantime I went for the nuclear option and reencoded all media files with an updated scirpt. All problems solved The scirpt still has room for imporvement/optimizations and it errors out when it finished. But it works:
#!/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)
# $ sudo crontab -e
# add line:
# 0 11 * * * /my/location/convertscript.sh
# ############## SCRIPT ##############
# my tempfolders for generated files
tempfolder=my/temp/folder
# logfile
logfile=my/log/folder/mediafilesconverted.log
# Dates and time for logfile
dt=$(date '+%d/%m/%Y %H:%M:%S')
echo "Start scirpt " $dt >> $logfile
# change to tempfolder
cd $tempfolder
# note: if you have just one folder you want to check the first loop and subsequent cat is an overkill
# an array for folders you want to check an populate it
folders=(Dokus Movies Serien)
# 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" /my/media/folder/${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 of target file where to be converted are listed listed (for while loop)
convert=/my/temp/folder/toconvert.txt
# set variable n to number of lines (i.e. files) to convert --> give you an indication how far the scirpt proceeded
i=1
n=$(grep "" -c toconvert.txt)
# converting files in a loop: while loop with integrated "read" function in "file"
while read -r file;
do
# set variable with the path/filename of the ith line
echo "File " $i " of " $n " will be converted." >> $logfile
echo $file >> $logfile
echo "Filesize " $(mediainfo "--Inform=General;%FileSize/String%\r\n" "$file")
ffmpeg -y -loglevel error -stats -i "$file" -map 0:a? -map 0:s? -map 0:v -c:a aac -c:s copy -c:v copy -nostdin "$file".mkv
echo $file "done, continue with renaming an deletion."
# delete original
if test -f "$file".mkv; then
echo ""$file" converted. Remove, rename and adjusting rights." >> $logfile
rm "$file"
# rename the *mkv.mkv file to the just deleted one setting permissions an owner correctly
mv "$file".mkv "$file"
chown user:group "$file"
chmod 755 "$file"
i=i+1
else
echo ""$file".mkv does not exist." >> $logfile
i=i+1
fi
done < $convert
# delete all files in temp folder to have it empty for next run
rm $tempfolder/*.*
echo "Endtime Script" $(date '+%d/%m/%Y %H:%M:%S') >> $logfile
Your choice to go the nuclear option, but one thing that you should remove from your script that is blatantly false is the fact that PLEX does in fact have support for transcoding the EAC3 codec to other codecs, as I see it on my server all the time.
Also, I play files all the time from my server with EAC3 audio direct on my Shield TV Pro with no issues. Browser is different as that player is always going to have limited support, but again as PLEX normally can transcode to a different codec (I just tested it and the EAC3 5.1 stream transcoded to AAC stereo), your statement is false and misleading.
If you want to keep that statement in there, you should change it to something like you cannot get EAC3 to transcode with your setup so you went with this nuclear option to re-encode everything.
Out of curiosity, as @ChuckPa tried to help you but that didn’t work, did you ever try not using RAM for your transcoding and use the default setup Plex normally uses to see if that works?
May 11, 2022 21:38:45.496 [0x7f81e7eb4b38] DEBUG - [Notify] Now watching "/var/hda/files/Serien/Zou"
May 11, 2022 21:38:45.496 [0x7f81e7eb4b38] DEBUG - [Notify] Now watching "/var/hda/files/Serien/Zou/Season 1"
May 11, 2022 21:38:45.496 [0x7f81e7eb4b38] DEBUG - [Notify] Now watching "/var/hda/files/Serien/Star Trek TNG"
May 11, 2022 21:38:45.496 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 4" (28: No space left on device)
May 11, 2022 21:38:45.497 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 6" (28: No space left on device)
May 11, 2022 21:38:45.497 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 2" (28: No space left on device)
May 11, 2022 21:38:45.498 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 7" (28: No space left on device)
May 11, 2022 21:38:45.498 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 1" (28: No space left on device)
May 11, 2022 21:38:45.499 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 3" (28: No space left on device)
May 11, 2022 21:38:45.499 [0x7f81e7eb4b38] ERROR - [Notify] Failed to add watch for "/var/hda/files/Serien/Star Trek TNG/Staffel 5" (28: No space left on device)
May 11, 2022 21:38:45.518 [0x7f81e957eb38] DEBUG - Request: [127.0.0.1:34824 (Loopback)] GET /:/plugins/com.plexapp.system/resourceHashes (8 live) GZIP Signed-in Token (akreaxun)
May 11, 2022 21:38:45.518 [0x7f81e957eb38] DEBUG - [com.plexapp.system] Sending command over HTTP (GET): /:/plugins/com.plexapp.system/resourceHashes
May 11, 2022 21:38:45.518 [0x7f81e957eb38] DEBUG - HTTP requesting GET http://127.0.0.1:40767/:/plugins/com.plexapp.system/resourceHashes
May 11, 2022 21:38:45.520 [0x7f81e7f3ab38] DEBUG - [HttpClient] HTTP/1.1 (0.0s) 404 response from GET http://127.0.0.1:40767/:/plugins/com.plexapp.system/resourceHash