Official VPU torizon sample not working

I am trying to run the gstreamer vpu example from here: torizon-samples/vpu/generic/vpuGeneric at bookworm-new · toradex/torizon-samples

However the vpu does not seem to work and i get an error: vpugeneric-1 | ERROR: from element /GstPipeline:pipeline0/vpuenc_h264:vpuenc_h264-0: Could not initialize supporting library.

I build the image via:

docker build --build-arg BASE_NAME=wayland-base-vivante --build-arg IMAGE_ARCH=arm64/v8 -t vpugeneric .

and then run via:

 env TAG=latest docker compose up

My device is verdin-imx8mp.
This is the full output i get:

 ⠦ Container vpugeneric-weston-1      Recreated                                                                                                    1.5s
 ⠙ Container vpugeneric-vpugeneric-1  Recreated                                                                                                    0.1s
Attaching to vpugeneric-1, weston-1
weston-1      | Switching VT tty1 to text mode if currently in graphics mode
weston-1      | Switching to VT 7
weston-1      | SoC is: 'i.MX8MP'
weston-1      | SoC has GPU: true
weston-1      | SoC has DPU: false
weston-1      | g2d implementation: viv
weston-1      | Removing previously created '.X*-lock' entries under /tmp before starting Weston. Pass 'IGNORE_X_LOCKS=1' environment variable to Weston container to disable this behavior.
weston-1      | dos2unix: converting file /etc/xdg/weston/weston.ini to Unix format...
weston-1      | dos2unix: converting file /etc/xdg/weston-dev/weston.ini to Unix format...
weston-1      | 00:00:00.000 [INFO] [seatd/seat.c:39] Created VT-bound seat seat0
weston-1      | 00:00:00.000 [INFO] [seatd/seatd.c:194] seatd started
weston-1      | Date: 2025-06-27 UTC
weston-1      | [14:15:30.809] weston 10.0.1
weston-1      |                https://wayland.freedesktop.org
weston-1      |                Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
weston-1      |                Build: lf-5.15.52-2.1.0-10-g9452feba
weston-1      | [14:15:30.809] Command line: weston -Bdrm-backend.so --current-mode -Swayland-0
weston-1      | [14:15:30.809] OS: Linux, 6.6.84-7.2.0-g87bfb710b6f1, #1-Torizon SMP PREEMPT Mon Mar 31 08:47:48 UTC 2025, aarch64
weston-1      | [14:15:30.809] Flight recorder: enabled
weston-1      | [14:15:30.810] Using config file '/etc/xdg/weston/weston.ini'
weston-1      | [14:15:30.811] Output repaint window is 7 ms maximum.
weston-1      | [14:15:30.811] Loading module '/usr/lib/aarch64-linux-gnu/libweston-10/drm-backend.so'
weston-1      | [14:15:30.831] initializing drm backend
weston-1      | [14:15:30.831] Trying libseat launcher...
weston-1      | 00:00:00.072 [INFO] [seatd/server.c:145] New client connected (pid: 28, uid: 1000, gid: 1000)
weston-1      | 00:00:00.073 [INFO] [seatd/seat.c:170] Added client 7 to seat0
weston-1      | 00:00:00.073 [INFO] [seatd/seat.c:480] Opened client 7 on seat0
weston-1      | [14:15:30.832] libseat: session control granted
weston-1      | [14:15:30.837] using /dev/dri/card1
weston-1      | [14:15:30.837] DRM: supports atomic modesetting
weston-1      | [14:15:30.837] DRM: does not support GBM modifiers
weston-1      | [14:15:30.837] DRM: supports picture aspect ratio
weston-1      | [14:15:30.837] Loading module '/usr/lib/aarch64-linux-gnu/libweston-10/gl-renderer.so'
weston-1      | [14:15:30.872] EGL client extensions: EGL_EXT_client_extensions
weston-1      |                EGL_EXT_platform_base EGL_KHR_platform_wayland
weston-1      |                EGL_EXT_platform_wayland EGL_EXT_device_query
weston-1      |                EGL_EXT_device_drm EGL_EXT_device_drm_render_node
weston-1      |                EGL_KHR_platform_gbm
weston-1      | [14:15:30.873] failed to initialize display
weston-1      | [14:15:30.873] EGL error state: EGL_NOT_INITIALIZED (0x3001)
weston-1      | [14:15:30.873] failed to initialize egl
weston-1      | 00:00:00.114 [INFO] [seatd/seat.c:418] No clients on seat0 to activate
weston-1      | 00:00:00.115 [INFO] [seatd/seat.c:524] Closed client 7 on seat0
weston-1      | 00:00:00.115 [INFO] [seatd/seat.c:192] Removed client 7 from seat0
weston-1      | [14:15:30.874] fatal: failed to create compositor backend
weston-1      | Internal warning: debug scope 'drm-backend' has not been destroyed.
weston-1      | 00:00:00.115 [INFO] [seatd/client.c:471] Client disconnected
weston-1      | 00:00:00.121 [INFO] [seatd/seatd.c:218] seatd stopped
weston-1      | Switching back to vt 1
weston-1 exited with code 1
vpugeneric-1  | xz: (stdin): File format not recognized
vpugeneric-1  | tar: Child returned status 1
vpugeneric-1  | tar: Error is not recoverable: exiting now
vpugeneric-1  |  _______________________________
vpugeneric-1  | /                               \
vpugeneric-1  | |  Running H.264 Encode test... |
vpugeneric-1  | \                               /
vpugeneric-1  |  -------------------------------
vpugeneric-1  |     \
vpugeneric-1  |      \
vpugeneric-1  |          .--.
vpugeneric-1  |         |o_o |
vpugeneric-1  |         |:_/ |
vpugeneric-1  |        //   \ \
vpugeneric-1  |       (|     | )
vpugeneric-1  |      /'\_   _/`\
vpugeneric-1  |      \___)=(___/
vpugeneric-1  |
vpugeneric-1  | (gst-plugin-scanner:15): GStreamer-CRITICAL **: 14:15:31.924: gst_element_class_add_pad_template: assertion 'GST_IS_PAD_TEMPLATE (templ)' failed
vpugeneric-1  |
vpugeneric-1  | (gst-plugin-scanner:15): GStreamer-CRITICAL **: 14:15:31.927: gst_element_class_add_pad_template: assertion 'GST_IS_PAD_TEMPLATE (templ)' failed
vpugeneric-1  | Setting pipeline to PAUSED ...
vpugeneric-1  | ERROR: from element /GstPipeline:pipeline0/vpuenc_h264:vpuenc_h264-0: Could not initialize supporting library.
vpugeneric-1  | Additional debug info:
vpugeneric-1  | ../gst-libs/gst/video/gstvideoencoder.c(1804): gst_video_encoder_change_state (): /GstPipeline:pipeline0/vpuenc_h264:vpuenc_h264-0:
vpugeneric-1  | Failed to start encoder
vpugeneric-1  | ERROR: pipeline doesn't want to preroll.
vpugeneric-1  | Failed to set pipeline to PAUSED.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for providing such a detailed description and logs. Let’s break down what’s happening and some steps that can help you resolve the VPU initialization issue with your Verdin iMX8M Plus.

