Using Hardware Encoder in Container on Verdin iMX8MP

I have a Verdin iMX8MP and need to perform high-resolution video recording inside a container. The camera is connected via USB. While I can use the CPU for encoding at lower resolutions, it becomes impractical for resolutions above HD.

I am unable to use the hardware encoder, and the examples available on the official site are not very helpful.

How can I make the hardware encoder accessible inside the container for high-resolution recording?

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:


Hardware Video Encoding Capabilities

Based on the Verdin iMX8M Plus V1.1 datasheet, your module supports hardware video encoding capabilities (1). The Video Processing Unit (VPU) can handle H.265 HEVC 1080p60 and H.264 AVC 1080p60 encoding (2).

Hardware Encoder Issues

The community forum indicates there are known issues with the hardware video encoder on Verdin iMX8MP (3). Users report encountering the error “vpuenc_h264-0: Could not initialize supporting library” when attempting to use GStreamer with hardware encoding (3).

Container Access Requirements

To enable hardware encoding in containers, you’ll need to ensure proper access to the VPU hardware resources. Based on the forum discussion, there appear to be library dependency issues with undefined symbol references in the NXP-provided libraries (3).

Current Status

The forum discussion from January 2025 shows that even with the vpuGeneric sample from the bookworm-new branch, users are still experiencing initialization failures with the hardware encoder (3). The issue persists across different TorizonCore versions, including 6.5.0-devel (3).

Recommendations

  1. Verify Module Variant: Ensure you’re using the Verdin iMX8M Plus Quad 2GB or Quad 4GB WB IT variants, as the QuadLite 1GB IT variant does not include VPU support (2)

  2. Check Library Dependencies: The forum indicates potential issues with undefined symbols in the VPU wrapper libraries that may need to be resolved (3)

  3. Alternative Approaches: Consider software encoding optimizations or lower resolution encoding until the hardware encoder issues are resolved

The hardware encoding capability is available in the specifications, but there appear to be current implementation challenges that may require further investigation with the development team.

Best regards, Toradex AI Assistant.

Hi @jorger

Check this other similar thread.

Hi @allan.tx

From what I understand from the thread, there is no support for hardware encoding inside a container on Torizon OS 7 right now, correct?

edit:
I tested your Docker Compose setup on my Torizon OS 7–based image, and it seems that the hardware encoder is working. However, I’m having issues when saving MP4 files — it looks like something is corrupting the file during finalization.

Is using this command still the recommended process for recording videos?
Are there any alternatives?

Hello @jorger ,

Thanks for running the test. Indeed, the VPU sample that was originally provided for Torizon OS 6 also works on Torizon OS 7, so you can use it without concerns.

Regarding the corruption issue, could you please share the exact command you are executing? Does this happen only when saving to MP4 files?

Best regards,
Daniel Morais