Verdin iMX8M Mini, GStreamer error when opening vpuenc_h264

Hello!

I’m using i.MX8M Mini with “BSP 7 Downstream Linux Reference Multimedia” (7.1.0+build.3) image.
When I ran the following GStreamer pipeline with VPU encoder element(vpuenc_h264):

GST_DEBUG=2 gst-launch-1.0 \
videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! \
vpuenc_h264 ! rtph264pay config-interval=1 pt=96 ! udpsink host=224.0.0.100 auto-multicast=true port=12345

And then, I got the following logs including errors.

Setting pipeline to PAUSED ...
====== VPUENC: 4.9.1 build on Aug  8 2024 05:28:21. ======
        wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jul 24 2024 01:56:50)
        vpulib: 1.1.1
        firmware: 1.1.1.127
Pipeline is PREROLLING ...
OMX H264 ! HantroHwEncOmx_encoder_create_h264 H264EncInit failed! (-1) /usr/src/debug/imx-vpu-hantro/1.32.0/openmax_il/source/encoder/encoder_h264.c:783
0:00:00.103909052   687   0x7fb0000b70 ERROR                 vpuenc gstvpuenc.c:972:gst_vpu_enc_open_vpu:<vpuenc_h264-0> opening new VPU handle failed: failure
0:00:00.103944426   687   0x7fb0000b70 ERROR                 vpuenc gstvpuenc.c:1165:gst_vpu_enc_handle_frame:<vpuenc_h264-0> gst_vpu_enc_open_vpu failed.
0:00:00.103999050   687   0x7fb0000b70 WARN                 basesrc gstbasesrc.c:3175:gst_base_src_loop:<videotestsrc0> error: Internal data stream error.
0:00:00.104046174   687   0x7fb0000b70 WARN                 basesrc gstbasesrc.c:3175:gst_base_src_loop:<videotestsrc0> error: streaming stopped, reason error (-5)
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data stream error.
Additional debug info:
/usr/src/debug/gstreamer1.0/1.24.0.imx/libs/gst/base/gstbasesrc.c(3175): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Also, I ran the same pipeline with the BSP6 image (BSP 6 Downstream Linux Reference Multimedia 6.8.1+build.15), it worked fine.
Could someone please tell me how to use the VPU encoder with a BSP7 image?

Appendix (tdx-info):

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.6.54-7.1.0-g3493ccd66900 #1 SMP PREEMPT Tue Dec 17 21:04:41 UTC 2024
Kernel command line:      root=PARTUUID=97f07748-02 ro rootwait console=tty1 console=ttymxc0,115200
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=7.1.0-build.3
Distro variant:           -
Hostname:                 verdin-imx8mm-15005765
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Mini WB on Verdin Development Board
Toradex version:          0055 V1.1F
Serial number:            15005765
Processor arch:           aarch64
------------------------------------------------------------
1 Like

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

I’m sorry to hear you’re experiencing issues with the VPU encoder on your Verdin iMX8M Mini using BSP 7. Let’s explore some steps that might help resolve this:

  1. Review BSP Changes:

    • Check the release notes for BSP 7 to see if there are any changes related to the VPU or GStreamer that could impact the encoder’s functionality.
  2. Verify VPU Driver and Firmware:

    • Ensure that the VPU driver and firmware are correctly installed and compatible with BSP 7. Sometimes, updates in the BSP require corresponding updates in the VPU firmware.
  3. Check GStreamer Plugin Compatibility:

    • Make sure the GStreamer plugins you are using are compatible with BSP 7. There might be updates or changes in the plugin versions that could affect functionality.
  4. Examine Pipeline Configuration:

    • Double-check your GStreamer pipeline configuration for any syntax errors or deprecated elements that might not be supported in the new BSP version.
  5. Experiment with Different Parameters:

    • Try adjusting the pipeline parameters, such as resolution or framerate, to see if the issue persists. This can help identify if the problem is related to specific settings.
  6. Investigate Known Issues:

    • Look into any known issues or errata for BSP 7 that might relate to the VPU or GStreamer. This information can sometimes provide insights into unresolved bugs or workarounds.

I hope these steps help you get the VPU encoder working with BSP 7. If the issue persists, examining the specific error messages and logs in more detail might provide further clues.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

https://community.nxp.com/t5/i-MX-Processors/FLEX-iMX8M-Mini-can-t-use-VPU-encoder/td-p/1064637

Video Encoding and Playback With GStreamer (Linux) | Toradex Developer Center.

Dear @k_ichi sorry for the the delay. Did you manage to get the VPU working in BSP 7 or not yet? I believe in BSP 7 you should use v4l2h264enc.

Make sure to check NXP i.MX 6.6 i.MX Linux User’s Guide to check full details on how to use i.MX8MM VPU in the Downstream version.

Kind regards,
Alvaro.

Dear @alvaro.tx
Thank you for your reply and advices!

Did you manage to get the VPU working in BSP 7 or not yet?

Not yet.
I modified the pipeline as follows, but it ended with errors.
Pipeline:

GST_DEBUG=3,v4l2h264enc:7 gst-launch-1.0 \
videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! \
v4l2h264enc ! 'video/x-h264,level=(string)4' ! h264parse ! rtph264pay config-interval=1 pt=96 ! \
udpsink host=224.0.0.100 auto-multicast=true port=12345

Log:

Setting pipeline to PAUSED ...

====== V4L2ENC: 1.24.0 build on Jul 24 2024 02:25:45. ======
0:00:00.094861637  3900   0x555d001030 WARN                    v4l2 gstv4l2object.c:5230:gst_v4l2_object_probe_caps:<v4l2h264enc0:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument
Pipeline is PREROLLING ...
0:00:00.096324235  3900   0x7f88000b70 FIXME                default gstutils.c:4088:gst_element_decorate_stream_id_internal:<videotestsrc0> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Redistribute latency...
0:00:00.133601927  3900   0x7f88000b70 WARN          v4l2bufferpool gstv4l2bufferpool.c:875:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool0:src> Uncertain or not enough buffers, enabling copy threshold
0:00:00.140300054  3900   0x7f88000d20 WARN                    v4l2 gstv4l2object.c:6189:gst_v4l2_object_poll:<v4l2h264enc0> error: poll error 1: Success (0)
ERROR: from element /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0: Could not read from resource.
Additional debug info:
/usr/src/debug/gstreamer1.0-plugins-good/1.24.0.imx/sys/v4l2/gstv4l2object.c(6189): gst_v4l2_object_poll (): /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0:
poll error 1: Success (0)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
0:00:00.146991556  3900   0x555d001030 WARN              bufferpool gstbufferpool.c:1429:gst_buffer_pool_set_flushing:<v4l2h264enc0:pool0:sink> can't change flushing state of inactive pool
0:00:00.150164248  3900   0x555d001030 WARN              bufferpool gstbufferpool.c:1429:gst_buffer_pool_set_flushing:<v4l2h264enc0:pool0:sink> can't change flushing state of inactive pool
Freeing pipeline ...

Also, the same command worked fine on Raspberry Pi4 (RPi OS 6.6.62).
If you have any advice, I would appreciate it.

Kind regards,
Kyohei

Dear Kyohei @k_ichi , thanks for the additional information. I don’t see any open ticket on this regard so let us check more in detail. The information you have provided is very useful.

I hope I can report back to you in 1-2 weeks.

Sorry for the inconvinience but thank you for your patience.

Kind regards,
Alvaro.