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:
- 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
- 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
^
-
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:
- 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
- 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
^
- 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?


