PlexPostProc icon indicating copy to clipboard operation
PlexPostProc copied to clipboard

feature request - add HW accelleration

Open imzenreally opened this issue 2 years ago • 4 comments

i'm tinkering and trying to see if i can get it working - but currently am unable to test because my nvidia quadro is sitting on the shelf and won't be delivered until my buddy travels across contry - figured it would make life much easier when using h265 as your encoding choice

thought i might reach out to see if you are already looking at using hwaccel - but im a wicked ffmpeg novice and since i don't have a test bed yet ....

imzenreally avatar Feb 13 '22 03:02 imzenreally

Yeah, I haven't tested this because I don't have the hardware, but it's conceivably possible. If running inside the docker, then you'd have to expose the hardware device (probably), and the right version of FFMPEG installed. But otherwise, looks like it should work with the hwaccel argument: https://trac.ffmpeg.org/wiki/HWAccelIntro

nebhead avatar Feb 14 '22 17:02 nebhead

FYI, I assume this is about HW accelleration for ffmpeg, but using the hardware acceleration via the Plex Transcoder w/NVENC works for me with my nvidia quardro. However, I am not using a docker install, and am running Plex directly on my Ubuntu 20.04 machine. Because of that, I did have to change lines 46-48 to:

     export FFMPEG_EXTERNAL_LIBS="$(find /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/ -name "libmpeg2video_decoder.so" -printf "%h\n")/"
     check_errs $? "Failed to convert using smart Plex Transcoder (NVENC). libmpeg2video_decoder.so not found."
     export LD_LIBRARY_PATH="/usr/lib/plexmediaserver:/usr/lib/plexmediaserver/lib/:/usr/lib/x86_64-linux-gnu"

note the full path to Library/Application Support since $PLEX_HOME doesn't exist in my install, and also adding 'usr/lib/x86_64-linux-gnu' to the LD_LIBRARY_PATH since that is where my libcuda.so.1 was located.

nhickster avatar Apr 15 '22 00:04 nhickster

Not sure but I think you can add a version that applies to your HW accelerator

For mine I just use Intel's QuickSync settings. So to transcode in this script I add '-hwaccel qsv' to the FFMPEG command line. I think you could add config options to the script for HW accel type and video format (264 or 265) .

Frono avatar Apr 16 '22 14:04 Frono

finally got around to installing my quadro - and i'm unable to get the script to work using hwaccel on ffmpeg or the nvtrans tool :(

totally possible its user error - was doing this while on a boring conf call - so will try some mor stuff this weekend

Decoder (codec mpeg2video) not found for input stream #0:0 ERROR # 1 : Failed to convert using smart Plex Transcoder (NVENC).

I get this loveliness when trying to use hwaccel cude for my quadro

find: ‘/home/nobody/Library/Application Support/Plex Media Server/Codecs/’: No such file or directory

it looks like it looking for a codecs directory ... i'm running this in docker Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 704x480 [SAR 40:33 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn Side data: cpb: bitrate max/min/avg: 2917200/0/0 buffer size: 1835008 vbv_delay: N/A Stream #0:1[0x101](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (libx265)) Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Press [q] to stop, [?] for help -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0. Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 [aac @ 0x5616c5925100] Qavg: 236.929 [aac @ 0x5616c5925100] 2 frames left in the queue on closing

imzenreally avatar Jun 01 '22 20:06 imzenreally