DVR Transcode Hardware Acceleration?

Best option is to not transcode and use post processing scripts to transcode after recording. I was able to use ffmpeg on my Synology DS920 to convert the video after recording by installing a new version of ffmpeg from synocommunities package centre and use the following in a dvr processing script which I found in the forums.

used this post however the manual stuff to copy drivers is not needed.

script is installed in /Plex/Library/Application Support/Plex Media Server/Scripts/DVRPostprocessing.sh

#!/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

echo “date '+%H:%M:%S' ffmpeg has finished encoding. Renamed old file to .ts” | tee -a $dvrPostLog

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

1 Like