This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: OpenCV video capture issue

Part Number: AM5728

Hello,
      When i play rtsp video stream using command line, its working fine.But with VideoCapture function of OpenCV,it could not. Please check the below command:

---------------------
gst-launch-1.0 -v rtspsrc location="rtsp://admin:admin@192.168.1.2:554" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! waylandsink
---------------------(WORKING FINE)

----------------------
cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.2:554\" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink ");
----------------------(Not Working).

Error log as below:
-------------------

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion 'structure != NULL' failed
GStreamer Plugin: Embedded video playback halted; module udpsrc8 reported: Internal data stream error.
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in icvStartPipeline, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 393
terminate called after throwing an instance of 'cv::Exception'
  what():  /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:393: error: (-2) GStreamer: unable to start pipeline
 in function icvStartPipeline

Aborted (core dumped)

What should i make changes in this function?.

Regards,

Kishan Patel

  • Hello Kishan Patel,

    If you try to capture by using v4l2src from camera module for example is it working?

    Here is some suggestions that you could try:
    1. Try to replace ducatih264dec with avdec_h264.
    2. Add caps filter between rtspsrc and rtph264depay(not necessary but you could try).
    3. Add this 'video/x-raw, format=BGR' capsfilter before appsink.
    4. Remove the space after appsink and ".
    I would recommend you to check this link(receiving side):
    stackoverflow.com/.../how-to-open-a-gstreamer-pipeline-from-opencv-with-videowriter
    You could add gst debug for more debug prints.

    Hope this helps.

    BR
    Margarita
  • Hello Margarita,
    I have make some changes as you told and share the result.Please, check it below"
    1).cv::VideoCapture cap("v4l2src device=/dev/video1 ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! videoconvert ! appsink");

    >This is working fine.

    2).cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.4:554\" ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! videoconvert ! appsink");

    >Not working.

    3).cv::VideoCapture cap("v4l2src device=/dev/video1 latency=0 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink ");

    >Not working.

    4).cv::VideoCapture cap("v4l2src device=/dev/video1 latency=0 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw, format=BGR ! appsink");

    >Not Working.

    Regards,
    Kishan Patel.
  • Hello Margarita,
    I had many changes and also check gstreamer guide with examples.But could not understand what is require here to play rtsp stream using opencv and decode using gstreamer.

    Regards,
    Kishan Patel.
  • Hello,

    I am sorry but I can not understand pipelines 2,3,4.
    However I meant to try something like this:

    ...("rtspsrc location=rtsp://.... ! application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw, format=BGR ! appsink",CAP_GSTREAMER);

    I would recommend you to check the link in the previous post "reciever" side.

    Hope this helps.

    BR
    Margarita

  • Hello Margarita,
    Actually, 1st one is about v4l2src which is working. So, I was make same api for rtspsrc in 2nd one which not working.
    3rd one is that which i had posted in previous thread and make changes as you suggested in 3rd one and made 4th one which are not working.

    In link which you shared, I can not found examples related rtspsrc.
    If you can find anything wrong in 4th one, please tell me and if you can modified as require in actual.Please.

    I will test it and report as you suggest caps and extra parameters.

    I have stuck here from very long time. I dont understand whats wrong in this.

    If i use gst-launch-1.0 with command line,all working fine. But same thing it could not work with opencv.

    Can you modified line of my code in actual format. By which i can read and decode rtsp stream in opencv using gstreamer.

    Regards,
    Kishan Patel.

  • Hello,

    The other thing that you could check is the location correct.

    BR
    Margarita
  • Hello Margarita,
    I have checked it using gst-launch-1.0 coomand as below and its working fine.
    "gst-launch-1.0 -v rtspsrc location="rtsp://admin:admin@192.168.1.2:554" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! waylandsink sync=false"

    I have used below line in code, can you modified it?
    cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.4:554\" latency=0 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink ")

    Regards,
    Kishan Patel.
  • Hello Margarita,

              Can i check gstreamer source code or bin file?

    Regards,

    Kishan Patel.

  • Hello,

    I would recommend you in this line to change the coded with the software codec:

    cv::VideoCapture cap("rtspsrc location=rtsp://admin:admin@192.168.1.4:554 latency=0  ! avdec_h264 ! videoconvert ! appsink ")

    since I know the ducati codecs are not tested with opencv.  

    But first verify the pipeline with gst-launch. You could add --gst-debug=3 for more debug prints.

    kishan patel14 said:
              Can i check gstreamer source code or bin file?

    Which plugin? You know that there are bad, good, base etc.

    You could build the source code by executing MACHINE=am57xx-evm bitbake gstreamer1.0-plugins-good for example.
    In additional please check  this chapter of the guide:

    http://processors.wiki.ti.com/index.php/Processor_Training:_Multimedia#DSP_C66x_Gstreamer_Plugin_Internals

    is it helpful.

    Hope this helps.

    BR
    Margarita

  • Hello Margarita,
    I have tested gstreamer as you told. Please, check the following command with its output.

    gst-launch-1.0 --gst-debug=3 rtspsrc location=rtsp://admin:admin@192.168.1.4:554 latency=0 ! avdec_h264 ! videoconvert ! waylandsink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Progress: (open) Opening Stream
    Progress: (connect) Connecting to rtsp://admin:admin@192.168.1.4:554
    0:00:03.232505854 1574 0x19e5b0 ERROR default gstrtspconnection.c:961:gst_rtsp_connection_connect_with_response: failed to connect: Could not connect to 192.168.1.4: No route to host
    0:00:03.232692431 1574 0x19e5b0 ERROR rtspsrc gstrtspsrc.c:4206:gst_rtsp_conninfo_connect:<rtspsrc0> Could not connect to server. (Generic error)
    0:00:03.232750177 1574 0x19e5b0 WARN rtspsrc gstrtspsrc.c:6775:gst_rtspsrc_retrieve_sdp:<rtspsrc0> error: Failed to connect. (Generic error)
    0:00:03.232950418 1574 0x19e5b0 WARN rtspsrc gstrtspsrc.c:6854:gst_rtspsrc_open:<rtspsrc0> can't get sdp
    0:00:03.233026057 1574 0x19e5b0 WARN rtspsrc gstrtspsrc.c:5137:gst_rtspsrc_loop:<rtspsrc0> we are not connected
    ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
    Additional debug info:
    ../../../gst-plugins-good-1.12.2/gst/rtsp/gstrtspsrc.c(6775): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
    Failed to connect. (Generic error)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...


    ===========================
    gst-launch-1.0 --gst-debug=3 rtspsrc location=rtsp://admin:admin@192.168.1.2:554 latency=0 ! avdec_h264 ! videoconvert ! waylandsink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Progress: (open) Opening Stream
    Progress: (connect) Connecting to rtsp://admin:admin@192.168.1.2:554
    0:00:00.118023996 1578 0x19e5b0 ERROR default gstrtspconnection.c:961:gst_rtsp_connection_connect_with_response: failed to connect: Could not connect to 192.168.1.2: Connection refused
    0:00:00.118280031 1578 0x19e5b0 ERROR rtspsrc gstrtspsrc.c:4206:gst_rtsp_conninfo_connect:<rtspsrc0> Could not connect to server. (Generic error)
    0:00:00.118386739 1578 0x19e5b0 WARN rtspsrc gstrtspsrc.c:6775:gst_rtspsrc_retrieve_sdp:<rtspsrc0> error: Failed to connect. (Generic error)
    0:00:00.118577871 1578 0x19e5b0 WARN rtspsrc gstrtspsrc.c:6854:gst_rtspsrc_open:<rtspsrc0> can't get sdp
    ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
    Additional debug info:
    ../../../gst-plugins-good-1.12.2/gst/rtsp/gstrtspsrc.c(6775): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
    Failed to connect. (Generic error)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    0:00:00.118848383 1578 0x19e5b0 WARN rtspsrc gstrtspsrc.c:5137:gst_rtspsrc_loop:<rtspsrc0> we are not connected
    Setting pipeline to NULL ...
    Freeing pipeline ...


    ===============================

    gst-launch-1.0 rtspsrc location=rtsp://admin:admin@192.168.1.2:554 latency=0 ! avdec_h264 ! videoconvert ! waylandsink
    gst-launch-1.0 rtspsrc location="rtsp://admin:admin@192.168.1.2:554" latency=0 ! avdec_h264 ! videoconvert ! waylandsink --gst-debug=3
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Progress: (open) Opening Stream
    Progress: (connect) Connecting to rtsp://admin:admin@192.168.1.2:554
    0:00:00.117053847 1591 0x19e5b0 ERROR default gstrtspconnection.c:961:gst_rtsp_connection_connect_with_response: failed to connect: Could not connect to 192.168.1.2: Connection refused
    0:00:00.117316063 1591 0x19e5b0 ERROR rtspsrc gstrtspsrc.c:4206:gst_rtsp_conninfo_connect:<rtspsrc0> Could not connect to server. (Generic error)
    0:00:00.117422771 1591 0x19e5b0 WARN rtspsrc gstrtspsrc.c:6775:gst_rtspsrc_retrieve_sdp:<rtspsrc0> error: Failed to connect. (Generic error)
    0:00:00.117614879 1591 0x19e5b0 WARN rtspsrc gstrtspsrc.c:6854:gst_rtspsrc_open:<rtspsrc0> can't get sdp
    ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
    Additional debug info:
    ../../../gst-plugins-good-1.12.2/gst/rtsp/gstrtspsrc.c(6775): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
    Failed to connect. (Generic error)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    0:00:00.117895964 1591 0x19e5b0 WARN rtspsrc gstrtspsrc.c:5137:gst_rtspsrc_loop:<rtspsrc0> we are not connected
    Setting pipeline to NULL ...
    Freeing pipeline ...

    ================================

    gst-launch-1.0 -v rtspsrc location="rtsp://admin:admin@192.168.1.2:554" latency=0 ! avdec_h264 ! videoconvert ! videosink=waylandsink --gst-debug=3
    0:00:00.097152566 1599 0x18b320 WARN default grammar.y:1137:priv_gst_parse_yyerror: Error during parsing: syntax error, unexpected ASSIGNMENT, expecting IDENTIFIER or BINREF or '('
    0:00:00.097425030 1599 0x18b320 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error
    0:00:00.097534178 1599 0x18b320 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error
    0:00:00.097622506 1599 0x18b320 ERROR GST_PIPELINE grammar.y:1125:priv_gst_parse_yyparse: empty pipeline not allowed
    ERROR: pipeline could not be constructed: syntax error.

    Regards,
    Kishan Patel.
  • kishan patel14 said:
    ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
    Additional debug info:
    ../../../gst-plugins-good-1.12.2/gst/rtsp/gstrtspsrc.c(6775): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
    Failed to connect. (Generic error)

    This indicates that your camera feed could actually not be opened at all.

    Check you camera connection.

    BR
    Margarita

  • Hello,
    I have checked connection, and by mistake i had used wrong ip-address which i have changed. Not output shows as below:

    api:
    ====
    cv::VideoCapture cap("rtspsrc location=rtsp://admin:admin@192.168.1.3:554 latency=0 ! avdec_h264 ! videoconvert ! appsink ");

    output:
    =======
    ./play_rtsp_stream
    GStreamer Plugin: Embedded video playback halted; module udpsrc3 reported: Internal data stream error.
    OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
    ) in cvCaptureFromCAM_GStreamer, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 830
    terminate called after throwing an instance of 'cv::Exception'
    what(): /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:830: error: (-2) GStreamer: unable to start pipeline
    in function cvCaptureFromCAM_GStreamer

    Aborted (core dumped)


    Regards,
    Kishan Patel.
  • Hello,

    Please try first the pipeline is it working with gst-launch-1.0.
    If is working you could try to execute the demo by this ./play_rtsp_stream --gst-debug=3.

    BR
    Margarita
  • Hello Margarita,
    As i have discussed in 1st thread, please check the below log:

    API:
    ====
    gst-launch-1.0 -v rtspsrc location="rtsp://admin:admin@192.168.1.2:554" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! waylandsink sync=false

    Its working fine.

    API:
    ====
    cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.2:554\" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink ");

    Its not working.

    Regards,
    Kishan Patel.
  • Hello,

    I perfectly understand this. But if you made a research this is common issue with gst rtspsrc and OpenCV.
    Please try something like:
    ("rtspsrc location=rtsp://admin:admin@192.168.1.2:554 latency=10 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink");
    You do not need the quotes and \ there are needed only for shell with gst-launch.

    BR
    Margarita
  • Hello Margarita,
    I am sending all api which i have tested.Please check as below:

    /*----Video_1(v4l2src)----WORKING_FINE----*/
    //cv::VideoCapture cap("v4l2src device=/dev/video1 ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! videoconvert ! appsink");



    //cv::VideoCapture cap("rtspsrc location=rtsp://admin:admin@192.168.1.3:554 latency=0 ! avdec_h264 ! videoconvert ! appsink ");
    cv::VideoCapture cap("rtspsrc location=rtsp://admin:jenex#2018@192.168.1.108:554 latency=10 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink");

    //cv::VideoCapture cap("rtspsrc location=rtsp://admin:admin@192.168.1.2:554 latency=0 ! rtph264depay ! decodebin ! appsink name=sink sync=true caps=\"video/x-raw,height=480,pixel-aspect-ratio=1/1\" ! appsink");


    //cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.4:554\" latency=200 ! rtpjpegdepay ! jpegdec ! videoscale ! video/x-raw,format=RGB,width=480,height=272 ! videorate ! capsfilter caps=\"video/x-raw-yuv,width=480,height=272,framerate=(fraction)12/1\" ! queue ! ffmpegcolorspace ! faceblur ! autovideosink");

    //cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.4:554\" latency=0 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink ");
    //cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.4:554\" latency=0 ! rtph264depay ! h264parse ! queue ! ducatih264dec ! videoconvert ! videocrop ! videoflip ! glimagesink");
    //cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.4:554\" latency=0 ! decodebin ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw, format=BGR ! appsink");
    //cv::VideoCapture cap("rtspsrc location=rtsp://admin:admin@192.168.1.4:554 ! videoconvert ! appsink ");
    //cv::VideoCapture cap("videotestsrc ! videoconvert ! appsink");
    //cv::VideoCapture cap("videotestsrc pattern=ball ! videoconvert ! appsink");

    //cv::VideoCapture cap("rtspsrc location=rtsp://888888:888888@192.168.1.6:554/cam/realmonitor?channel=1&subtype=1 --live --fps 25 ! decodebin ! queue ! videoconvert ! queue ! appsink", 0);
    //cv::VideoCapture cap("rtsp://admin:jenex#2018@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1 --live --fps 25", 0);
    //cv::VideoCapture cap("rtsp://admin:admin@192.168.1.4:554/cam/realmonitor?channel=1&subtype=1 --live --fps 25", 0);
    //cv::VideoCapture cap("rtsp://888888:888888@192.168.1.6:554/cam/realmonitor?channel=1&subtype=1 --live --fps 25", 0);
    //cv::VideoCapture cap("rtsp://888888:888888@192.168.1.6:554/cam/realmonitor?channel=1&subtype=0 --live --fps 25", 0);



    //cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.2:554\" ! video/x-raw,width=1920,height=1080,format=(string)UYVY ! nvvidconv ! video/x-raw(memory:NVMM),width=1920,height=1080,format=(string)I420 ! nvvidconv! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink ");


    Regards,
    Kishan Patel.
  • Hello,

    What is the output of this one:

    ("rtspsrc location=rtsp://192.168.1.2/test latency=10 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink");

    Please first verify the pipeline with gst-launch first.

    Gstreamer point of view these errors :

    (play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

    (play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

    ....

    could means that some plugin is missing or not well installed for example. That is why I am asking to try with the software codec instead of ducati. I guess you have buil the opencv with gstreamer on since the pipe with v4l2src is working. 

    Again gstreamer point of view this error udpsrc8 : Internal data stream error, could means some element in not linked or not-negotiated or else. Unfortunate I do not see the error's code like (-1), (-4) (-5)etc. So I would recommend to try gst debug for more prints if possible.

    Hope this helps.

    BR
    Margarita

  • Hello Margarita,
    I have tested api as your suggestion with gst-launch. Output log as below:

    api:
    ====
    gst-launch-1.0 -v rtspsrc location="rtsp://admin:jenex#2018@192.168.1.108/test" latency=10 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! waylandsink

    output:
    =======
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Progress: (open) Opening Stream
    Progress: (connect) Connecting to rtsp://admin:jenex#2018@192.168.1.108/test
    Progress: (open) Retrieving server options
    ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading.
    Additional debug info:
    ../../../gst-plugins-good-1.12.2/gst/rtsp/gstrtspsrc.c(5338): gst_rtspsrc_setup_auth (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
    No supported authentication protocol was found
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...


    Then i use another api as below:

    api:
    ===
    gst-launch-1.0 -v rtspsrc location="rtsp://admin:jenex#2018@192.168.1.108" latency=10 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! waylandsink


    And this working fine. Here i can not add "test" after rtsp source as you told.

    I have also execute application with gst-debug but it shows same error as below:

    root@am57xx-evm:~/Test_Opencv_Gstreamer# ./play_rtsp_stream --gst-debug=3

    (play_rtsp_stream:1404): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

    (play_rtsp_stream:1404): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

    (play_rtsp_stream:1404): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (play_rtsp_stream:1404): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (play_rtsp_stream:1404): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (play_rtsp_stream:1404): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion 'structure != NULL' failed
    GStreamer Plugin: Embedded video playback halted; module udpsrc5 reported: Internal data stream error.
    OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
    ) in icvStartPipeline, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 393
    terminate called after throwing an instance of 'cv::Exception'
      what():  /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:393: error: (-2) GStreamer: unable to start pipeline
     in function icvStartPipeline

    Aborted (core dumped)

    ================================


    root@am57xx-evm:~/Test_Opencv_Gstreamer# ./play_rtsp_stream --gst-debug  

    (play_rtsp_stream:1437): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

    (play_rtsp_stream:1437): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

    (play_rtsp_stream:1437): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (play_rtsp_stream:1437): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (play_rtsp_stream:1437): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (play_rtsp_stream:1437): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion 'structure != NULL' failed
    GStreamer Plugin: Embedded video playback halted; module udpsrc9 reported: Internal data stream error.
    OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
    ) in icvStartPipeline, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 393
    terminate called after throwing an instance of 'cv::Exception'
      what():  /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:393: error: (-2) GStreamer: unable to start pipeline
     in function icvStartPipeline

    Aborted (core dumped)

    Regards,
    Kishan Patel.

  • Hello,

    This //192.168.1.2/test was an example there is no way I to know your IP etc.

    BR
    Margarita
  • Hello Margarita,
    If i add "/test" it was not working as an example.
    Now, what should be next?
    What should we do?.

    Regards,
    Kishan Patel.
  • Hello,

    Could you provide the code not only line of it?

    BR
    Margarita
  • play_rtsp_stream.cppHello Margarita,

              I am attaching simple code of opencv which read stream and display it.

    Regards,

    Kishan Patel.

  • Hello Margarita,

              Have you find something?.

    I dont understand what should be wrong?.

    If rtsp stream playing fine with gst-launch then it should be also work with opencv function and may be lag should be reduce.

    Regards,

    Kishan Patel.

  • Hello Margarita,
    I have tested api as "cv::VideoCapture cap("rtspsrc location=rtsp://admin:jenex#2018@192.168.1.108:554 latency=0 ! avdec_h264 ! videoconvert ! appsink ");" with debug print enable.You can check log as below:

    ./play_rtsp_stream
    init done
    Using Wayland-EGL
    wlpvr: PVR Services Initialised
    Using the 'xdg-shell-v5' shell integration
    0:00:00.257577834 3729 0xb0d0e800 FIXME default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
    0:00:00.257883319 3729 0xb0d0e830 FIXME default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc1:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
    0:00:00.325832775 3729 0xb0d0e920 WARN basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc2> error: Internal data stream error.
    0:00:00.325900769 3729 0xb0d0e920 WARN basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc2> error: streaming stopped, reason not-linked (-1)
    0:00:00.352851552 3729 0xb0a08890 WARN default grammar.y:510:gst_parse_no_more_pads:<rtspsrc0> warning: Delayed linking failed.
    0:00:00.353072451 3729 0xb0a08890 WARN default grammar.y:510:gst_parse_no_more_pads:<rtspsrc0> warning: failed delayed linking some pad of GstRTSPSrc named rtspsrc0 to some pad of avdec_h264 named avdec_h264-0
    0:00:00.359840280 3729 0xb0d0e8c0 WARN basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc0> error: Internal data stream error.
    0:00:00.359895586 3729 0xb0d0e8c0 WARN basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc0> error: streaming stopped, reason not-linked (-1)
    GStreamer Plugin: Embedded video playback halted; module udpsrc0 reported: Internal data stream error.
    0:00:00.362857060 3729 0x2ad430 WARN rtspsrc gstrtspsrc.c:5466:gst_rtspsrc_try_send:<rtspsrc0> receive interrupted
    0:00:00.362913505 3729 0x2ad430 WARN rtspsrc gstrtspsrc.c:7519:gst_rtspsrc_pause:<rtspsrc0> PAUSE interrupted
    0:00:00.366157203 3729 0x2ad430 WARN rtspsrc gstrtspsrc.c:5439:gst_rtspsrc_try_send:<rtspsrc0> send interrupted
    0:00:00.366296118 3729 0x2ad430 WARN rtspsrc gstrtspsrc.c:6974:gst_rtspsrc_close:<rtspsrc0> TEARDOWN interrupted
    OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
    ) in cvCaptureFromCAM_GStreamer, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 830
    terminate called after throwing an instance of 'cv::Exception'
    what(): /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:830: error: (-2) GStreamer: unable to start pipeline
    in function cvCaptureFromCAM_GStreamer

    ============================

    api:

    ====

    cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:jenex#2018@192.168.1.108:554\" latency=0 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink",cv::CAP_GSTREAMER);

    output:

    =======

    init done
    Using Wayland-EGL
    wlpvr: PVR Services Initialised
    Using the 'xdg-shell-v5' shell integration
    0:00:00.267584288  3812 0xb0a0ea00 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
    0:00:00.267864397  3812 0xb0a0ea30 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc1:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
    0:00:00.361636553  3812 0xb0a0eb50 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc2> error: Internal data stream error.
    0:00:00.361704222  3812 0xb0a0eb50 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc2> error: streaming stopped, reason not-linked (-1)
    0:00:00.384619820  3812 0xb0709090 WARN                  ducati gstducatih264dec.c:415:gst_ducati_h264dec_set_sink_caps:<ducatih264dec0> num-reorder-frames not found on caps, calculation from stream parameters gives 5
    0:00:00.384693345  3812 0xb0709090 WARN                  ducati gstducatih264dec.c:423:gst_ducati_h264dec_set_sink_caps:<ducatih264dec0> Using 5 frames for reordering
    0:00:00.398624628  3812 0xb0709090 WARN                  ducati gstducatividdec.c:590:codec_process:<ducatih264dec0> changing max-ref-frames in caps to 11

    (play_rtsp_stream:3812): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

    (play_rtsp_stream:3812): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

    (play_rtsp_stream:3812): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (play_rtsp_stream:3812): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (play_rtsp_stream:3812): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (play_rtsp_stream:3812): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion 'structure != NULL' failed
    0:00:00.811383382  3812 0xb0709090 WARN                  ducati gstducatividdec.c:753:codec_process:<ducatih264dec0> push failed flushing
    0:00:00.811520021  3812 0xb0709090 WARN                  ducati gstducatividdec.c:1476:gst_ducati_viddec_chain:<ducatih264dec0> push from codec_process failed flushing
    0:00:00.817990673  3812 0xb0a36ee0 WARN                  ducati gstducatividdec.c:570:codec_process:<ducatih264dec0> err=-1, extendedError=00040000
    0:00:00.818022880  3812 0xb0a36ee0 ERROR                 ducati gstducati.c:61:gst_ducati_log_extended_error_info: Bit 18 (00040000): stream end
    0:00:00.818712580  3812   0x288460 WARN                 rtspsrc gstrtspsrc.c:5466:gst_rtspsrc_try_send:<rtspsrc0> receive interrupted
    0:00:00.818754548  3812   0x288460 WARN                 rtspsrc gstrtspsrc.c:7519:gst_rtspsrc_pause:<rtspsrc0> PAUSE interrupted
    0:00:00.824040673  3812   0x288460 WARN                 rtspsrc gstrtspsrc.c:5625:gst_rtspsrc_send:<rtspsrc0> error: Unhandled error
    0:00:00.824074507  3812   0x288460 WARN                 rtspsrc gstrtspsrc.c:5625:gst_rtspsrc_send:<rtspsrc0> error: Method Not Valid in This State (455)
    0:00:00.824163810  3812   0x288460 WARN                 rtspsrc gstrtspsrc.c:6972:gst_rtspsrc_close:<rtspsrc0> error: Could not send message. (Generic error)
    0:00:00.967756359  3812 0xb0709090 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc2:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
    0:00:00.968810917  3812 0xb0a0eac0 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc3:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
    0:00:01.031383759  3812 0xb0a0eaf0 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc5> error: Internal data stream error.
    0:00:01.031445084  3812 0xb0a0eaf0 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc5> error: streaming stopped, reason not-linked (-1)
    0:00:01.049341164  3812 0xb0a0eb20 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc8> error: Internal data stream error.
    0:00:01.049394356  3812 0xb0a0eb20 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc8> error: streaming stopped, reason not-linked (-1)
    GStreamer Plugin: Embedded video playback halted; module udpsrc8 reported: Internal data stream error.
    0:00:01.051189690  3812 0xb0a41e30 WARN                 rtspsrc gstrtspsrc.c:5466:gst_rtspsrc_try_send:<rtspsrc0> receive interrupted
    0:00:01.051248737  3812 0xb0a41e30 WARN                 rtspsrc gstrtspsrc.c:7519:gst_rtspsrc_pause:<rtspsrc0> PAUSE interrupted
    0:00:01.055205238  3812 0xb0a41e30 WARN                 rtspsrc gstrtspsrc.c:5439:gst_rtspsrc_try_send:<rtspsrc0> send interrupted
    0:00:01.055250622  3812 0xb0a41e30 WARN                 rtspsrc gstrtspsrc.c:6974:gst_rtspsrc_close:<rtspsrc0> TEARDOWN interrupted
    OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
    ) in icvStartPipeline, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 393
    terminate called after throwing an instance of 'cv::Exception'
      what():  /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:393: error: (-2) GStreamer: unable to start pipeline
     in function icvStartPipeline

    Aborted (core dumped)

    Aborted (core dumped)

  • Hello,

    Great here is the reason for the error :

    0:00:00.325900769 3729 0xb0d0e920 WARN basesrc gstbasesrc.c:2939:gst_base_src_loop:<udpsrc2> error: streaming stopped, reason not-linked (-1)

    Please add h264parse between rtspsrc and decoder.

    If is possible increase gstreamer debug level to 3 also.

    BR
    Margarita
  • Hello Margarita,
    I have already used "h264parse" in api. Please check it as below:

    api:
    ====
    cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:jenex#2018@192.168.1.108:554\" latency=0 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink",cv::CAP_GSTREAMER);


    And i have exported debug-print as : "export GST_DEBUG=3". May be it means debug level is 2.

    You can tell me which is require to solve this issue. I am waiting.Please.

    Regards,
    Kishan Patel.
  • Hello,

    Please do not edit the post because I do not see the changes except if I reopen your answer again :)
    Please add h264parse in first case where you are using the software codec and increase the gst debug level to 3. I want to see which pads are not linked.
    Since I know our codec is not tested in opencv application same for gstreamer in Opencv, will be better first to run the case with avdec_h264.

    BR
    Margarita

  • opencv_gstreamer_debug_log.txtHello Margarita,

              Okay, I will not edit post. I have changed debug level to 4. Please check the api and output-log as below:

    api:

    ====

    cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:jenex#2018@192.168.1.108:554\" latency=0 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink",cv::CAP_GSTREAMER);

    Output-log:

    ===========

    I am attaching file. Please check the attached file.

    Regards,

    Kishan Patel.

  • Thanks. I will take a look.
    Please remove ''" and \\ and latency property.
    cv::VideoCapture cap("rtspsrc location=rtsp://admin:jenex#2018@192.168.1.108:554 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink",cv::CAP_GSTREAMER);

    BR
    Margarita
  • Hello Margarita,
    I made changes that you suggested. Still its not working. Do you require any log ?
    I have also trying to exploring debug-log but its very hard for me to detect actual issue.

    Regards,
    Kishan Patel.
  • Hello,

    You could compare this log and if you run the same pipeline with gst-launch --gst-debug=4.

    BR
    Margarita
  • gst_opencv_log_gst-launch_2.txtHello Margarita,

               I have saved log by using same pipeline with gst-launch as below:

    api:

    =====

    gst-launch-1.0 -v rtspsrc location=rtsp://admin:jenex#2018@192.168.1.108:554 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! waylandsink sync=false

    And i am also attaching output log. I also checking it.

    Regards,

    Kishan Patel.

  • Hello,

    Okay, I will check the both logs tomorrow.
    Please try this:

    cv::VideoCapture cap("rtspsrc location=rtsp://admin:jenex#2018@192.168.1.108:554/ ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink",cv::CAP_GSTREAMER);



    BR
    Margarita
  • Hello,

              Okay Margarita, I have checked above api, its also give same error.

    Regards,

    Kishan Patel.

  • Hello,

    Please remove this comment and share the information:
    //std::cout << cv::getBuildInformation() << std::endl;
    You are building this demo on the board right?

    BR
    Margarita
  • AM5728_EVM_DETAILS.txt
    General configuration for OpenCV 3.1.0 =====================================
      Version control:               unknown
    
      Platform:
        Host:                        Linux 4.4.0-21-generic x86_64
        Target:                      Linux arm
        CMake:                       3.8.2
        CMake generator:             Unix Makefiles
        CMake build tool:            /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/hosttools/make
        Configuration:               Release
    
      C/C++:
        Built as dynamic libs?:      YES
        C++ Compiler:                /home/gtbldadm/tools/linaro-2017.11/bin/arm-linux-gnueabihf-g++  (ver 7.2.1)
        C++ flags (Release):         -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot  -isystem/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/include  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3=/usr/src/debug/opencv/3.1+gitAUTOINC+9b88e8c746-r3 -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot-native= -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot=   -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden  -DCV_TIOPENCL -DCV_TIOPENCL_ENABLE_PROGRAM_COUNT -DMAX_PROGRAM_HASH_SIZE=50  -DNDEBUG
        C++ flags (Debug):           -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot  -isystem/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/include  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3=/usr/src/debug/opencv/3.1+gitAUTOINC+9b88e8c746-r3 -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot-native= -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot=   -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
        C Compiler:                  /home/gtbldadm/tools/linaro-2017.11/bin/arm-linux-gnueabihf-gcc
        C flags (Release):           -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot  -isystem/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/include  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3=/usr/src/debug/opencv/3.1+gitAUTOINC+9b88e8c746-r3 -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot-native= -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot=   -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden  -DCV_TIOPENCL -DCV_TIOPENCL_ENABLE_PROGRAM_COUNT -DMAX_PROGRAM_HASH_SIZE=50  -DNDEBUG
        C flags (Debug):             -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot  -isystem/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/include  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3=/usr/src/debug/opencv/3.1+gitAUTOINC+9b88e8c746-r3 -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot-native= -fdebug-prefix-map=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot=   -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -I/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/include   --sysroot=/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
        Linker flags (Release):      -L/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/lib -Wl,-rpath-link,/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/lib -Wl,-O1 -Wl,--hash-style=gnu
        Linker flags (Debug):        -L/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/lib -Wl,-rpath-link,/home/gtbldadm/tools/linaro-2017.11/arm-linux-gnueabihf/lib -Wl,-O1 -Wl,--hash-style=gnu
        Precompiled headers:         NO
        Extra dependencies:          OpenCL Qt5::Test Qt5::Concurrent /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libjpeg.so /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libwebp.so /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libpng.so /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libz.so /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libtiff.so gstvideo-1.0 gstapp-1.0 gstbase-1.0 gstriff-1.0 gstpbutils-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 v4l1 v4l2 gphoto2 gphoto2_port exif Qt5::Core Qt5::Gui Qt5::Widgets correspondence multiview numeric glog gflags dl m pthread rt tbb
        3rdparty dependencies:       IlmImf
    
      OpenCV modules:
        To be built:                 core flann imgproc ml photo reg surface_matching video fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cvv datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow sfm stitching python3
        Disabled:                    world contrib_world dnn
        Disabled by dependency:      -
        Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz hdf matlab
    
      GUI: 
        QT 5.x:                      YES (ver 5.9.6)
        QT OpenGL support:           NO
        OpenGL support:              NO
        VTK support:                 NO
    
      Media I/O: 
        ZLib:                        /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libz.so (ver 1.2.11)
        JPEG:                        /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libjpeg.so (ver )
        WEBP:                        /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libwebp.so (ver encoder: 0x020e)
        PNG:                         /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libpng.so (ver 1.6.31)
        TIFF:                        /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libtiff.so (ver 42 - 4.0.8)
        JPEG 2000:                   NO
        OpenEXR:                     build (ver 1.7.1)
        GDAL:                        NO
    
      Video I/O:
        DC1394 1.x:                  NO
        DC1394 2.x:                  NO
        FFMPEG:                      NO
          codec:                     NO
          format:                    NO
          util:                      NO
          swscale:                   NO
          resample:                  NO
          gentoo-style:              NO
        GStreamer:                   
          base:                      YES (ver 1.12.2)
          video:                     YES (ver 1.12.2)
          app:                       YES (ver 1.12.2)
          riff:                      YES (ver 1.12.2)
          pbutils:                   YES (ver 1.12.2)
        OpenNI:                      NO
        OpenNI PrimeSensor Modules:  NO
        OpenNI2:                     NO
        PvAPI:                       NO
        GigEVisionSDK:               NO
        UniCap:                      NO
        UniCap ucil:                 NO
        V4L/V4L2:                    Using libv4l1 (ver 1.10.1) / libv4l2 (ver 1.10.1)
        XIMEA:                       NO
        Xine:                        NO
        gPhoto2:                     YES
    
      Parallel framework:            TBB (ver 2017.0 interface 9106)
    
      Other third-party libraries:
        Use IPP:                     NO
        Use VA:                      NO
        Use Intel VA-API/OpenCL:     NO
        Use Eigen:                   YES (ver 3.2.8)
        Use Cuda:                    NO
        Use OpenCL:                  YES
        Use custom HAL:              NO
    
      OpenCL:
        Version:                     static
        libraries:                   OpenCL
        Use AMDFFT:                  NO
        Use AMDBLAS:                 NO
    
      Python 2:
        Interpreter:                 NO
    
      Python 3:
        Interpreter:                 /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot-native/usr/bin/python3-native/python3 (ver 3.5.3)
        Libraries:                   /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/libpython3.5m.so (ver 3.5.3)
        numpy:                       /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot/usr/lib/python3.5/site-packages/numpy/core/include (ver undefined - cannot be probed because of the cross-compilation)
        packages path:               lib/python3.5/site-packages
    
      Python (for build):            /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/recipe-sysroot-native/usr/bin/python3-native/python3
    
      Java:
        ant:                         NO
        JNI:                         NO
        Java wrappers:               NO
        Java tests:                  NO
    
      Matlab:                        Matlab not found or implicitly disabled
    
      Documentation:
        Doxygen:                     NO
        PlantUML:                    NO
    
      Tests and samples:
        Tests:                       YES
        Performance tests:           YES
        C/C++ Examples:              YES
    
      Install path:                  /usr
    
      cvconfig.h is in:              /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/build
    -----------------------------------------------------------------
    
    Hello Margarita,

              I am attaching file about board information.

    And yes, we are building this demo on AM5728 EVM board.

    And we are using opencv which has already installed on board with latest SDK.

    Regards,

    Kishan Patel.

  • Hello,

    I see gstreamer is on.
    I checked the log everything seems fine until the critical error :
    (play_rtsp_stream:4406): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed
    ...
    which explains not-linked error. In the log I can not find which pad is not obtained.
    I have some suspicious on two elements that you could check.

    1. Appsink element.
    Please try simple pipeline like videotestsrc ! videoconvert ! appsink. But first verify it on the board with gst-launch but replace appsink with fakesink.
    2. Second thing is rtspsrc element, because in the log I do not see something like Connecting to rtsp://admin:jenex#2018@192.168.1.108:554
    but I am not very sure about is this suppose to be print if gst is used in opencv.
    You may google how you must set the IP in case gst+opencv.

    You also may post question in opencv forum, since the both are open source and is not working even when TI elements are not involved.

    Hope this helps.

    BR
    Margarita

  • Hello Margarita,
    You can find api in code. I have tested appsink as below:

    cv::VideoCapture cap("videotestsrc ! videoconvert ! appsink");

    This is working fine.

    Regards,
    Kishan Patel.
  • Hello Margarita,
    Have you got any solution or any other way to solve this issue?.
    Currently cudacodec is not supported in this board(AM5728). Can we give support somehow to this board?Can it possible?

    Regards,
    Kishan Patel.
  • Hello,

    I would recommend you to check 2. in the above post.
    Regarding CUDA this already has been answered here:
    e2e.ti.com/.../716495

    Best Regards,
    Margarita
  • Hello Kishan,

    Sorry about the delay I ran some tests with openCV+gstreamer streaming.
    Here is the result on my side.
    I do not have ip camera so I ran this on the board on background

    root@am57xx-evm:~# gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2,width=1280,height=720,framerate=(fraction)30/1' ! vpe num-input-buffers=8 ! queue ! ducatih264enc intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=5000 &

    I am using 127.0.0.1 localhost IP.

    I am running this code on my side:




    root@am57xx-evm:~# cat test1.cpp
    #include <iostream>
    #include <opencv2/core.hpp>
    #include <opencv2/highgui.hpp>
    #include <opencv2/videoio.hpp>

    int main(void)
    {

    /*-------- Display Opencv-Build Information --------*/
    //std::cout << cv::getBuildInformation() << std::endl;
    /*------------------------------------------------------------*/


    cv::VideoCapture cap("udpsrc port=5000 caps=\"application/x-rtp, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, framerate=(fraction)30/1\" ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink");

    if( !cap.isOpened() )
    {
    std::cout << "Not good, open camera failed" << std::endl;
    return 0;
    }

    cv::Mat frame;
    while(true)
    {
    cap >> frame;
    std::cout << "......" << std::endl;
    cv::imshow("Frame", frame);
    cv::waitKey(1);
    }
    return 0;
    }
    root@am57xx-evm:~#

    Here is the result:


    root@am57xx-evm:~# ./test1

    (test1:1698): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

    (test1:1698): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

    (test1:1698): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

    (test1:1698): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (test1:1698): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

    (test1:1698): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion 'structure != NULL' failed
    ......
    init done
    Using Wayland-EGL
    wlpvr: PVR Services Initialised
    ......
    ......
    ......
    ......
    ......
    ......
    ......
    ......
    ......
    ......

    I am able to see the video on display.
    You could try to run the same on your side first and after that to modify you code based on this.

    Best Regards,
    Margarita

  • Hello Margarita,
    Sorry. But i have simply used usb-camera before with opencv. There is working properly.
    But when i try to use rtsp stream, it generate lags.
    I have also tried above lines by make some changes and use rtsp stream,but may be i could not correct line properly.So, i got error.

    How can i use same line as above for rtsp-stream?

    Regards,
    Kishan Patel.
  • Hello,

    kishan patel14 said:
    I have also tried above lines by make some changes and use rtsp stream,but may be i could not correct line properly.So, i got error.

    The problem could be in the capsfilter or how you are passing the location property(especially if is password protected). You could search in the opencv forum for similar questions.

    kishan patel14 said:
    But when i try to use rtsp stream, it generate lags.

    What is this demo? Is it gstreamer based  demo? Is it gstreamer rtps capture demo?
     If yes, could you open a new thread and link this demo.

    BR
    Margarita

  • Hello Margarita,
    Sorry to say but i have not issue related with the demos.
    If you can see my first post in this thread, I have facing issue with using rtsp stream with gstreamer and opencv.

    Regards,
    Kishan Patel.