I use a HDHomeRun Connect to record live TV and have been struggling for a while getting a Post Processing script to run successfully, I am using FFMPEG and I believe I have it installed correctly (but I’m not 100% sure) but I consistently get “An error occurred while postprocessing the recording”
Under DSM7.0 I have the script in /volume1/@apphome/PlexMediaServer/‘Plex Media Server’/Scripts and I again believe all the permissions are set correctly.
I have no idea on how to troubleshoot this, can someone ‘give’ me a Synology script that will just do something simple like putting a customised message into a log file so I can prove that at least the script is being found and run?
This is the script I use. It save’s a log in /volume1/Media
#!/bin/bash
this is a shell script to call ffmpeg to transcode Plex videos to h264
dvrPostLog=‘/volume1/Media/DVRPostProcessing.log’
echo “=================================” | tee -a $dvrPostLog
[ $# -ge 1 -a -f “$1” ]
infile=$1
outfile=“${1%.ts}TMP.ts”
echo “date '+%Y-%m-%d'” | tee -a $dvrPostLog
echo “date '+%H:%M:%S' file ‘$1’ is opened, trying to use hardware accel.” | tee -a $dvrPostLog
echo “date '+%H:%M:%S' writing transcode to temp file: ‘$outfile’” | tee -a $dvrPostLog
#make sure you use the version of FFmpeg that is installed with the package. DSM ships with an older version that is default. Here is how to call the newer build explicitly, with hardware encoding flags: #This version directs the errors to a log file for debugging.
/var/packages/ffmpeg/target/bin/ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_device foo -hwaccel_output_format vaapi -i “$infile” -filter_hw_device foo -acodec copy -vcodec h264_vaapi -preset veryfast -loglevel info “$outfile” > /dev/null
finished with ffmpeg encode
echo “date '+%H:%M:%S' ffmpeg has finished encoding. Renamed old file to .ts” | tee -a $dvrPostLog
remove the old file; rename the converted file to .ts bc Plex wants this.
rm -f “$infile”
mv -f “$outfile” “$infile”
echo “date '+%H:%M:%S' conversion done. old file deleted. new file saved in .ts” | tee -a $dvrPostLog
Food for thought - but all I want at this stage is a simplified script that does no processing apart from putting a message in a log file, once I know the (correct) script is being executed (correctly) then I can start to build some functionality into it
I’m afraid I don’t know… usually I test the DVR scripts by SSH’ing into the Synology elevating myself to root, and running the scripts from there. Once I’m sure it’s working the last step is to put it into the GUI and test a recording.
I have SSH’d in and run the script and while it did run there was a logfile called ‘dvrProcessing.log’$’\r\r’ created which contained the line ‘testing Log creation’