Hardware-Transcoding in Peertube (Docker)

Q1-17 is likely the release date of the CPU, if you have this GPU your CPU is probably one of these.

Can you check that you have files in /dev/dri/ on your host OS (you can also note the group id of /dev/dri/renderD128 so that you can set it in your docker-compose) ?
It should look something like that:

$ ls -nl /dev/dri
total 0
drwxr-xr-x 2 0   0       80 Apr 22 08:39 by-path
crw-rw---- 1 0  44 226,   0 Apr 22 08:39 card0
crw-rw---- 1 0 107 226, 128 Apr 22 08:39 renderD128

If this folder does not exists then check that you have the intel GPU driver installed on your host OS. (On my hardware it uses the i915 driver, you can check it with lspci -k | grep -A 5 VGA to know which driver is in use by the GPU)
On my machine:

$ lspci -k | grep -A5 VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
	DeviceName:  Onboard IGD
	Subsystem: Lenovo HD Graphics 530
	Kernel driver in use: i915
	Kernel modules: i915
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)

Then, if you have the folder and files, can you check what vainfo outputs on your machine ? (you can try both on your host and inside the container)
That way you’ll know if it libraries and permissions are correct.
On my machine it outputs this:

$ vainfo
error: can't connect to X server!
libva info: VA-API version 1.13.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_12
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.13 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.3.3 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileNone                   :	VAEntrypointStats
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointFEI
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointFEI
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointFEI
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointFEI

On another machine without a correct vaapi install it outputs this:

$ vainfo
Trying display: wayland
Trying display: x11
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
vaInitialize failed with error code -1 (unknown libva error),exit

You can also check that your ffmpeg has been built with vaapi support using ffmpeg -encoders| grep _vaapi, it should list somehting like that:

$ ffmpeg -encoders| grep _vaapi
ffmpeg version 5.1.3-1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
 V....D h264_vaapi           H.264/AVC (VAAPI) (codec h264)
 V....D hevc_vaapi           H.265/HEVC (VAAPI) (codec hevc)
 V....D mjpeg_vaapi          MJPEG (VAAPI) (codec mjpeg)
 V....D mpeg2_vaapi          MPEG-2 (VAAPI) (codec mpeg2video)
 V....D vp8_vaapi            VP8 (VAAPI) (codec vp8)
 V....D vp9_vaapi            VP9 (VAAPI) (codec vp9)

Finally, you can try encoding a file manually using ffmpeg to check if is works. See here for example commands on how to use ffmpeg to encode files using vaapi.

Aha! I thought I had Intel drivers installed. btw, I have an Nvidia card in this machine as well.

$ lspci -k | grep -EA3 'VGA|3D|Display'

00:02.0 **Display** controller: Intel Corporation HD Graphics P630 (rev 04)

Subsystem: Dell HD Graphics P630

Kernel driver in use: i915

Kernel modules: i915

--

02:00.0 **VGA** compatible controller: NVIDIA Corporation TU117GL [T400 4GB] (rev a1)

Subsystem: Lenovo Device 1613

Kernel driver in use: nvidia

Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

But,

$ lspci -k | grep -A5 VGA
02:00.0 VGA compatible controller: NVIDIA Corporation TU117GL [T400 4GB] (rev a1)
	Subsystem: Lenovo Device 1613
	Kernel driver in use: nvidia
	Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
02:00.1 Audio device: NVIDIA Corporation Device 10fa (rev a1)
	Subsystem: Lenovo Device 1613

I don’t see the /dev/dri folder. And don’t see some of the other output that I should. The intel instructions for installing Ubuntu drivers in Jammy call for updating the kernel. So I’m doing that now. I’ll report back once I have something to report.

btw, I thought that my problem was related to the « render group » issue that has been reported on other software packages, particularly Jellyfin.

I appear to have something more foundationally wrong with this instance. (I have another peertube instance that is working fine without hard acceleration).

If I turn off VOD transcoding, then videos upload and thumbnails are generated but if a client tries to play a video there is an error that says « Sorry, but this video is not available because the remote instance is not responding.
Please try again later. »
I see an error in the log about « http error from xs param: http://mydomainname »/lazy-static/torrents…"

If I turn on transcoding but just use the x264, it appears to complete the transcodes without issue. There are no errors in the docker stdout. But, if a client tries to play that video, there is just a spinning circle and no errors in the docker stdout.

I think I’ve fixed the general playback issues now. I’m running behind Caddy as a reverse proxy and I didn’t have the peertube webserver port and secure settings set correctly in the .env file.

So, software transcoding is working but I’m still having the same issue with vaapi transcoding. Namely, No VA display found for device /dev/dri/renderD128.\nDevice creation failed: -22.\nFailed to set value '/dev/dri/renderD128' for option 'vaapi_device': Invalid argument\nError parsing global options: Invalid argument\n",

