Transcoding error when playing video files with preloaded subtitles

As recommended by ChuckPa here I am creating a seperate forum to discuss this new issue after my upgrade to the DSM 7 PMS package.

  • Synology: DS918+
  • DSM: DSM 7.0-41222
  • Plex Version 1.21.0.3744

Steps to reproduce:

  1. Open Plex and pick a movie from the homescreen
  2. Verify that the subtitles have automatically been preloaded. (opensubtitle/Sub-zero subtitle agents)
  3. Click play
    Result:

When changing the subtitle to none or using the Search function to pick one, it seems to play.

Dec 08, 2020 14:29:40.061 [0x7ff5c7d11700] ERROR - [Transcode] Error configuring transcoder: TPU: Failed to download sub-stream to temporary file
Dec 08, 2020 14:29:41.180 [0x7ff5c688f700] WARN - [Transcode] Denying access to transcode of key /library/metadata/3713 due to terminated session
Dec 08, 2020 14:29:41.208 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Dec 08, 2020 14:29:41.208 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Dec 08, 2020 14:29:41.208 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Dec 08, 2020 14:29:41.208 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Dec 08, 2020 14:29:41.209 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Dec 08, 2020 14:29:41.209 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Dec 08, 2020 14:29:41.209 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Dec 08, 2020 14:29:41.209 [0x7ff5c7d11700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Dec 08, 2020 14:29:41.283 [0x7ff5c6e6b700] ERROR - Couldn't find the file to stream: /volume1/@apphome/PlexMediaServer/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitles/en/com.plexapp.agents.opensubtitles_58034482b8e67577ffbe1e12e3c730edae2fd99e.srt
Dec 08, 2020 14:29:41.283 [0x7ff5c57d3700] ERROR - [Transcode] Error configuring transcoder: TPU: Failed to download sub-stream to temporary file
Dec 08, 2020 14:29:42.319 [0x7ff5c6e6b700] WARN - [Transcode] Denying access to transcode of key /library/metadata/3713 due to terminated session
Dec 08, 2020 14:29:42.460 [0x7ff5c6e6b700] ERROR - Unknown metadata type: folder
Dec 08, 2020 14:29:42.546 [0x7ff5c688f700] ERROR - Unknown metadata type: folder
Dec 08, 2020 14:29:43.506 [0x7ff5c6e6b700] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring.
Dec 08, 2020 14:29:43.517 [0x7ff5c6e6b700] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring.
Dec 08, 2020 14:29:43.545 [0x7ff5c57d3700] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring.

(File removed)

I have the same issue on DSM 7 beta on DS218+ (x86_x64) package

Hi Trumpy,

I have disabled HDR tone mapping and made sure hardware transcoding and acceleration was enabled.
I’m afraid this did not resolve my issue. In the attachments you can find the logs again.

(File removed)

Edit:

I notice that other movies work again!! :grinning_face: Thanks!

However for some reason Freaky won’t stream with subtitles enabled. Perhaps this is a srt support thing on this case?

Hi Trumpy,

Thanks for that info. Would you say that this could be related to upgrading from DSM 7 preview to DSM 7 beta?

The things that have changed as in making it no longer work are:

  • Using subzero for subtitles (disabled now)
  • Upgrading from DSM 7 preview to DSM 7 beta
  • Installing PMS for DSM 7 beta.

It appears to me that the error occurs on .mkv files. Plex is listing them as (SRT External)
I cannot find any srt file in any of the folders though. Are they cached somewhere in Plex? I am also unable to delete the subtitle by using the x icon next to the subtitle to delete it.

Hello Trumpy,

I am trying to understand your side of the story, but can’t help thinking this is related to the newest PMS.

I have never encountered any transcoding issues before, and there are movies that played before that are now giving errors when leaving it on default subtitles.

If what you say is true, and my NAS does not support ‘burnt in’ subtitles, doesn’t that mean, it should also not have worked before the update?

I have never stripped subtitles from SRT before and have often used the included subtitles from an mkv file.

Moderator: Please do NOT ping employees unnecessarily, thank you.

Hi Trumpy81,

I do not understand why you are addressing me with such a rude tone.
I am simply stating that I now have an issue that I did not have before. Is it so weird that I am asking for a proper explanation?

The only change that I did was a upgrading DSM 7 preview to beta, and the old PMS to the new PMS. The PMC is the same as before. with exactly the same settings. I see you are telling me why it should not work, but I’d like you to explain to me why I never had any of the said issues before. Also never had any stuttering issues.

As for you editing my tag, I was simply doing it based on ChuckPa advising someone with exactly the same issue as I have to do. Read here

Kind regards,
Tobias

Hello,
I have the same problem.
Under DSM 6.2 and the last PLEX server version, I had no problems with the transcoder.
Now with DSM 7.0 and the latest Plex Server version, the transcoder no longer works.
As soon as I try to use it, an error message appears.
Here is the error message again (in German)

Attached is the log file of the transcoder error.

(File removed)

@megabytes.

Make certain PlexMediaServer has permission to write to the transcoder temp directory you’ve assigned.

Dec 10, 2020 21:28:36.782 [0x7fc4f11cd700] DEBUG - Request: [192.168.1.72:65241 (Subnet)] GET /video/:/transcode/universal/dash/zp7h60wwbsety2swoitbw0i6/0/initial.mp4 (9 live) GZIP Signed-in
Dec 10, 2020 21:28:36.807 [0x7fc4e111f700] ERROR - [Transcoder] Could not write header for output file #0 (incorrect codec parameters ?): Permission denied
Dec 10, 2020 21:28:36.807 [0x7fc4e111f700] ERROR - [Transcoder] Error initializing output stream 0:0 -- 
Dec 10, 2020 21:28:36.830 [0x7fc4f31a3700] DEBUG - Jobs: '/volume1/@appstore/PlexMediaServer/Plex Transcoder

@Darkrogue looking over your logs I see PMS is failing to load the subtitle.srt file from the local metadata cache into it’s transcoder cache.

Dec 08, 2020 14:29:41.283 [0x7ff5c6e6b700] ERROR - Couldn't find the file to stream: /volume1/@apphome/PlexMediaServer/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitles/en/com.plexapp.agents.opensubtitles_58034482b8e67577ffbe1e12e3c730edae2fd99e.srt
Dec 08, 2020 14:29:41.283 [0x7ff5c57d3700] ERROR - [Transcode] Error configuring transcoder: TPU: Failed to download sub-stream to temporary file
Dec 08, 2020 14:29:42.319 [0x7ff5c6e6b700] WARN - [Transcode] Denying access to transcode of key /library/metadata/3713 due to terminated session
Dec 08, 2020 14:29:42.460 [0x7ff5c6e6b700] ERROR - Unknown metadata type: folder
Dec 08, 2020 14:29:42.546 [0x7ff5c688f700] ERROR - Unknown metadata type: folder
Dec 08, 2020 14:29:43.506 [0x7ff5c6e6b700] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring.
Dec 08, 2020 14:29:43.517 [0x7ff5c6e6b700] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring.

Do you mind SSH’ing into your NAS and providing the output to the following two commands?

sudo ls -ilha "/volume1/@apphome/PlexMediaServer/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitles/en/"

sudo synoacltool -get "/volume1/@apphome/PlexMediaServer/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitles/en/"

[quote=“ChuckPa, post:15, topic:663349”]
Could not write header for output file #0 (incorrect codec par
[/quote

Unfortunately, that is not the problem.

Here are the permissions for the drive

drwxr-xr-x 1 root root 518 Dec 10 20:44 @appstore

drwxr-xr-x 1 PlexMediaServer PlexMediaServer 368 Dec 9 10:39 PlexMediaServer

-rwxr-xr-x 1 PlexMediaServer PlexMediaServer 271440 Dec 8 06:41 ‘Plex Transcoder’

@megabyte0469

On DSM 7:

  1. @appstore = Code only (old /var/packages/Plex Media Server/target)
  2. @apptemp = New default temp directory (where the transcoder temp is now)

Where do you have the Plex temp directory defined to be?

What you show above is for the code. It has nothing to do with the Transcoder temp directory (the file being written)

Hello,
thank you very much.
That was the problem. I didn’t think about that anymore :wink:
In the settings for the transcoder there was a directory.
“Temporary directory
”
I have now deleted this. Now nothing is entered.


I have now deleted that.
Without a temp directory in the settings the transcoder works now. You are not allowed to enter anything here ?!

Hi Wingman,

Thank you for your response. Here is the output:

root@Synology-NAS:~# sudo ls -ilha "/volume1/@apphome/PlexMediaServer/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitles/en/"
total 4.0K
5998348 drwx------+ 1 PlexMediaServer PlexMediaServer 154 Dec  7 22:42 .
5998347 drwx------+ 1 PlexMediaServer PlexMediaServer   4 Dec  7 22:42 ..
5998349 lrwxrwxrwx  1 PlexMediaServer PlexMediaServer 237 Dec  7 22:42 com.plexapp.agents.opensubtitles_58034482b8e67577ffbe1e12e3c730edae2fd99e.srt -> '/volume1/Plex/Library/Application Support/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitle Contributions/com.plexapp.agents.opensubtitles/en/58034482b8e67577ffbe1e12e3c730edae2fd99e.srt'

root@Synology-NAS:~# sudo synoacltool -get "/volume1/@apphome/PlexMediaServer/Plex Media Server/Media/localhost/4/cf38671bf7cb014eec5b23db2aa4773dbf43adc.bundle/Contents/Subtitles/en/"
ACL version: 1
Archive: is_inherit,is_support_ACL
Owner: [PlexMediaServer(user)]
---------------------
         [0] user:PlexMediaServer:allow:rwxp-DaARWc--:fd-- (level:8)

@megabyte0469

We are allowed to enter something there on Synology –

The challenge is “What are we allowed as we change from ‘Plex’ to ‘PlexMediaServer’?”

May we use it this way for now and then, when we are more stable, discover what we can do on DSM 7 ?

Thank you @Darkrogue I am looking into how best to solve this issue you have. I will get back to you soon

1 Like

If I, in any way, can help by granting you ssh or plex access. Let me know.

Thanks!

Hey Wingman,
Have you had a chance to look into this yet? I am not in a rush but am very curious of I can help out in resolving this.

Thanks!

Kind regards,
Tobias

Hi there,

The issue is to do with old absolute symlinks vs the newer relative ones. I’m working with Chuck to see if we can “update” these during migration.

One thing you can try doing is ssh into your NAS

  1. Do ‘sudo -i’ to switch to root
  2. Do ‘su PlexMediaServer’ to switch to the PMS user
  3. Edit the ‘/var/packages/PlexMediaServer/scripts/start-stop-status’ file and add “DISABLESYMLINKS=1” into the list of other environment variables.

You will need to ensure the syntax of the export/environment file is preserved.

That should fix those files.

Hey Wingman, I cannot seem to sign in using PlexMediaServer.

root@Synology-NAS:~# su PlexMediaServer
su: failed to execute /sbin/nologin: No such file or directory

I can probably change it from the root account though. I’m guessing I’ll need to fix permissions after that?
I have changed the file with the following and used :
chmod g+w /var/packages/PlexMediaServer/scripts/start-stop-status

root@Synology-NAS:~# cat /var/packages/PlexMediaServer/scripts/start-stop-status
#!/bin/sh
# Start-Stop-Status - DSM 7

# DSM version variables
DSM_VERSION="$(get_key_value /etc.defaults/VERSION productversion)"
DSM_BUILD="$(get_key_value /etc.defaults/VERSION buildnumber)"
DSM_UPDATE="$(get_key_value /etc.defaults/VERSION smallfixnumber)"

# Identification variables
PMS_INFO_VENDOR="Synology"
PMS_INFO_DEVICE="$(get_key_value /etc.defaults/synoinfo.conf unique|cut -d'_' -f3|sed 's/^ds/DS/;s/^fs/FS/;s/^rs/RS/'|sed 's/^\([0-9]\)/DS\1/')"
PMS_INFO_MODEL="$(uname -m)"
PMS_INFO_PLATFORM_VERSION="DSM $DSM_VERSION.$DSM_BUILD-$DSM_UPDATE"

# Service variables
PID_FILE="$SYNOPKG_PKGTMP/plexmediaserver.pid"

server_start ()
{
  # Verify optional PLEX_MEDIA_SERVER_LOG_DIR is still valid if in use
  if [ -r "$SYNOPKG_PKGDEST/PlexMediaServerLogDir" ] && [ -d "$(cat "$SYNOPKG_PKGDEST/PlexMediaServerLogDir")" ]; then

    # Prepare to use
    export PLEX_MEDIA_SERVER_LOG_DIR="$(cat "$SYNOPKG_PKGDEST/PlexMediaServerLogDir")"

    # Ignore if not writable.
    [ ! -w "$PLEX_MEDIA_SERVER_LOG_DIR" ] && unset PLEX_MEDIA_SERVER_LOG_DIR
  fi

  # Set service environment
  export DISABLESYMLINKS=1
  export LC_ALL=en_US.utf8
  export LANG=en_US.utf8
  export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
  export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="$SYNOPKG_PKGHOME"
  export PLEX_MEDIA_SERVER_DEFAULT_PREFERENCES='HardwareAcceleratedCodecs=true&TranscoderCanOnlyRemuxVideo=false'
  export PLEX_MEDIA_SERVER_INFO_VENDOR="$PMS_INFO_VENDOR"
  export PLEX_MEDIA_SERVER_INFO_DEVICE="$PMS_INFO_DEVICE"
  export PLEX_MEDIA_SERVER_INFO_MODEL="$PMS_INFO_MODEL"
  export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$PMS_INFO_PLATFORM_VERSION"
  export PLEX_MEDIA_SERVER_PIDFILE=$PID_FILE
  export PLEX_BROWSER_NO_HOME_DIR=1
  export TMPDIR="$SYNOPKG_PKGTMP"
  ulimit -s 3000

  # Spawn service binary
  "$SYNOPKG_PKGDEST/Plex Media Server" >> /dev/null 2>&1 &

  # Wait for service status
  wait_for_status 0

  # Verify server status
  server_status
  return $?
}

server_stop ()
{
  if [ -r "$PID_FILE" ]; then
    PID=$(cat "$PID_FILE")

    kill -TERM "$PID" >> /dev/null 2>&1
    wait_for_status 1 || kill -KILL "$PID" >> /dev/null 2>&1

    [ -f "$PID_FILE" ] && rm -f "$PID_FILE" >> /dev/null 2>&1
  fi

  return 0

  # PMS has been asked nicely to shut down, now verify.
  Pids="$(ps -ef | grep Plex | awk '{print $2}')"

  Count=10
  Sig=-9

  while [ "$Pids" != "" ] && [ $Count -gt 0 ]
  do
    # Kill what's still running
    kill $Sig $Pids
    sleep 5

    # Look again
    Pids="$(ps -ef | grep Plex | awk '{print $2}')"
    Count=$(($Count -1))

    # Force them down if our last iteration
    if [ $Count -eq 1 ]; then
    Sig=-11
    fi
  done
  return 0
}

server_status ()
{
  # If no PID file, it's stopped (1)
  [ ! -f "$PID_FILE" ] && return 1

  # Return true (0) if PID file exists
  [ -d /proc/`cat "$PID_FILE"` ] && return 0

  # The PID file is pointing off to something bad. (implied stopped state)
  return 1
}

wait_for_status ()
{
  counter=20 # 20 seconds
  while [ ${counter} -gt 0 ]; do
    server_status
    [ $? -eq "$1" ] && return
    counter=$((counter-1))
    sleep 1
  done
  return 1
}

case $1 in
  start)
    if server_status; then
      echo "Plex Media Server is already running"
      exit 0
    else
      echo "Starting Plex Media Server ..."
      server_start
      exit 0
    fi
    ;;

  stop)
    if server_status; then
      echo "Stopping Plex Media Server ..."
      server_stop
      exit 0
    else
      echo "Plex Media Server is not running"
      exit 0
    fi
    ;;

  status)
    if server_status; then
      echo "Plex Media Server is running"
      exit 0
    else
      echo "Plex Media Server is not running"
      exit 3
    fi
    ;;
  *)
    exit 1
    ;;
esac

Restarted plex using the package manager, but still getting the transcoding message.