Key Points to Check

  1. BSP Version and VPU Plugin Support
    There are known issues with VPU support in certain BSP and Torizon OS versions. Please verify the Torizon OS/BSP version you are using. If you are using Torizon OS 6 or 7, VPU plugins and device support differ. Details on BSP-related VPU issues can be found here:
    https://community.toradex.com/t/verdin-imx8m-mini-gstreamer-error-when-opening-vpuenc_h264/26621

  2. Device Nodes
    Ensure the VPU device nodes are present on your system. Run:

    ls /dev/video*
    

    You should see device files like /dev/video0, /dev/video1, etc. If these are missing, the VPU driver may not be loaded correctly.
    (reference)

  3. Container Base Image
    You are already using wayland-base-vivante, which is correct. This base contains needed VPU-related GStreamer plugins for i.MX8M Plus devices.
    (reference)

  4. GStreamer Pipeline Structure
    To test if basic VPU support is working, run a simple test pipeline on your system:

    gst-launch-1.0 videotestsrc ! video/x-raw ! vpuenc_h264 ! video/x-h264 ! fakesink
    

    If this fails with a similar error, the issue is likely related to the environment or base image.
    (reference)

  5. Plugin Installation
    Make sure your container includes the necessary GStreamer plugins, specifically the imxvpudec and imxvpuenc plugins or their equivalents for your board variant. You can list available plugins inside the container using:

    gst-inspect-1.0 | grep vpu
    

    If vpuenc_h264 does not appear, you need to install the appropriate GStreamer plugin packages.

  6. Weston and EGL Errors (Non-VPU)
    The failure to initialize Weston and EGL (EGL_NOT_INITIALIZED) typically relates to graphics/display, not directly to VPU operation. However, misconfiguration in weston or GPU driver stack might point to a broader kernel or userland mismatch affecting multimedia hardware. Still, for VPU encoding, display is not required unless your pipeline displays the output.

