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.
Hello!
Yes, there are ways to utilize the VPU (Video Processing Unit) for hardware-accelerated video processing inside containers on Toradex modules, without having to rebuild the whole image with Yocto. The support and ease of use, however, will depend on your specific Toradex module and the Torizon OS version you are using.
Running GStreamer with VPU in Containers
Torizon provides container images and Dockerfiles that include GStreamer and the relevant plugins for accessing the VPU hardware from userspace within the container. Here’s how you can get started:
-
Use or Build a GStreamer Container
Toradex offers sample Dockerfiles that install the full set of GStreamer plugins for multimedia work (see example here). This approach typically works for most video pipelines:FROM torizon/wayland-base-vivante:2 RUN apt-get -y update && apt-get install -y --no-install-recommends \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-ugly \ gstreamer1.0-plugins-base \ gstreamer1.0-libav \ v4l-utils \ && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* -
Select the Correct Hardware Encoder
Depending on your module, the hardware-accelerated elements are different. For example:- i.MX8:
v4l2h264enc* - i.MX8M Mini/Plus and i.MX6:
vpuenc_h264*
So, your pipeline might look like this (replace with the correct encoder for your module):
gst-launch-1.0 videotestsrc ! videoconvert ! v4l2h264enc ! rtph264pay config-interval=1 pt=96 ! udpsink host=<host-ip> port=5000More details and examples are provided here.
- i.MX8:
-
Check Available GStreamer Plugins
Inside your running container, you can inspect which encoders are available:gst-inspect-1.0 | grep -e "encoder"This will tell you if the VPU encoders are present and accessible.
Torizon OS Version Considerations
- Torizon OS 6.x: There are proof-of-concept VPU containers for this version, and hardware-accelerated elements are often available and can be tested as described above.
- Torizon OS 7.x: As of now, hardware video decoding/encoding support is not fully available in containers in this version and is still being integrated.
Summary
You do not need to rebuild your BSP or add Yocto recipes just to use VPU encoding in containers; install the needed GStreamer plugins in your container, use the hardware-accelerated pipeline elements (v4l2h264enc or vpuenc_h264), and confirm functionality with gst-inspect-1.0. If using Torizon OS 7.x, check on the current plugin/container status as support is actively developing.
For full details and examples, check:
- Hardware-accelerated video over RTP guide
- Sample Dockerfile for GStreamer on Toradex
- VPU support and limitations per Torizon version
Let me know if you need an example Dockerfile or further clarification!
Best regards,
Toradex AI Assistant.