Closed rprihoda closed 3 years ago
I may have to play more with VAAPI. My first reaction is... I cannot test it since I do not have an Intel GPU at my disposal. But, VAAPI is an open standard, so perhaps it would even work with my nVidia GPU?
Regardless, here is an untested version of the file. You may want to give it a try and report back. Hopefully, the worst that will happen is the HW accel will fail and it will revert to SW. Logs are appreciated.
https://github.com/cedarrapidsboy/pms-postprocessing/blob/qsv_encoding/transcode_internal.sh
I'll test it soon and report back, thanks.
Update: Tested and failed back to software encoding.
20200908-130738 [U2KLMrLy] INFO: transcode_internal.sh : Starting postprocessing for /mnt/tv/.grab/aac0aecc884a881eea2b7d992df15e185eb8b205-3340ab8fb90c4e22f7b40e1f2f86245a6f122315/KXAN News at Noon (2007) - 2020-09-08 12 00 00 - KXAN News at Noon.ts.
INFO - FFMPEG_EXTERNAL_LIBS: /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Codecs/96550d8-3281-linux-x86_64/
mpeg2video 1920 1080
29.97
INFO - De-interlace filter: ""
INFO - Framerate: 29.97
INFO - Calculated bitrate: 4474
INFO - Encoding buffer (3x): 13422
INFO - Dimensions: 1920 x 1080
20200908-130827 [U2KLMrLy] INFO: transcode_internal.sh : Video and audio transcoding starting.
INFO - Max bitrate (2x): 8948
20200908-130827 [U2KLMrLy] DEBUG: transcode_internal.sh : /mnt/tv/.grab/aac0aecc884a881eea2b7d992df15e185eb8b205-3340ab8fb90c4e22f7b40e1f2f86245a6f122315/KXAN News at Noon (2007) - 2020-09-08 12 00 00 - KXAN News at Noon.ts;mpeg2video;1920;1080;29.97;;4474;8948;13422.
20200908-130827 [U2KLMrLy] WARNING: 1 : transcode_internal.sh : Fail-over to libx264.
20200908-132649 [U2KLMrLy] INFO: transcode_internal.sh : Transcoding complete. /tmp/transcode.CyjZdZVt.mkv created.
20200908-132649 [U2KLMrLy] INFO: transcode_internal.sh : Remuxing /tmp/working.sqXv19Ew.mkv into /tmp/transcode.59pV9F78.mp4.
20200908-132707 [U2KLMrLy] INFO: transcode_internal.sh : Moved /tmp/transcode.59pV9F78.mp4 to /mnt/tv/.grab/aac0aecc884a881eea2b7d992df15e185eb8b205-3340ab8fb90c4e22f7b40e1f2f86245a6f122315/KXAN News at Noon (2007) - 2020-09-08 12 00 00 - KXAN News at Noon.mp4.
20200908-132708 [U2KLMrLy] INFO: transcode_internal.sh : Original file format not wanted. Removed /mnt/tv/.grab/aac0aecc884a881eea2b7d992df15e185eb8b205-3340ab8fb90c4e22f7b40e1f2f86245a6f122315/KXAN News at Noon (2007) - 2020-09-08 12 00 00 - KXAN News at Noon.ts.
20200908-132708 [U2KLMrLy] INFO: transcode_internal.sh : Postprocessing completed. Removed /tmp/transcode.59pV9F78.mp4.
Thank you for confirming that. I'm interested in it, but won't be able to do a lot of work on it unless I can setup an easy test bed. A couple things I don't know... can I setup my nvidia system to use vaapi? If so, can Plex's vaapi encoder then be tested with an nvidia chipset? I'll post back here if I make any progress.
No progress. I did try moving my Plex Pass system over to a NAS that has the minimum QSV-compatible CPU (J1900), but could not get Plex to do any hardware transcoding, period. The video device was available to it (/dev/dri/card0|renderD128), it simply wouldn't do it. So, afraid with no way to locally test QSV or VAAPI, I'll be unable to work this request.
No problem. I understand. If I get any free time I'll try and do some work on it.
Sorry to revive this issue. I stumbled upon it looking for something else and couldn't help my curiosity since I needed QSV support a while ago. I'm posting this in case other people end up here looking for a solution or you have some more time to look into "officially" supporting QSV.
After some research at that time, I was able to make QSV work by using this command :
/usr/lib/plexmediaserver/Plex\ Transcoder -y -hide_banner \
-init_hw_device vaapi=intel:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device intel -filter_hw_device intel -i "${WORKINGFILE}" \
-vf 'format=vaapi,hwupload' -c:v h264_vaapi -b:v ${BITRATE}k -maxrate:v ${BITMAX}k -profile:v high \
-bf:v 3 -bufsize:v ${BUFFER}k -preset:v hq -forced-idr:v 1 ${DEINT} \
${AUDIOPARMS} \
"${TEMPFILENAME}" > >(tee -a "${LOGFILE}") 2> >(tee -a "${ERRFILE}" >&2)
It might be needed to add an environment variable for the path to the render driver (-init_hw_device vaapi=intel:/dev/dri/renderD128
) in case other people have a different configuration. I hard coded it in my version since that was my setup.
I'm still interested. I'll take your code for a test run soon. Thanks.
Most Plex users use intel chips and with plex pass the hardware encoding feature uses Quick Sync to transcode. I was wonder if there was any chance of adding QSV support or at least test for it like you do with the nvidia encoder and use it if present. Example transcode with QSV: