A7S gstreamer current status for Real-time NPU

Here is my experience so far with gstreamer and the current status of its use in real-time, real-world applications, like camera + NPU.
I’m a little rusty with gstreamer, but I’m managing to keep up.

This is done with R6 image (rsdk) and A7S, with finally the latest libcedar and an updated gstreamer, I think…

Let’s start with encoding using videotestsrc:

sudo gst-launch-1.0 videotestsrc is-live=true num-buffers=200 name=camera ! video/x-raw,width=1920,height=1080,framerate=30/1,format=NV12 ! queue ! omxh264videoenc target-bitrate=2000000 ! filesink location=test_video_nv12.h264
Setting pipeline to PAUSED …
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init d1c26ee0

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
Pipeline is live and does not need PREROLL …
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
New clock: GstSystemClock
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffff94922750

WARNING: omx_venc dealWithInputBuffer:3630: skip this input buffer, pInBufHd:0xaaaad19e5c00,buffer_type=ebebebeb,buf_size=0
Got EOS from element “pipeline0”.
Execution ended after 0:00:06.678020840
Setting pipeline to NULL …
WARNING: cedarc VideoEncUnInit:361: the VideoEnc is not init currently

Freeing pipeline …

We can now confirm the encoder accepts NV12 1920x1080 single plane buffers:

  1. by debugging:

0:00:00.072503354 925 0xaaaae55078c0 DEBUG capsfilter gstcapsfilter.c:302:gst_capsfilter_transform_caps: intersect: video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)NV12, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive

  1. by running the same pipeline in C and checking caps for each frame:
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init eb4e4f10

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
Frame: 1 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffffb0f12750

Frame: 10 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 20 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 30 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 40 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 50 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 60 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 70 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 80 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 90 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 100 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 110 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 120 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 130 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 140 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 150 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 160 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 170 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 180 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 190 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Frame: 200 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
WARNING: omx_venc dealWithInputBuffer:3630: skip this input buffer, pInBufHd:0xaaaaeb315c00,buffer_type=ebebebeb,buf_size=0
^
  1. by mapping the buffer and checking buffer size:

    
    
    DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!
    
    DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
    DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init e0dc1ec0
    
    INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
    WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
    WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
    WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
    WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
    WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
    Frame: 1 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffff7920a750
    
    Frame: 20 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 20 - MAPPING START
    Frame: 20 - MAPPING OK
    Frame: 20 - size: 3110400
    Frame: 20 - UNMAPPING DONE!
    Frame: 40 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 40 - MAPPING START
    Frame: 40 - MAPPING OK
    Frame: 40 - size: 3110400
    Frame: 40 - UNMAPPING DONE!
    Frame: 60 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 60 - MAPPING START
    Frame: 60 - MAPPING OK
    Frame: 60 - size: 3110400
    Frame: 60 - UNMAPPING DONE!
    Frame: 80 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 80 - MAPPING START
    Frame: 80 - MAPPING OK
    Frame: 80 - size: 3110400
    Frame: 80 - UNMAPPING DONE!
    Frame: 100 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 100 - MAPPING START
    Frame: 100 - MAPPING OK
    Frame: 100 - size: 3110400
    Frame: 100 - UNMAPPING DONE!
    Frame: 120 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 120 - MAPPING START
    Frame: 120 - MAPPING OK
    Frame: 120 - size: 3110400
    Frame: 120 - UNMAPPING DONE!
    Frame: 140 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 140 - MAPPING START
    Frame: 140 - MAPPING OK
    Frame: 140 - size: 3110400
    Frame: 140 - UNMAPPING DONE!
    Frame: 160 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 160 - MAPPING START
    Frame: 160 - MAPPING OK
    Frame: 160 - size: 3110400
    Frame: 160 - UNMAPPING DONE!
    Frame: 180 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 180 - MAPPING START
    Frame: 180 - MAPPING OK
    Frame: 180 - size: 3110400
    Frame: 180 - UNMAPPING DONE!
    Frame: 200 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
    Frame: 200 - MAPPING START
    Frame: 200 - MAPPING OK
    Frame: 200 - size: 3110400
    Frame: 200 - UNMAPPING DONE!
    WARNING: omx_venc dealWithInputBuffer:3630: skip this input buffer, pInBufHd:0xaaaae0bf2c00,buffer_type=ebebebeb,buf_size=0
    ^
    
    
    