Recommendations

  • Run the simple GStreamer pipeline above inside your container, after connecting to it with docker exec -it <container> /bin/bash.
  • Confirm the presence of device nodes /dev/video*.
  • List VPU-related plugins using gst-inspect-1.0 | grep vpu inside the container.
  • Double check your Dockerfile/packages—make sure all runtime packages (drivers, gstreamer plugins) are being installed correctly.
  • Check the OS/BSP version. Consider testing with the latest Torizon OS 6.x stable.

References

Please try these checks and share the output of:

  • ls /dev/video*
  • gst-inspect-1.0 | grep vpu

This will help to further identify the problem.

Best regards,
Toradex AI Assistant.

Greetings @mbcel,

This is a known issue currently. That VPU example was more of a proof-of-concept that was initially created for a much older version of software than what our current software releases are based upon.

We have it in our product backlog to update this example and keep it better maintained going forward.

I assume you require VPU usage for your product, correct? Do you have a rough timeline of when this would be needed?

Best Regards,
Jeremias

Hi Jeremias,

yes we desperately need it. The software encoder is not usable in our case since it consumes 100% cpu and basically freezes our device. Also we need a free CPU for other calculations.

Regarding timeline, we need it now. Is there any workaround or older version we can use as a quick fix now? Or what changes need to be made to the current vpu example? We are currently using Torizon OS 7.2.0.

Best,
Marcel

Let me check with our team internally and see if there’s any options that can be done in the short-term.

Best Regards,
Jeremias

Perhaps you can try the VPU sample on Torizon 6 instead of 7. It was originally designed for that version in the first place. So there’s a greater chance it will work. Though you’ll need to see if it can fulfill your specific use-case.

Best Regards,
Jeremias

Torizon 6 OS should be fine for us. I already tried to downgrade to Torizon 6 OS but ostree shows the image seems to stay in pending state and will still boot the OS 7 version again.

Is there any explanation how to downgrade to OS 6 somewhere? I just build the image with torizoncore-builer and then also deployed it via this tool. This worked for OS7 images without issues but does not seem to work for the OS6 version.

Wait are you trying to to use TorizonCore Builder to deploy a Torizon OS 6 image on a device that is currently running Torizon OS 7?

This will probably not work for many reasons. Keep in mind as per our semantic versioning major version differences (6 vs 7), introduce many changes unlike minor versions changes (i.e 7.1.0 vs 7.2.0). Going between major versions is not as trivial due to this.

The best course of action would be to just re-flash the device cleanly with a Torizon OS 6 image. You could go between major versions, but this requires many steps including changing the bootloader which is done with Torizon Cloud: Bootloader Updates in Torizon OS | Toradex Developer Center

If you’re not using Torizon Cloud, again it’s far simpler to just re-flash the device especially since your system is still under development.

Best Regards,
Jeremias

Okay, got it. I will try via re-falshing then.

Also do you have any links which show the missing features/limitations of Torizon OS 6, compared to Torizon OS 7? E.g. is Torizon Cloud not supported for OS 6?

And what is your timeline on updating the vpu example to also work on Torizon OS 7?

Also do you have any links which show the missing features/limitations of Torizon OS 6, compared to Torizon OS 7? E.g. is Torizon Cloud not supported for OS 6?

All major Torizon Cloud features should still be supported with 6. The only thing that might be missing are improvements/quality of life changes that were done in 7. The major difference between 6 and 7 would be the versions of container images to use. This articles goes into it a bit more on major changes between various OS versions: Torizon OS Upgrade Notes | Toradex Developer Center

