Beaglebone ai-64 edge_ai_apps [ERROR] Could not get allowed GstCaps of device

Hi, everyone

I used the image form here, after i flash it in sd card and boot, i update and upgrade the software, after that I follow the guide, and i try to run demo by python, but out put error

[ERROR] Could not get allowed GstCaps of device

debian@BeagleBone:/opt/edge_ai_apps/apps_python$ sudo python3 app_edgeai.py ../configs/image_classification.yaml 
[sudo] password for debian: 
2023-04-05 11:48:07,547 INFO Could not find libdlr.so in model artifact. Using dlr from /usr/dlr/libdlr.so
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=4) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
  3862.411629 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
  3862.411701 s:  VX_ZONE_INIT:Enabled
  3862.411714 s:  VX_ZONE_ERROR:Enabled
  3862.411720 s:  VX_ZONE_WARNING:Enabled
  3862.412380 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
  3862.412545 s:  VX_ZONE_INIT:[tivxHostInitLocal:86] Initialization Done for HOST !!!
[GST SRC STR]
[FLOW 0]
multifilesrc location=/opt/edge_ai_apps/data/images/%04d.jpg loop=true caps=image/jpeg,framerate=1/1  ! jpegdec  ! videoscale ! video/x-raw, width=1280, height=720 ! tiovxdlcolorconvert ! video/x-raw, format=NV12 ! tiovxmultiscaler name=split_01 
split_01. ! queue ! video/x-raw, width=454, height=256 ! tiovxdlcolorconvert out-pool-size=4 ! video/x-raw, format=RGB ! videobox left=115 right=115 top=16 bottom=16 ! tiovxdlpreproc data-type=10 target=0 channel-order=0 mean-0=123.675000 mean-1=116.280000 mean-2=103.530000 scale-0=0.017125 scale-1=0.017507 scale-2=0.017429 tensor-format=rgb out-pool-size=4 ! application/x-tensor-tiovx ! appsink name=pre_0 max-buffers=2 drop=true 
split_01. ! queue ! video/x-raw, width=1280, height=720 ! tiovxdlcolorconvert target=1 out-pool-size=4 ! video/x-raw, format=RGB ! appsink name=sen_0 max-buffers=2 drop=true 

[GST SINK STR]
appsrc format=GST_FORMAT_TIME is-live=true block=true do-timestamp=true name=post_0 ! tiovxdlcolorconvert ! video/x-raw,format=NV12, width=1280, height=720 ! queue ! mosaic_0.sink_0 
tiovxmosaic name=mosaic_0 background=/tmp/background_0
sink_0::startx=320  sink_0::starty=180  sink_0::width=1280   sink_0::height=720  
! video/x-raw,format=NV12, width=1920, height=1080 ! kmssink sync=false driver-name=tidss 

[ERROR] Could not get allowed GstCaps of device
  3862.660665 s:  VX_ZONE_ERROR:[vxGetStatus:713] Reference is NULL
  3862.666662 s:  VX_ZONE_INIT:[tivxHostDeInitLocal:100] De-Initialization Done for HOST !!!
  3862.670211 s:  VX_ZONE_INIT:[tivxDeInitLocal:193] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
MEM: Alloc's: 15 alloc's of 42668924 bytes 
MEM: Free's : 15 free's  of 42668924 bytes 
MEM: Open's : 0 allocs  of 0 bytes 
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!

and i also tried use c++, but still no work

root@BeagleBone:/opt/edge_ai_apps/apps_cpp# ./bin/Release/app_edgeai ../configs/image_classification.yaml 
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=4) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
  1096.133918 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
  1096.134291 s:  VX_ZONE_INIT:Enabled
  1096.134386 s:  VX_ZONE_ERROR:Enabled
  1096.134499 s:  VX_ZONE_WARNING:Enabled
  1096.135277 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
  1096.137995 s:  VX_ZONE_INIT:[tivxHostInitLocal:86] Initialization Done for HOST !!!
[18:59:32] ./tmp/opt/neo-ai-dlr/src/dlr.cc:243: Error: No metadata file was found!
[18:59:32.000.000000]:WARN:[populateOutputInfo:0249] GetDLROutputName(0) NULL.
[18:59:32.092.092827]:ERROR:[startPipeline:0166] gst_element_set_state() failed.
[18:59:32.092.092886]:ERROR:[setupFlows:0178] Failed to start GST pipelines.
terminate called after throwing an instance of 'std::runtime_error'
  what():  EdgeAIDemo object creation failed.
Aborted

only use kmssink or vedio.mkv would output error, if use jpg output it success.

use vedio output have this error

debian@BeagleBone:/opt/edge_ai_apps/apps_python$ sudo ./app_edgeai.py ../configs/object_detection.yaml 

 Number of subgraphs:1 , 129 nodes delegated out of 129 nodes 
 
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=5) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
  6799.047374 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
  6799.047725 s:  VX_ZONE_INIT:Enabled
  6799.047823 s:  VX_ZONE_ERROR:Enabled
  6799.047945 s:  VX_ZONE_WARNING:Enabled
  6799.048702 s:  VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!!
  6799.053666 s:  VX_ZONE_INIT:[tivxHostInitLocal:86] Initialization Done for HOST !!!
[ERROR] no property "bitrate" in element "v4l2h264enc0"
[GST STR] appsrc format=GST_FORMAT_TIME is-live=true block=true do-timestamp=true name=post_0 ! tiovxdlcolorconvert ! video/x-raw,format=NV12, width=1280, height=720 ! queue ! mosaic_0.sink_0 
tiovxmosaic name=mosaic_0 background=/tmp/background_0
sink_0::startx=320  sink_0::starty=180  sink_0::width=1280   sink_0::height=720  
! video/x-raw,format=NV12, width=1920, height=1080 ! v4l2h264enc bitrate=10000000 ! h264parse ! matroskamux !  filesink location=/opt/edge_ai_apps/data/output/videos/output_video.mkv 

I got the same issue. Anyone can help us?

@ZIFENG278 , @alexhegit

 [ERROR] Could not get allowed GstCaps of device

The above error means that the output from the .yaml file to kmssink is not displayed because there is no monitor.
Plug in your monitor and run it.
Or try modifying your .yaml to use appsink instead of kmssink.

[ERROR] no property "bitrate" in element "v4l2h264enc0"

With a few tweaks to the code, it should run.
In gst_wrapper.py,
Find the partial.

def get_output_str(output):
    """
    Construct the gst output strings
    Args:
        output: output configuration
    """
    image_enc = {'.jpg':' jpegenc ! '}
    video_enc = {'.mov':' v4l2h264enc bitrate=1000000 ! h264parse ! qtmux ! ', \
                 '.mp4':' v4l2h264enc extra-controls="encode,video_bitrate=368640,video_bitrate_mode=1,h264_level=10,h264_profile=0;" ! ', \
                 '.mkv':' v4l2h264enc bitrate=1000000 ! h264parse ! matroskamux ! '}

v4l2h264enc bitrate=1000000 ! h264parse ! qtmux !

to

v4l2h264enc extra-controls=“encode,video_bitrate=368640,video_bitrate_mode=1,h264_level=10,h264_profile=0;” !

Fix it and run it

It works after plug-in the monitor. Thank you, ALEX!