Now things get ugly with the current gstreamer state, let’s grab some frames from the camera (imx415 or imx214), encode and record them to a file:

sudo gst-launch-1.0 -e v4l2src device=/dev/video0 en-awisp=1 en-largemode=0 num-buffers=200 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue max-size-buffers=18 ! omxh264videoenc target-bitrate=2000000 ! filesink location=stream_cam.h264
Setting pipeline to PAUSED …
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init 17f4850

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
Pipeline is live and does not need PREROLL …
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
New clock: GstSystemClock
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
[ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<<
IPCORE: ISP602
branch: libisp-dev
commit: 665dc2e9613716c25abb6b64af145a73b989271e
date  : Wed Dec 18 15:26:13 2024 +0800
author: [email protected]

[ISP]video device name is vin_video0
[AWIspApi]: F:awIspGetIspId, L:104, video0 → isp0
[ISP]tdm_rx device name is sunxi_tdm_rx.0
[ISP]open isp device[0] success!
[ISP_WARN]VIDIOC_VIN_GET_SENSOR_OTP_INFO return error:Invalid argument
[ISP]ISP0 OTP Disable
[ISP]get isp_ctx from /mnt/isp0_1920_1080_30_0_imx415_mipi_ctx_saved.bin success!!!
[ISP]detect /mnt/ success.
[ISP]find imx415_mipi_1920_1080_30_0 [imx415_mipi_1080p_isp_cfg] isp config
[ISP]create isp0 server thread!
[ISP_ERR]isp_dev_start, line: 717,unable to subscribe to tdm event: Inappropriate ioctl for device (25).
[ISP_ERR]isp_stat_process_buffer, line: 265,AEWB: stats error, skipping buffer.
[ISP_WARN]imx415_mipi get sensor_flip failed: Invalid argument (22).
[ISP_WARN]imx415_mipi get sensor_temp failed: Invalid argument (22).
[ISP_ERR]isp_sync_debug_info, line: 857,VIDIOC_VIN_ISP_GET_INFO error!
[ISP_WARN]isp debugfs node not support!!!
ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffff963fb750

WARNING: omx_venc dealWithInputBuffer:3611: skip this input buffer, impl->mInBufHdr->nTimeStamp 4713096
Got EOS from element “pipeline0”.
EOS received - stopping pipeline…
Execution ended after 0:00:04.696637826
Setting pipeline to NULL …
WARNING: cedarc VideoEncUnInit:361: the VideoEnc is not init currently

[ISP]save isp_ctx to /mnt/isp0_1920_1080_30_0_imx415_mipi_ctx_saved.bin success, data_len:38872!!!

(gst-launch-1.0:997): GStreamer-CRITICAL **: 21:01:25.160: gst_buffer_get_size: assertion ‘GST_IS_BUFFER (buffer)’ failed

(gst-launch-1.0:997): GStreamer-CRITICAL **: 21:01:25.160: gst_mini_object_unref: assertion ‘GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0’ failed
Freeing pipeline …

That works but with CRITICAL errors

Checking negotiated caps:

  1. by debugging:

0:00:00.054752877 1014 0xaaab092786a0 DEBUG capsfilter gstcapsfilter.c:302:gst_capsfilter_transform_caps: intersect: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709

  1. by running the same pipeline in C and verifying the caps:
No negotiated caps yet on this pad.
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init d5789cb0

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
[ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<<
IPCORE: ISP602
branch: libisp-dev
commit: 665dc2e9613716c25abb6b64af145a73b989271e
date  : Wed Dec 18 15:26:13 2024 +0800
author: [email protected]

[ISP]video device name is vin_video0
[AWIspApi]: F:awIspGetIspId, L:104, video0 → isp0
[ISP]tdm_rx device name is sunxi_tdm_rx.0
[ISP]open isp device[0] success!
[ISP_WARN]VIDIOC_VIN_GET_SENSOR_OTP_INFO return error:Invalid argument
[ISP]ISP0 OTP Disable
[ISP]get isp_ctx from /mnt/isp0_1920_1080_30_0_imx415_mipi_ctx_saved.bin success!!!
[ISP]detect /mnt/ success.
[ISP]find imx415_mipi_1920_1080_30_0 [imx415_mipi_1080p_isp_cfg] isp config
[ISP]create isp0 server thread!
[ISP_ERR]isp_dev_start, line: 717,unable to subscribe to tdm event: Inappropriate ioctl for device (25).
[ISP_ERR]isp_stat_process_buffer, line: 265,AEWB: stats error, skipping buffer.
Frame: 1 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
[ISP_WARN]imx415_mipi get sensor_flip failed: Invalid argument (22).
[ISP_WARN]imx415_mipi get sensor_temp failed: Invalid argument (22).
[ISP_ERR]isp_sync_debug_info, line: 857,VIDIOC_VIN_ISP_GET_INFO error!
[ISP_WARN]isp debugfs node not support!!!
ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffffa17fa750

Frame: 20 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 40 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 60 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 80 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 100 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 120 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 140 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 160 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 180 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 200 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
WARNING: omx_venc dealWithInputBuffer:3611: skip this input buffer, impl->mInBufHdr->nTimeStamp 4742377
^
  1. by mapping the buffer and checking buffer size:
No negotiated caps yet on this pad.
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init 43a3cb0

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
[ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<<
IPCORE: ISP602
branch: libisp-dev
commit: 665dc2e9613716c25abb6b64af145a73b989271e
date  : Wed Dec 18 15:26:13 2024 +0800
author: [email protected]

[ISP]video device name is vin_video0
[AWIspApi]: F:awIspGetIspId, L:104, video0 → isp0
[ISP]tdm_rx device name is sunxi_tdm_rx.0
[ISP]open isp device[0] success!
[ISP_WARN]VIDIOC_VIN_GET_SENSOR_OTP_INFO return error:Invalid argument
[ISP]ISP0 OTP Disable
[ISP]get isp_ctx from /mnt/isp0_1920_1080_30_0_imx415_mipi_ctx_saved.bin success!!!
[ISP]detect /mnt/ success.
[ISP]find imx415_mipi_1920_1080_30_0 [imx415_mipi_1080p_isp_cfg] isp config
[ISP]create isp0 server thread!
[ISP_ERR]isp_dev_start, line: 717,unable to subscribe to tdm event: Inappropriate ioctl for device (25).
[ISP_ERR]isp_stat_process_buffer, line: 265,AEWB: stats error, skipping buffer.
Frame: 1 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
[ISP_WARN]imx415_mipi get sensor_flip failed: Invalid argument (22).
[ISP_WARN]imx415_mipi get sensor_temp failed: Invalid argument (22).
[ISP_ERR]isp_sync_debug_info, line: 857,VIDIOC_VIN_ISP_GET_INFO error!
[ISP_WARN]isp debugfs node not support!!!
ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffff92a43750

Frame: 20 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 20 - MAPPING START
Frame: 20 - MAPPING OK
Frame: 20 - size: 3133440
Frame: 20 - UNMAPPING DONE!

(gst-cam-h264:1143): GStreamer-CRITICAL **: 21:23:45.901: gst_buffer_get_size: assertion ‘GST_IS_BUFFER (buffer)’ failed

(gst-cam-h264:1143): GStreamer-CRITICAL **: 21:23:45.901: gst_mini_object_unref: assertion ‘GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0’ failed
Frame: 40 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 40 - MAPPING START
Frame: 40 - MAPPING OK
Frame: 40 - size: 3133440
Frame: 40 - UNMAPPING DONE!

(gst-cam-h264:1143): GStreamer-CRITICAL **: 21:23:46.382: gst_buffer_get_size: assertion ‘GST_IS_BUFFER (buffer)’ failed

(gst-cam-h264:1143): GStreamer-CRITICAL **: 21:23:46.382: gst_mini_object_unref: assertion ‘GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0’ failed
Frame: 60 - Caps: video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709
Frame: 60 - MAPPING START
Frame: 60 - MAPPING OK
Frame: 60 - size: 3133440
Frame: 60 - UNMAPPING DONE!
^

What happened here? Accessing the buffer hangs the gstreamer due to memory leaks or race conditions, most likely what AI has suggested:
Pipeline Hangs: If the pipeline is stalled (e.g., due to encoder FIFOs filling up or async state changes), buffers may never be released, causing the mapping thread to block indefinitely.
This can happen with fewer buffers than are shown here.
And you can notice the buffer size is now 3133440 → 1920x1088 (padding?) and not 3110400 → 1920x1080 anymore.

So, we cannot access the buffer to manipulate the frame as we need in real-time. looks like gst_object_unref() is missing or the buffers are not synced properly.

I noticed that after I updated libcedar and gstreamer videoconvert started changing the buffer size as well, already reported here in the forum. Gstreamer videoconvert not compatible with hardware encoding

I hope Radxa can ask the gstreamer maintainers (Allwinner?) to fix this MAPPING issue and videoconvert. I could not find the source code anywhere to get a better understanding. Any pointers?

Now let’s have a look into videoconvert with this pipeline, decoding MP4 and encoding it to raw H264:

sudo gst-launch-1.0 -e filesrc location=~/traffic-30-1920x1080-30fps.mp4 ! qtdemux ! h264parse ! omxh264dec ! queue ! videoconvert ! queue ! omxh264videoenc ! filesink location=stream.h264

queue my not be necessary, but added anyway.

Setting pipeline to PAUSED …
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init ffdbe2b0

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
WARNING: omx_vdec <__AwOmxVdecSetParameter:1632>: Set Parameter called in valid state
Pipeline is PREROLLING …
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
ERROR  : omx_vdec AwOmxVdecPortGetFormat:365: erro: pParamData->nIndex > m_sPortFormatType.nIndex
ERROR  : cedarc DebugCheckConfig:396: now cedarc log level:5
WARNING: cedarc InitializeVideoDecoder:718: warning: the nDeInterlaceHoldingFrameBufferNum is 0
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
ERROR  : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffff557fa750

(gst-launch-1.0:745): GStreamer-CRITICAL **: 14:08:00.580: gst_buffer_add_meta: assertion ‘gst_buffer_is_writable (buffer)’ failed
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
New clock: GstSystemClock
WARNING: omx_venc dealWithInputBuffer:3611: skip this input buffer, impl->mInBufHdr->nTimeStamp 18100083
Got EOS from element “pipeline0”.
EOS received - stopping pipeline…
Execution ended after 0:00:04.958769868
Setting pipeline to NULL …
WARNING: cedarc VideoEncUnInit:361: the VideoEnc is not init currently

(gst-launch-1.0:745): GStreamer-CRITICAL **: 14:08:05.752: gst_mini_object_unref: assertion ‘GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0’ failed
Freeing pipeline …

The result:

It seems the default videoconvert output is YV12 1920x1088 and perhaps omxh264videoenc is expecting NV12 1920x1080.

Frame: 1 - Caps: video/x-raw, format=(string)YV12, width=(int)1920, height=(int)1088, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)24000/1001
Frame: 1 - MAPPING START
Frame: 1 - MAPPING OK
Frame: 1 - size: 3133440
Frame: 1 - UNMAPPING DONE!
ERROR : cedarc getDefaultParameter:35: getDefaultParameter. UnsupportedIndex 100663312. unkonwn param 0xffff80909750

Forcing videoconvert to NV12:

sudo gst-launch-1.0 -e filesrc location=~/traffic-30-1920x1080-30fps.mp4 ! qtdemux ! h264parse ! omxh264dec ! queue ! videoconvert ! video/x-raw,format=NV12 ! queue ! omxh264videoenc ! filesink location=stream.h264

Setting pipeline to PAUSED …
DEBUG  : cedarc CdcIniParserInit:41: load conf file /etc/cedarc.conf ok!

DEBUG  : omx_venc <__AwOmxVencComponentCreate:2309>:  COMPONENT_CREATE
DEBUG  : cedarc AwOmxComponentInit:40: OMXCORE: aw_omx_component_init 1f46d040

INFO   : cedarc <log_setlevel:73>: Set log level to 5 from /vendor/etc/cedarc.conf
WARNING: omx_vdec <__AwOmxVdecSetParameter:1632>: Set Parameter called in valid state
Pipeline is PREROLLING …
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
ERROR  : omx_vdec AwOmxVdecPortGetFormat:365: erro: pParamData->nIndex > m_sPortFormatType.nIndex
ERROR  : cedarc DebugCheckConfig:396: now cedarc log level:5
WARNING: cedarc InitializeVideoDecoder:718: warning: the nDeInterlaceHoldingFrameBufferNum is 0
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
ERROR: from element /GstPipeline:pipeline0/GstVideoConvert:videoconvert0: Failed to configure the buffer pool
Additional debug info:
../libs/gst/base/gstbasetransform.c(907): gst_base_transform_default_decide_allocation (): /GstPipeline:pipeline0/GstVideoConvert:videoconvert0:
Configuration is most likely invalid, please report this issue.
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
WARNING: omx_venc <__AwOmxVencGetParameter:896>: get_parameter erro: pParamData->nIndex > m_sInPortFormatType.nIndex,                        param index 3. impl in->index 2.
Caught SIGSEGV
#0  __lll_lock_wait (futex=futex@entry=0xaaab1f4588e0, private=0)
#1  0x0000ffffa7586d34 in __GI___pthread_mutex_lock (mutex=0xaaab1f4588e0)
#2  0x0000ffffa77f81f4 in gst_pad_stop_task
#3  0x0000ffffa61f7ce8 in gst_queue_src_activate_mode
#4  gst_queue_src_activate_mode
#5  0x0000ffffa77f1a64 in activate_mode_internal
#6  0x0000ffffa77f225c in gst_pad_set_active
#7  0x0000ffffa77c83ac in activate_pads
#8  0x0000ffffa77df268 in gst_iterator_fold
#9  0x0000ffffa77c8be0 in iterator_activate_fold_with_resync
#10 0x0000ffffa77cb0a0 in gst_element_pads_activate
#11 0x0000ffffa77cb3b8 in gst_element_change_state_func
#12 0x0000ffffa77cda1c in gst_element_change_state
#13 0x0000ffffa77ce1c4 in gst_element_set_state_func
#14 0x0000ffffa77a8134 in gst_bin_element_set_state
#15 gst_bin_change_state_func
#16 0x0000ffffa77fb5c0 in gst_pipeline_change_state
#17 0x0000ffffa77cda1c in gst_element_change_state
#18 0x0000ffffa77ce1c4 in gst_element_set_state_func
#19 0x0000aaaaea673f84 in main (argc=, argv=)
Spinning.  Please run ‘gdb gst-launch-1.0 1099’ to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

sudo gdb gst-launch-1.0 1099
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type “show copying” and “show warranty” for details.
This GDB was configured as “aarch64-linux-gnu”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from gst-launch-1.0…
Reading symbols from /usr/lib/debug/.build-id/c2/48867f68815354cc9c7627346bb86248f9c8b2.debug…
Attaching to program: /usr/bin/gst-launch-1.0, process 1099
[New LWP 1102]
[New LWP 1103]
[New LWP 1104]
[New LWP 1105]
[New LWP 1106]
[New LWP 1107]
[New LWP 1108]
[New LWP 1109]
[New LWP 1110]
[New LWP 1111]
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/aarch64-linux-gnu/libthread_db.so.1”.
–Type  for more, q to quit, c to continue without paging–
__lll_lock_wait (futex=futex@entry=0xaaab1f4588e0, private=0)
at lowlevellock.c:52
52	lowlevellock.c: No such file or directory.
(gdb) bt
#0  __lll_lock_wait (futex=futex@entry=0xaaab1f4588e0, private=0)
at lowlevellock.c:52
#1  0x0000ffffa7586d34 in __GI___pthread_mutex_lock (mutex=0xaaab1f4588e0)
at pthread_mutex_lock.c:115
#2  0x0000ffffa77f81f4 in gst_pad_stop_task
(pad=pad@entry=0xaaab1f41b9d0 [GstPad|src]) at ../gst/gstpad.c:6382
#3  0x0000ffffa61f7ce8 in gst_queue_src_activate_mode
(mode=GST_PAD_MODE_PUSH, active=0, parent=0xaaab1f44c400 [GstObject|queue1], pad=0xaaab1f41b9d0 [GstPad|src]) at ../plugins/elements/gstqueue.c:1764
#4  gst_queue_src_activate_mode
(pad=0xaaab1f41b9d0 [GstPad|src], parent=0xaaab1f44c400 [GstObject|queue1], mode=, active=)
at ../plugins/elements/gstqueue.c:1736
#5  0x0000ffffa77f1a64 in activate_mode_internal
(pad=pad@entry=0xaaab1f41b9d0 [GstPad|src], parent=parent@entry=0xaaab1f44c400 [GstObject|queue1], mode=mode@entry=GST_PAD_MODE_PUSH, active=active@entry=0) at ../gst/gstpad.c:1217
#6  0x0000ffffa77f225c in gst_pad_set_active
(pad=pad@entry=0xaaab1f41b9d0 [GstPad|src], active=0)
at ../gst/gstpad.c:1115
#7  0x0000ffffa77c83ac in activate_pads
(vpad=, ret=0xffffcf40d6c0, active=0xffffcf40d72c)
at ../gst/gstelement.c:3134
–Type  for more, q to quit, c to continue without paging–
#8  0x0000ffffa77df268 in gst_iterator_fold
(it=it@entry=0xaaab1f3ef170, func=func@entry=0xffffa77c8384 <activate_pads>, ret=ret@entry=0xffffcf40d6c0, user_data=user_data@entry=0xffffcf40d72c)
at ../gst/gstiterator.c:617
#9  0x0000ffffa77c8be0 in iterator_activate_fold_with_resync
(iter=iter@entry=0xaaab1f3ef170, user_data=user_data@entry=0xffffcf40d72c, func=) at ../gst/gstelement.c:3158
#10 0x0000ffffa77cb0a0 in gst_element_pads_activate
(element=element@entry=0xaaab1f44c400 [GstElement|queue1], active=, active@entry=0) at ../gst/gstelement.c:3194
#11 0x0000ffffa77cb3b8 in gst_element_change_state_func
(element=0xaaab1f44c400 [GstElement|queue1], transition=)
at ../gst/gstelement.c:3268
#12 0x0000ffffa77cda1c in gst_element_change_state
(element=element@entry=0xaaab1f44c400 [GstElement|queue1], transition=transition@entry=GST_STATE_CHANGE_PAUSED_TO_READY) at ../gst/gstelement.c:3046
#13 0x0000ffffa77ce1c4 in gst_element_set_state_func
(element=0xaaab1f44c400 [GstElement|queue1], state=)
at ../gst/gstelement.c:3000
#14 0x0000ffffa77a8134 in gst_bin_element_set_state
(next=GST_STATE_NULL, current=GST_STATE_READY, start_time=0 [0:00:00.000000000], base_time=0 [0:00:00.000000000], element=0xaaab1f44c400 [GstElement|queue1], bin=0xaaab1f464100 [GstBin|pipeline0]) at ../gst/gstbin.c:2630
–Type  for more, q to quit, c to continue without paging–
#15 gst_bin_change_state_func
(element=0xaaab1f464100 [GstElement|pipeline0], transition=GST_STATE_CHANGE_READY_TO_NULL) at ../gst/gstbin.c:2972
#16 0x0000ffffa77fb5c0 in gst_pipeline_change_state
(element=0xaaab1f464100 [GstElement|pipeline0], transition=GST_STATE_CHANGE_READY_TO_NULL) at ../gst/gstpipeline.c:525
#17 0x0000ffffa77cda1c in gst_element_change_state
(element=element@entry=0xaaab1f464100 [GstElement|pipeline0], transition=transition@entry=GST_STATE_CHANGE_READY_TO_NULL) at ../gst/gstelement.c:3046
#18 0x0000ffffa77ce1c4 in gst_element_set_state_func
(element=0xaaab1f464100 [GstElement|pipeline0], state=)
at ../gst/gstelement.c:3000
#19 0x0000aaaaea673f84 in main (argc=, argv=)
at ../tools/gst-launch.c:1278
(gdb)

Looks like we have a race condition here and hit hard by:

ERROR: from element /GstPipeline:pipeline0/GstVideoConvert:videoconvert0: Failed to configure the buffer pool

I’m running with GStreamer Core Library version 1.18.4

Can anyone try this pipeline on latest 1.20?

I went a little further, i did the following experiment:

I started pushing NV12 1920x1080 buffers with metadata to libcedar and using the wifi to access it via a browser from another X64 box. This kind of work but libcedar indeed accepted the NV12 1920x1088 2 planes buffers, but threw some errors and skipped a lot of buffers.

[ create NV12 1920x1088 2 planes ] –> [ push-feed ] –> encoder –> rtspclient

The next step, and that works, is to push raw NV12 1920x1080 to the encoder.

[ read raw frame ] –> pipe –> encoder –> rtspclient

I left it running for several hours until, because there was no airflow under the board, it reached 60ºC and libcedar started issuing errors.

root@radxa-cubie-a7s:/home/rock# ls /sys/class/thermal/thermal_zone*/type
/sys/class/thermal/thermal_zone0/type /sys/class/thermal/thermal_zone4/type
/sys/class/thermal/thermal_zone1/type /sys/class/thermal/thermal_zone5/type
/sys/class/thermal/thermal_zone2/type /sys/class/thermal/thermal_zone6/type
/sys/class/thermal/thermal_zone3/type /sys/class/thermal/thermal_zone7/type
root@radxa-cubie-a7s:/home/rock# cat /sys/class/thermal/thermal_zone*/type
cpul_thermal_zone
cpub_thermal_zone
cpul_idle_zone
cpub_idle_zone
gpu_thermal_zone
npu_thermal_zone
ddr_thermal_zone
skin_zone
root@radxa-cubie-a7s:/home/rock# cat /sys/class/thermal/thermal_zone*/temp
61566
60884
60884
61566
60264
60512
60016
36313

Note that inference was not done yet and the FPS was 22~43 FPS. And CPU was a bit high but acceptable.



top - 21:15:51 up 1 day, 7 min,  4 users,  load average: 2.14, 1.64, 0.93
Tasks: 175 total,   1 running, 174 sleeping,   0 stopped,   0 zombie
%Cpu(s): 11.4 us,  5.0 sy,  0.0 ni, 83.5 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem :   3907.8 total,   1925.0 free,   1399.1 used,    583.7 buff/cache
MiB Swap:   1953.9 total,   1953.9 free,      0.0 used.   2439.6 avail Mem

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND  

4373 root      20   0  350532  40904  10412 S  69.5   1.0   7:21.00 gst-cam+
4377 root      20   0 1069808  54088  17312 S  44.0   1.4   6:17.67 gst-lau+
3635 rock      20   0 1256216  30500  15420 S   3.6   0.8   1:19.90 mediamtx
4409 root      20   0       0      0      0 I   3.3   0.0   0:03.88 kworker+
4399 root      20   0       0      0      0 I   2.6   0.0   0:06.98 kworker+
4239 root      20   0       0      0      0 I   2.0   0.0   0:06.68 kworker+
4020 root      20   0       0      0      0 I   1.7   0.0   0:14.24 kworker+
4404 root      20   0       0      0      0 I   1.7   0.0   0:04.68 kworker+
4303 root      20   0       0      0      0 I   1.0   0.0   0:06.72 kworker+
4299 root      20   0       0      0      0 I   0.7   0.0   0:07.60 kworker+
478 root      -2   0       0      0      0 S   0.3   0.0   1:01.10 aicwf_b+
479 root      -2   0       0      0      0 S   0.3   0.0   0:33.79 aicwf_b+
4407 root      20   0       0      0      0 I   0.3   0.0   0:02.02 kworker+
4425 root      20   0       0      0      0 I   0.3   0.0   0:00.03 kworker+
4431 root      20   0       0      0      0 I   0.3   0.0   0:00.58 kworker+
4433 rock      20   0    9964   3348   2728 R   0.3   0.1   0:00.27 top
1 root      20   0  165240   9784   7296 S   0.0   0.2   0:03.46 systemd

According to some dev here, the inference is ~15 ms so i would expect to reach around 16 FPS.