And what is your timeline on updating the vpu example to also work on Torizon OS 7?

Currently there is no hard-timeline that can be shared. The topic is still under consideration to be prioritized alongside other items.

Best Regards,
Jeremias

Okay the vpu sample seems to work now with Torizon 6. However now installing the updated image with the devicetree for the imx662 camera does not work anymore. This worked before with the Torion 7 base image.

I create a new image according to this tutorial:
First Steps with Framos FSM:GO CSI Optical Sensor Modules(Torizon) | Toradex Developer Center

Then I use torizoncore-builder to deploy it. However then the new image is stuck in pending state and will not boot:

sudo ostree admin status
Password:
  torizon d54ee1ed770c35ab0985365f20dcad2fd4a6fd17c6e22055e305beafd3c5cd0f.0 (pending)
    Version: 6.8.2+build.30-tcbuilder.20250628113745
    origin refspec: tcbuilder:d54ee1ed770c35ab0985365f20dcad2fd4a6fd17c6e22055e305beafd3c5cd0f
* torizon 5e0a30ac02a3295d1424e3c5a7ba9ced6fedd24b4bc9b12c18aa4685db7dd710.0
    Version: 6.8.2+build.30-tcbuilder.20250504222633
    origin refspec: torizon

Is there any way to see logs of why it will not boot?

Did you make sure to use the Torizon 6 version of the documentation and code sources?

What were your exact steps?

Best Regards,
Jeremias

Hi Jeremias,

sorry yes the error was due to some dependencies of my image was still for Torizon 7, it is working now.

One last problem I have is that the vpu only works when running the gstreamer pipeline as root. When running with the default torizon user I get following error:

ERROR: from element /GstPipeline:pipeline0/vpuenc_h264:vpuenc_h264-0: Could not initialize supporting library.
Additional debug info:
…/gst-libs/gst/video/gstvideoencoder.c(1804): gst_video_encoder_change_state (): /GstPipeline:pipeline0/vpuenc_h264:vpuenc_h264-0:
Failed to start encoder
ERROR: pipeline doesn’t want to preroll.

Do you know what else needs to be done to make this work for the torizon user?

I did this once before on the 8m mini so the instructions should be similar for the 8m plus.

First you’ll need to create a new udev rule to change the permissions of some of the device files in /dev. Your udev rule should look something like:

KERNEL=="mxc_hantro*", GROUP="video", MODE="0660"
SUBSYSTEM=="dma_heap", GROUP="video", MODE="0660"

To explain, we need to add change the permissions and groups of these /dev/* entries so that the torizon user inside the container has access. The 1st line is to change the VPU-related entries. You know it worked when you see this on the device:

torizon@verdin-imx8mm-06827778:~$ ls -l /dev/mxc_hantro*
crw-rw---- 1 root video 235, 0 Mar  4 23:31 /dev/mxc_hantro
crw-rw---- 1 root video 234, 0 Mar  4 23:31 /dev/mxc_hantro_h1

Though for the 8m plus I believe the entry is /dev/mxc_hantro_vc8000e instead of /dev/mxc_hantro_h1.

The 2nd line is to change the CMA-related entries so that we can allocate memory to the gstreamer pipeline. You know this worked wen you see this:

torizon@verdin-imx8mm-06827778:~$ ls -l /dev/dma_heap/
total 0
crw-rw---- 1 root video 253, 1 Mar  4 23:31 linux,cma
crw-rw---- 1 root video 253, 2 Mar  4 23:31 linux,cma-uncached
crw-rw---- 1 root video 253, 0 Mar  4 23:31 system

The reason we add these to the video group is because in Toradex provided containers the torizon user is part of the video group:

torizon@23f4cd0ae15a:~$ groups
torizon dialout audio video gpio i2cdev spidev pwm input kvm render

Combined with the 660 permissions this should allow the torizon user to access these systems when running gstreamer.

Once that is in order you can run the gstreamer/vpu container and execute as the torizon user. You may need to tweak some minor things again for the 8m plus specifically. Also this was only tried with a simple gstreamer pipeline. I can’t guarantee it will work with more advanced use-cases.

Best Regards,
Jeremias