Could this be caused by the fact that the server is running headless? I have no displays connected to the machine. I’ve read mention of this issue in relation to hardware transcoding but it seems so archaic that I dismissed it.

No, you don’t need to any display connected to use hardware acceleration (at least on my machines).

Have you tried to running vainfo in your peertube container & your host machine ?

I did find that the machine Bios was set to Auto. I changed it to the Intel HD graphics and it changed the response to « lspci -k | grep -A5 VGA ».
The Intel graphics shows up now in response to that command (on the host machine).

Here’s the vainfo from the peertube container. It looks like some things are different versions in the container vs on the host. (VA-API version: 1.14 on the host vs 1.10.0 in the container)

$ sudo docker exec -it peertube vainfo               
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.10.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.10 (libva 2.10.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Kaby Lake - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileVP8Version0_3          :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointEncSlice
      VAProfileVP9Profile2            :	VAEntrypointVLD

Ok, it looks like vaapi is initializing correctly in your container.

Can you try to manually encode a file inside the container ?
You can use ffmpeg like so:

ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128  -i your_source_file.mp4 -acodec copy -vcodec h264_vaapi target.mp4

While it transcode you can check that it uses the GPU with intel_gpu_top.

Manual encoding in the container seems to work fine. I see the « Video » category jump in intel_gpu_top during the process and it creates a file. No errors.

If you check in peertube logs you should also see the ffmpeg command that triggered the error message.

Can you try it manually in the container and copy it ?

This is the first error I get in the peertube logs when trying to upload a video and transcode it with vaapi.

error[5/6/2023, 1:20:44 PM] Error in ffmpeg.
{
  "stdout": "",
  "stderr": "ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers\n  built with gcc 10 (Debian 10.2.1-6)\n  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared\n  libavutil      56. 51.100 / 56. 51.100\n  libavcodec     58. 91.100 / 58. 91.100\n  libavformat    58. 45.100 / 58. 45.100\n  libavdevice    58. 10.100 / 58. 10.100\n  libavfilter     7. 85.100 /  7. 85.100\n  libavresample   4.  0.  0 /  4.  0.  0\n  libswscale      5.  7.100 /  5.  7.100\n  libswresample   3.  7.100 /  3.  7.100\n  libpostproc    55.  7.100 / 55.  7.100\n[AVHWDeviceContext @ 0x5609856f8880] No VA display found for device /dev/dri/renderD128.\nDevice creation failed: -22.\nFailed to set value '/dev/dri/renderD128' for option 'vaapi_device': Invalid argument\nError parsing global options: Invalid argument\n",
  "shellCommand": "ffmpeg -n 15 /usr/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i /data/videos/private/5a637e24-98b2-441e-9beb-1893c133b1a8-1080.mp4 -y -acodec copy -vcodec h264_vaapi -f mp4 -movflags faststart -max_muxing_queue_size 1024 -map_metadata -1 -pix_fmt yuv420p -vf scale_vaapi=w=-2:h=1080 -bf 8 -pix_fmt vaapi_vld -preset veryfast -b:v 5200000 -maxrate 5200000 -bufsize 10400000 /data/tmp/4-transcoded.mp4",
  "tags": [
    "ffmpeg"
  ]
}

And then right after that first error…

error[5/6/2023, 1:20:44 PM] Cannot execute job 208cd5c4-d686-4d6a-9ff5-6012e760a1a8 in queue video-transcoding.
{
  "payload": {
    "type": "optimize-to-webtorrent",
    "videoUUID": "7a2335c8-8d99-459a-bfe5-8b6eb7ebf932"
  },
  "err": {
    "stack": "Error: ffmpeg exited with code 1: Device creation failed: -22.\nFailed to set value '/dev/dri/renderD128' for option 'vaapi_device': Invalid argument\nError parsing global options: Invalid argument\n\n    at ChildProcess.<anonymous> (/app/node_modules/fluent-ffmpeg/lib/processor.js:182:22)\n    at ChildProcess.emit (node:events:513:28)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)",
    "message": "ffmpeg exited with code 1: Device creation failed: -22.\nFailed to set value '/dev/dri/renderD128' for option 'vaapi_device': Invalid argument\nError parsing global options: Invalid argument\n"
  }
}

And, here’s the error I get when trying to run the same command that failed in peertube directly in the container. Seems that the -n 15 is not understood.

$ sudo docker exec -it peertube ffmpeg -n 15 /usr/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i /data/videos/5a637e24-98b2-441e-9beb-1891c133b1a8-1080.mp4 -y -acodec copy -vcodec h264_vaapi -f mp4 -movflags faststart -max_muxing_queue_size 1024 -map_metadata -1 -pix_fmt yuv420p -vf scale_vaapi=w=-2:h=1080 -bf 8 -pix_fmt vaapi_vld -preset veryfast -b:v 5200000 -maxrate 5200000 -bufsize 10400000 /data/tmp/4-transcoded.mp4
ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/data/videos/5a637e24-98b2-441e-9beb-1891c133b1a8-1080.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2023-03-30T17:20:57.000000Z
  Duration: 00:00:26.65, start: 0.000000, bitrate: 16904 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17010 kb/s, 29.96 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2023-03-30T17:20:57.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2023-03-30T17:20:57.000000Z
      handler_name    : SoundHandle
[NULL @ 0x5561836d1fc0] Unable to find a suitable output format for '15'
15: Invalid argument

Try without the ffmpeg -n 15 part. I’m not sure what it is but the actual command executed is after and starts with /usr/bin/ffmpeg -hwaccel va...

Doh, you’re right! I’m trying to do too many things at once.
Calling it correctly appears to work. I saw the GPU usage pop up and there is a resulting file.

sudo docker exec -it peertube /usr/bin/ffmpeg -hwaccel vaapi ....

The only unusual thing is this line that was printed out.

Multiple -pix_fmt options specified for stream 0, only the last option '-pix_fmt vaapi_vld' will be used.

So, where do we go next? If the command that is being called appears to work correctly, why is it failing in Peertube?

That’s weird, if it works manually it should also work when peertube launches the command. I don’t see what could be the issue here. Maybe a permission problem because you still get an error when trying to initialize vaapi.

This one is new in 5.1+ because PeerTube now adds the -pix_fmt option which I also provide in the command line to make it work with vaapi. I pushed an update to the plugin yesterday to fix that (at least on my computer). It should also handle more input files.

I just tried to rebuild my image with Peertube 5.1.0 and install your new version of the plugin. I first uninstalled V0.1.1 (I think that was the version) and then installed v0.2.2. I got a few errors:

warn[5/7/2023, 8:52:36 PM] Cannot unregister plugin peertube-plugin-hardware-transcode-vaapi.
{
  "err": {
    "stack": "ReferenceError: transcodingManager is not defined\n    at Object.unregister (/data/plugins/node_modules/peertube-plugin-hardware-transcode-vaapi/main.js:88:3)\n    at PluginManager.<anonymous> (/app/dist/server/lib/plugins/plugin-manager.js:211:30)\n    at Generator.next (<anonymous>)\n    at /app/node_modules/tslib/tslib.js:167:75\n    at new Promise (<anonymous>)\n    at Object.__awaiter (/app/node_modules/tslib/tslib.js:163:16)\n    at PluginManager.unregister (/app/dist/server/lib/plugins/plugin-manager.js:202:24)\n    at PluginManager.<anonymous> (/app/dist/server/lib/plugins/plugin-manager.js:287:28)\n    at Generator.next (<anonymous>)\n    at /app/node_modules/tslib/tslib.js:167:75\n    at new Promise (<anonymous>)\n    at Object.__awaiter (/app/node_modules/tslib/tslib.js:163:16)\n    at PluginManager.uninstall (/app/dist/server/lib/plugins/plugin-manager.js:284:24)\n    at /app/dist/server/controllers/api/plugins.js:78:55\n    at Generator.next (<anonymous>)\n    at /app/node_modules/tslib/tslib.js:167:75\n    at new Promise (<anonymous>)\n    at Object.__awaiter (/app/node_modules/tslib/tslib.js:163:16)\n    at uninstallPlugin (/app/dist/server/controllers/api/plugins.js:76:20)\n    at /app/dist/server/middlewares/async.js:21:32\n    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)\n    at next (/app/node_modules/express/lib/router/route.js:144:13)\n    at uninstallPluginValidator (/app/dist/server/middlewares/validators/plugins.js:126:16)\n    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)\n    at next (/app/node_modules/express/lib/router/route.js:144:13)\n    at middleware (/app/node_modules/express-validator/src/middlewares/check.js:16:13)",
    "message": "transcodingManager is not defined"
  }
}

And then this:

error[5/7/2023, 8:53:15 PM] Cannot install plugin peertube-plugin-hardware-transcode-vaapi, removing it...
{
  "err": {
    "stack": "Error: Cannot find module '/data/plugins/node_modules/peertube-plugin-hardware-transcode-vaapi/dist/main.js'\nRequire stack:\n- /app/dist/server/lib/plugins/plugin-manager.js\n- /app/dist/server/lib/plugins/hooks.js\n- /app/dist/server/lib/activitypub/context.js\n- /app/dist/server/models/actor/actor.js\n- /app/dist/server/models/account/actor-custom-page.js\n- /app/dist/server/initializers/database.js\n- /app/dist/server/helpers/database-utils.js\n- /app/dist/server/models/video/thumbnail.js\n- /app/dist/server/models/abuse/abuse.js\n- /app/dist/server/models/abuse/video-comment-abuse.js\n- /app/dist/server/models/video/video-comment.js\n- /app/dist/server/lib/activitypub/send/send-delete.js\n- /app/dist/server/models/account/account.js\n- /app/dist/server/models/application/application.js\n- /app/dist/server/initializers/checker-after-init.js\n- /app/dist/server.js\n    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)\n    at Function.Module._load (node:internal/modules/cjs/loader:871:27)\n    at Module.require (node:internal/modules/cjs/loader:1098:19)\n    at require (node:internal/modules/cjs/helpers:108:18)\n    at PluginManager.<anonymous> (/app/dist/server/lib/plugins/plugin-manager.js:352:29)\n    at Generator.next (<anonymous>)\n    at /app/node_modules/tslib/tslib.js:167:75\n    at new Promise (<anonymous>)\n    at Object.__awaiter (/app/node_modules/tslib/tslib.js:163:16)\n    at PluginManager.registerPlugin (/app/dist/server/lib/plugins/plugin-manager.js:348:24)\n    at PluginManager.<anonymous> (/app/dist/server/lib/plugins/plugin-manager.js:321:43)\n    at Generator.next (<anonymous>)\n    at fulfilled (/app/node_modules/tslib/tslib.js:164:62)",
    "message": "Cannot find module '/data/plugins/node_modules/peertube-plugin-hardware-transcode-vaapi/dist/main.js'\nRequire stack:\n- /app/dist/server/lib/plugins/plugin-manager.js\n- /app/dist/server/lib/plugins/hooks.js\n- /app/dist/server/lib/activitypub/context.js\n- /app/dist/server/models/actor/actor.js\n- /app/dist/server/models/account/actor-custom-page.js\n- /app/dist/server/initializers/database.js\n- /app/dist/server/helpers/database-utils.js\n- /app/dist/server/models/video/thumbnail.js\n- /app/dist/server/models/abuse/abuse.js\n- /app/dist/server/models/abuse/video-comment-abuse.js\n- /app/dist/server/models/video/video-comment.js\n- /app/dist/server/lib/activitypub/send/send-delete.js\n- /app/dist/server/models/account/account.js\n- /app/dist/server/models/application/application.js\n- /app/dist/server/initializers/checker-after-init.js\n- /app/dist/server.js",
    "code": "MODULE_NOT_FOUND",
    "requireStack": [
      "/app/dist/server/lib/plugins/plugin-manager.js",
      "/app/dist/server/lib/plugins/hooks.js",
      "/app/dist/server/lib/activitypub/context.js",
      "/app/dist/server/models/actor/actor.js",
      "/app/dist/server/models/account/actor-custom-page.js",
      "/app/dist/server/initializers/database.js",
      "/app/dist/server/helpers/database-utils.js",
      "/app/dist/server/models/video/thumbnail.js",
      "/app/dist/server/models/abuse/abuse.js",
      "/app/dist/server/models/abuse/video-comment-abuse.js",
      "/app/dist/server/models/video/video-comment.js",
      "/app/dist/server/lib/activitypub/send/send-delete.js",
      "/app/dist/server/models/account/account.js",
      "/app/dist/server/models/application/application.js",
      "/app/dist/server/initializers/checker-after-init.js",
      "/app/dist/server.js"
    ]
  }
}

Same here. Just tried to upgrade the plugin (didn’t work), removed and tried to install (didn’t work either).

Peertube v5.1.0

Yeah, 0.2.2 is not working (I made a mistake and several file of the plugin were not published correctly).
I pushed a new version fixing the issue earlier today (0.2.3).

I wad able to force install the new version using the CLI: docker-compose exec -u peertube peertube npm run plugin:install -- -n peertube-plugin-hardware-transcode-vaapi -v "0.2.3"

0.2.3v plugin install via PeerTube working, just did it.

Good.
Let me know if you see a significant performance difference with this new version. I changed a bit the way ffmpeg encodes the file. Before I was using hardware decoding, hardware filters and hardware encodes for maximum performance but I had issues with some input files that could not be hardware decoded on my old hardware (VP9, AV1, or non standard size videos).

So in this new release I changed the pipeline to use software decode then hardware filters and encoder. So it should use more CPU and be slower but also much more compatible with input files.

When I have time, I’ll add options to the plugin to easily switch between full hardware or hybrid pipelines.

1 « J'aime »