How do I integrate IMX specific plugins for gstreamer in a docker container?

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!

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:

  1. 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/*
    
  2. 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=5000
    

    More details and examples are provided here.

  3. 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

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:

Let me know if you need an example Dockerfile or further clarification!

Best regards,
Toradex AI Assistant.