Server Version#: 1.20.1
Player Version#: 3.43.3
Tuner Make/Model: Hauppuage WinTV-quadHD
Should DVR transcoding use hardware acceleration? Streaming content once it’s recorded uses hwaccel successfully. The encoders look like it would work, both are output to h264.
I have acceleration for transcoding and for video encoding ticked. I had limited the max number of transcode operations to 2, but changed to unlimited to see if that was the issue. I currently have one DVR transcode operation and it’s not using hwaccel. Would I need to restart Plex for the “unlimited” setting to take effect?
In my experience, with HW encoding/decoding enabled, plex will happily transcode the saved raw stream for any of my devices as well as transcode live TV for any device that needs it with HW transcoding. Making an optimised version of the file also uses QuickSync.
However, when enabling the “transcode while recording” option, it seems that only that transcode operation uses SW encoding and ignores the HW encoding settings completely.
I can’t fathom why there would be any difference between transcoding live TV to a client vs transcoding while recording, but it would be really nice if plex would give us HW transcoding while recording, as currently the manual step of optimising the recordings later is taking up a fair bit of admin time
I’ve got the same problem, seems to use cpu instead of HW encoder when transcoding while recording is enabled, currently when I record when transcoding the CPU on my Synology DS920+ jumps to 50% with 1 recording and 100% with 2 recordings.
Optimizing after I would like to delete the original and keep the optimized version , but it deletes both versions if I try and delete the original. I’m just trying to save some space, for the DVR I delete the shows after watching the episode. So this is difficult to do via the 10 foot interface as well.
Seems like there is no easy automated way to save space with DVR recordings.
I was playing around with a wrapper script to “Plex Transcode” to rewrite the arguments, but something with the vaapi device couldn’t be initialized. I’m not sure why because I installed ffmpeg and it can init the vaapi device.
Yes, I think the recording functionality doesn’t touch the GPUs, while my server is transcoding/recording a live stream when I run intel_gpu_top I’m seeing no activity.
It’s really sad, as I specifically upgraded my server to something with quicksync to take advantage of this for realtime transcoding and finding out it isn’t enabled is a real downer.
I did write a script for post processing that used the GPU for transcoding. Several shows were corrupted and there were errors in the kernel log. Looks like something in the driver or ffmpeg. I quit that and will use software transcoding later. So far no corruption with CPU only. Corruption can be tolerated when streaming, just start over.
I would also like to be able to use GPU transcoding “while recording.” I have a 4-tuner HDHR, and I don’t think my CPU can actually transcode all 4 streams in real time.
My question for Plex is, why not? Is there some particular challenge to using hardware for transcode in this particular case? Is there a setting in a text file somewhere that can enable this?
I have noticed the hardware transcoding does not produce as small of files as CPU. If hardware transcoding is done, I’d like an option to disable it. For my current hardware, I’d rather deal with software transcoding and get the smaller file sizes.
I used to use BeyondTV (snapstream) which allowed you to perform post processing and transcoding after the file was recorded, once the file was compressed it would give you the option of deleting the source file or keeping it. This allowed me to choose to save the original .tp file or delete the .tp and keep only the .mp4 compressed version. If that capability existed we could save the transcoded version and delete the original saving space. It also allowed you to configure the profiles to transcode to. HD or SD etc so you could choose it based on each recording.
All of the configuration was saved in the recording setting for that show or movie so it could be independently configured, or globally set defaults.
a 1 hour long show transcoded to 720p in h.264 was compressed from 8.5 GB to 1.5 GB I would watch the show and delete it once I was done.
I’m guessing something similar may be possible but this was built into the base product…
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
Hi, thanks for posting this script. Really great. I posted the prior script that you improved. Here is a version that compresses to HEVC - slower but higher quality and smaller file size - based on yours. I don’t really care that it’s slower because all of the processing is being done via hardware acceleration and so CPU utilization remains at very low levels throughout the encoding process (at least according to the Synology Resource Monitor.
#!/bin/bash
#this is a shell script to call ffmpeg to transcode Plex videos to h264
#use the hardware video chip on the synology to do the work
#script is installed in /Plex/Library/Application Support/Plex Media Server/Scripts/DVRPostprocessing.sh
dvrPostLog='/volume1/Multimedia/zScripts/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.
#this command uses the H265 / HEVC codec
/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 hevc_vaapi -p
reset fast -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
I don’t have a Synology NAS. I’m running via a Docker container on Unraid. Is there any way to use this script with the “Plex Transcoder” version of ffmpeg? I have the /dev/dri devices passed to my Docker container and HW acceleration works from within Plex itself.
After adding some sanity detection to the script so that the original file wouldn’t be deleted if a transcoded file didn’t also exist I tried and got errors saying that it couldn’t activate the vappi device. Any ideas?