PlexPostProc Script Error # 1 : Failed to convert using ffmepg

I was having the same problem as OP and I got it working for myself. The problem lies with this:
export LD_LIBRARY_PATH=/usr/lib/plexmediaserver

The version of zlib in Plex’s library is not compatible the ffmpeg that I have installed. (Maybe one is newer than the other – I don’t know because I’m not going to look into it now that it is working)

So here is my complete, working script:

#!/bin/bash
 
(
FILENAME=$1     # %FILE% - Filename of original file
TEMPFILENAME="$(mktemp)" # Temporary File for transcoding
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
export LD_LIBRARY_PATH
 
ffmpeg -y -i "$FILENAME" -f lavfi -i "movie=$FILENAME[out0+subcc]" -map 0 -map 1:s -c:a copy -c:s srt -c:v libx265 -crf 23 -preset faster -f matroska "$TEMPFILENAME"
 
rm -f "$FILENAME" && mv -f "$TEMPFILENAME" "${FILENAME%.ts}.mkv"
)
 
exit 0

Just a couple things I want to point out:

  1. I am loading my default library path for my system. This may be different for other people.
  2. I’m wrapping most of the code inside parentheses, which creates a subshell because that will prevent the library setting from interfering with Plex’s parent process.

I hope this helps.

1 Like