skip to Main Content

Using ubuntu, python and gstreamer to grab an rtsp stream I get segmentation fault, resulting into not being able to view the rtsp stream. Using the python application results in segmentation fault with rtspsrc, but running a rtspsrc from terminal with gst-launch works.

Changing out "rtspsrc" with testsrc in the python pipeline, and the python application run as it should. Tested with wsl/ubuntu on different hardware the python application run ok. Software accel is used with wsl, but the ubuntu need to run on hardware accel.

My guess is that there are some driver issues, between the hardware driver and calling the python program on the ubuntu machine. I have tried fresh install of ubuntu 22.04, ubuntu server and debian 11. All results in segmentation fault.

On the WSL I run only softwareaccel, but on the ubuntu I run va-api with 9th gen i7.

i965 drivers are used since it gave the best result while testing with gst-launch.
Drivers are selected by editing bashrc with:

export LIBVA_DRIVER_NAME=i965
export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri

Gstreamer is installed with:

apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav  gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio gstreamer1.0-vaapi

With ubuntu-server, xorg and openbox is used to view the python application. And with testsrc used in pipeline, it is successfully viewed.

Python version is 3.10 (default by this ubuntu version), have tried 3.8.17, but that gilded other issues.

Her is the info log:

0:00:00.000072395  4020 0x55e10835cd60 INFO                GST_INIT gst.c:592:init_pre: Initializing GStreamer Core Library version 1.20.3
0:00:00.000137957  4020 0x55e10835cd60 INFO                GST_INIT gst.c:593:init_pre: Using library installed in /usr/lib/x86_64-linux-gnu
0:00:00.000169079  4020 0x55e10835cd60 INFO                GST_INIT gst.c:611:init_pre: Linux trd-lab 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64
0:00:00.000412160  4020 0x55e10835cd60 INFO                GST_INIT gstmessage.c:129:_priv_gst_message_initialize: init messages
0:00:00.000596636  4020 0x55e10835cd60 INFO                GST_INIT gstcontext.c:86:_priv_gst_context_initialize: init contexts
0:00:00.000782196  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:324:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.000917477  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:232:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.000983365  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:234:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.001037838  4020 0x55e10835cd60 INFO            GST_REGISTRY gstregistry.c:1827:ensure_current_registry: reading registry cache: /home/trd-lab/.cache/gstreamer-1.0/registry.x86_64.bin
0:00:00.023222563  4020 0x55e10835cd60 INFO            GST_REGISTRY gstregistrybinary.c:683:priv_gst_registry_binary_read_cache: loaded /home/trd-lab/.cache/gstreamer-1.0/registry.x86_64.bin in 0.022142 seconds
0:00:00.023331369  4020 0x55e10835cd60 INFO            GST_REGISTRY gstregistry.c:1693:scan_and_update_registry: Validating plugins from registry cache: /home/trd-lab/.cache/gstreamer-1.0/registry.x86_64.bin
0:00:00.023725663  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:1609:gst_plugin_ext_dep_extract_env_vars_paths:<plugin258> ignoring environment variable content 'i965': either not an absolute path or not a path at all
0:00:00.024335432  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:1609:gst_plugin_ext_dep_extract_env_vars_paths:<plugin259> ignoring environment variable content 'i965': either not an absolute path or not a path at all
0:00:00.024372573  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:1609:gst_plugin_ext_dep_extract_env_vars_paths:<plugin259> ignoring environment variable content '': either not an absolute path or not a path at all
0:00:00.024390041  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:1609:gst_plugin_ext_dep_extract_env_vars_paths:<plugin259> ignoring environment variable content '0': either not an absolute path or not a path at all
0:00:00.024917811  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:1609:gst_plugin_ext_dep_extract_env_vars_paths:<plugin260> ignoring environment variable content 'i965': either not an absolute path or not a path at all
0:00:00.025929544  4020 0x55e10835cd60 INFO            GST_REGISTRY gstregistry.c:1785:scan_and_update_registry: Registry cache has not changed
0:00:00.025959932  4020 0x55e10835cd60 INFO            GST_REGISTRY gstregistry.c:1862:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.025976234  4020 0x55e10835cd60 INFO                GST_INIT gst.c:833:init_post: GLib runtime version: 2.72.4
0:00:00.025990409  4020 0x55e10835cd60 INFO                GST_INIT gst.c:835:init_post: GLib headers version: 2.72.1
0:00:00.026001625  4020 0x55e10835cd60 INFO                GST_INIT gst.c:837:init_post: initialized GStreamer successfully
0:00:00.031446448  4020 0x55e10835cd60 INFO            GST_PIPELINE gstparse.c:344:gst_parse_launch_full: parsing pipeline description 'rtspsrc location=rtsp://admin:[email protected]:554 ! decodebin ! videoconvert ! video/x-raw,format=BGR ! queue max-size-time=0 ! appsink name=sink sync=false'
0:00:00.035505134  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstrtsp.so" loaded
0:00:00.035547932  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "rtspsrc"
0:00:00.036989619  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstrealmedia.so" loaded
0:00:00.037025275  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "rtspreal"
0:00:00.038231949  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstasf.so" loaded
0:00:00.038266161  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "rtspwms"
0:00:00.039317883  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstplayback.so" loaded
0:00:00.039362963  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "decodebin"
0:00:00.040326337  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstcoreelements.so" loaded
0:00:00.040413330  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "typefind"
0:00:00.040496925  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstTypeFindElement@0x7fd9b8277200> adding pad 'sink'
0:00:00.040551395  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstTypeFindElement@0x7fd9b8277200> adding pad 'src'
0:00:00.040620028  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:1016:gst_element_get_static_pad: found pad typefind:sink
0:00:00.040706104  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2382:gst_pad_link_prepare: trying to link sink:proxypad0 and typefind:sink
0:00:00.040732918  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2590:gst_pad_link_full: linked sink:proxypad0 and typefind:sink, successful
0:00:00.040747625  4020 0x55e10835cd60 INFO               GST_EVENT gstevent.c:1660:gst_event_new_reconfigure: creating reconfigure event
0:00:00.040793763  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstDecodeBin@0x7fd9b8280110> adding pad 'sink'
0:00:00.041360023  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideoconvert.so" loaded
0:00:00.041392494  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "videoconvert"
0:00:00.041796455  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstBaseTransform@0x7fd9b82982d0> adding pad 'sink'
0:00:00.041849087  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstBaseTransform@0x7fd9b82982d0> adding pad 'src'
0:00:00.041896458  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "queue"
0:00:00.042033002  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstQueue@0x7fd9b829a150> adding pad 'sink'
0:00:00.042071561  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstQueue@0x7fd9b829a150> adding pad 'src'
0:00:00.042844604  4020 0x55e10835cd60 INFO      GST_PLUGIN_LOADING gstplugin.c:987:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstapp.so" loaded
0:00:00.042890017  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "appsink"
0:00:00.043050929  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstBaseSink@0x7fd9b82a1100> adding pad 'sink'
0:00:00.043116416  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "pipeline"
0:00:00.043232351  4020 0x55e10835cd60 INFO            GST_PIPELINE gst/parse/grammar.y:683:gst_parse_perform_link: linking some pad of GstDecodeBin named decodebin0 to some pad of GstVideoConvert named videoconvert0 (0/0) with caps "(NULL)"
0:00:00.043275713  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstutils.c:1816:gst_element_link_pads_full: trying to link element decodebin0:(any) to element videoconvert0:(any)
0:00:00.043308967  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<videoconvert0:src> pad has no peer
0:00:00.043642633  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:1013:gst_element_get_static_pad: no such pad 'src_%u' in element "decodebin0"
0:00:00.043699326  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstutils.c:1270:gst_element_get_compatible_pad:<decodebin0> Could not find a compatible pad to link to videoconvert0:sink
0:00:00.043727106  4020 0x55e10835cd60 INFO                 default gstutils.c:2206:gst_element_link_pads_filtered: Could not link pads: decodebin0:(null) - videoconvert0:(null)
0:00:00.043779482  4020 0x55e10835cd60 INFO            GST_PIPELINE gst/parse/grammar.y:683:gst_parse_perform_link: linking some pad of GstVideoConvert named videoconvert0 to some pad of GstQueue named queue0 (0/0) with caps "video/x-raw, format=(string)BGR"
0:00:00.043818101  4020 0x55e10835cd60 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "capsfilter"
0:00:00.043946492  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstBaseTransform@0x7fd9b82aa1e0> adding pad 'sink'
0:00:00.043987991  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:759:gst_element_add_pad:<GstBaseTransform@0x7fd9b82aa1e0> adding pad 'src'
0:00:00.044012028  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2069:gst_bin_get_state_func:<pipeline0> getting state
0:00:00.044046396  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<capsfilter0> completed state change to NULL
0:00:00.044084246  4020 0x55e10835cd60 INFO               GST_EVENT gstevent.c:1660:gst_event_new_reconfigure: creating reconfigure event
0:00:00.044112794  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstutils.c:1816:gst_element_link_pads_full: trying to link element videoconvert0:(any) to element capsfilter0:sink
0:00:00.044135442  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:1016:gst_element_get_static_pad: found pad capsfilter0:sink
0:00:00.044153994  4020 0x55e10835cd60 INFO                GST_PADS gstutils.c:1632:prepare_link_maybe_ghosting: videoconvert0 and capsfilter0 in same bin, no need for ghost pads
0:00:00.044183448  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2382:gst_pad_link_prepare: trying to link videoconvert0:src and capsfilter0:sink
0:00:00.044209574  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<videoconvert0:sink> pad has no peer
0:00:00.044498858  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<capsfilter0:src> pad has no peer
0:00:00.044558068  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2590:gst_pad_link_full: linked videoconvert0:src and capsfilter0:sink, successful
0:00:00.044582423  4020 0x55e10835cd60 INFO               GST_EVENT gstevent.c:1660:gst_event_new_reconfigure: creating reconfigure event
0:00:00.044598167  4020 0x55e10835cd60 INFO               GST_EVENT gstpad.c:5946:gst_pad_send_event_unchecked:<videoconvert0:src> Received event on flushing pad. Discarding
0:00:00.044647131  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstutils.c:1816:gst_element_link_pads_full: trying to link element capsfilter0:src to element queue0:(any)
0:00:00.044675414  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstelement.c:1016:gst_element_get_static_pad: found pad capsfilter0:src
0:00:00.044700377  4020 0x55e10835cd60 INFO                GST_PADS gstutils.c:1079:gst_pad_check_link: trying to link capsfilter0:src and queue0:sink
0:00:00.044722438  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<videoconvert0:sink> pad has no peer
0:00:00.044982180  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<queue0:src> pad has no peer
0:00:00.045023633  4020 0x55e10835cd60 INFO                GST_PADS gstutils.c:1632:prepare_link_maybe_ghosting: capsfilter0 and queue0 in same bin, no need for ghost pads
0:00:00.045047652  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2382:gst_pad_link_prepare: trying to link capsfilter0:src and queue0:sink
0:00:00.045137987  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<videoconvert0:sink> pad has no peer
0:00:00.045395433  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<queue0:src> pad has no peer
0:00:00.045433701  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2590:gst_pad_link_full: linked capsfilter0:src and queue0:sink, successful
0:00:00.045448492  4020 0x55e10835cd60 INFO               GST_EVENT gstevent.c:1660:gst_event_new_reconfigure: creating reconfigure event
0:00:00.045467983  4020 0x55e10835cd60 INFO               GST_EVENT gstpad.c:5946:gst_pad_send_event_unchecked:<capsfilter0:src> Received event on flushing pad. Discarding
0:00:00.045503445  4020 0x55e10835cd60 INFO            GST_PIPELINE gst/parse/grammar.y:683:gst_parse_perform_link: linking some pad of GstQueue named queue0 to some pad of GstAppSink named sink (0/0) with caps "(NULL)"
0:00:00.045534923  4020 0x55e10835cd60 INFO        GST_ELEMENT_PADS gstutils.c:1816:gst_element_link_pads_full: trying to link element queue0:(any) to element sink:(any)
0:00:00.045563731  4020 0x55e10835cd60 INFO                GST_PADS gstutils.c:1079:gst_pad_check_link: trying to link queue0:src and sink:sink
0:00:00.045585121  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<videoconvert0:sink> pad has no peer
0:00:00.045867653  4020 0x55e10835cd60 INFO                GST_PADS gstutils.c:1632:prepare_link_maybe_ghosting: queue0 and sink in same bin, no need for ghost pads
0:00:00.045912558  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2382:gst_pad_link_prepare: trying to link queue0:src and sink:sink
0:00:00.045935247  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<videoconvert0:sink> pad has no peer
0:00:00.046203279  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:2590:gst_pad_link_full: linked queue0:src and sink:sink, successful
0:00:00.046234223  4020 0x55e10835cd60 INFO               GST_EVENT gstevent.c:1660:gst_event_new_reconfigure: creating reconfigure event
0:00:00.046250500  4020 0x55e10835cd60 INFO               GST_EVENT gstpad.c:5946:gst_pad_send_event_unchecked:<queue0:src> Received event on flushing pad. Discarding
0:00:00.049251152  4020 0x55e10835cd60 INFO           GST_PARENTAGE gstbin.c:4377:gst_bin_get_by_name: [pipeline0]: looking up child element sink
0:00:00.050487825  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<sink> current NULL pending VOID_PENDING, desired next READY
0:00:00.050526840  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<sink> completed state change to READY
0:00:00.050546364  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<sink> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.050585098  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'sink' changed state to 2(READY) successfully
0:00:00.050613782  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<queue0> current NULL pending VOID_PENDING, desired next READY
0:00:00.050637279  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<queue0> completed state change to READY
0:00:00.050654976  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<queue0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.050685421  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'queue0' changed state to 2(READY) successfully
0:00:00.050717996  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<capsfilter0> current NULL pending VOID_PENDING, desired next READY
0:00:00.050738271  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<capsfilter0> completed state change to READY
0:00:00.050759534  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<capsfilter0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.050782771  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'capsfilter0' changed state to 2(READY) successfully
0:00:00.050806604  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<videoconvert0> current NULL pending VOID_PENDING, desired next READY
0:00:00.050823603  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<videoconvert0> completed state change to READY
0:00:00.050838897  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<videoconvert0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.050861696  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'videoconvert0' changed state to 2(READY) successfully
0:00:00.050880887  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<decodebin0> current NULL pending VOID_PENDING, desired next READY
0:00:00.050917815  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<typefind> current NULL pending VOID_PENDING, desired next READY
0:00:00.050942266  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<typefind> completed state change to READY
0:00:00.050957651  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<typefind> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.050979669  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<decodebin0> child 'typefind' changed state to 2(READY) successfully
0:00:00.051000703  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<decodebin0> completed state change to READY
0:00:00.051018876  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<decodebin0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.051045533  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'decodebin0' changed state to 2(READY) successfully
0:00:00.051069788  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<rtspsrc0> current NULL pending VOID_PENDING, desired next READY
0:00:00.051119799  4020 0x55e10835cd60 INFO                    task gsttask.c:516:gst_task_set_lock: setting stream lock 0x7fd9b82749a8 on task 0x7fd9b8289170
0:00:00.051146928  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<rtspsrc0> completed state change to READY
0:00:00.051163604  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<rtspsrc0> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.051250387  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'rtspsrc0' changed state to 2(READY) successfully
0:00:00.051303535  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2778:gst_element_continue_state:<pipeline0> committing state from NULL to READY, pending PLAYING, next PAUSED
0:00:00.051327448  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<pipeline0> notifying about state-changed NULL to READY (PLAYING pending)
0:00:00.051349063  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2786:gst_element_continue_state:<pipeline0> continue state change READY to PAUSED, final PLAYING
0:00:00.051382586  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<sink> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.051417338  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2935:gst_bin_change_state_func:<pipeline0> child 'sink' is changing state asynchronously to PAUSED
0:00:00.051459914  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<queue0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.051491613  4020 0x55e10835cd60 INFO                    task gsttask.c:516:gst_task_set_lock: setting stream lock 0x7fd9b8286de0 on task 0x7fd9b8289290
0:00:00.051514700  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:6291:gst_pad_start_task:<queue0:src> created task 0x7fd9b8289290
0:00:00.051624433  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<queue0> completed state change to PAUSED
0:00:00.051652490  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<queue0> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.051681563  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'queue0' changed state to 3(PAUSED) successfully
0:00:00.051709033  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<capsfilter0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.051787820  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<capsfilter0> completed state change to PAUSED
0:00:00.051812036  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<capsfilter0> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.051837549  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'capsfilter0' changed state to 3(PAUSED) successfully
0:00:00.051862610  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<videoconvert0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.051904986  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<videoconvert0> completed state change to PAUSED
0:00:00.051935627  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<videoconvert0> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.051963621  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'videoconvert0' changed state to 3(PAUSED) successfully
0:00:00.051990544  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<decodebin0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.052057274  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<typefind> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.052094913  4020 0x55e10835cd60 INFO                GST_PADS gstpad.c:4357:gst_pad_peer_query:<decodebin0:sink> pad has no peer
0:00:00.052141093  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<typefind> completed state change to PAUSED
0:00:00.052166744  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<typefind> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.052202665  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<decodebin0> child 'typefind' changed state to 3(PAUSED) successfully
0:00:00.052235005  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2935:gst_bin_change_state_func:<pipeline0> child 'decodebin0' is changing state asynchronously to PAUSED
0:00:00.052286404  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<rtspsrc0> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.052377606  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<rtspsrc0> completed state change to PAUSED
0:00:00.052403265  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<rtspsrc0> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.052451368  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2971:gst_bin_change_state_func:<pipeline0> child 'rtspsrc0' changed state to 3(PAUSED) successfully without preroll
0:00:00.052544729  4020 0x55e10835cd60 INFO                pipeline gstpipeline.c:533:gst_pipeline_change_state:<pipeline0> pipeline is live

(... could not succeed 30k characters and had to remove some..)

0:00:00.053293818  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<videoconvert0> completed state change to PLAYING
0:00:00.053345812  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<videoconvert0> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:00.053378590  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'videoconvert0' changed state to 4(PLAYING) successfully
0:00:00.053634551  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<decodebin0> current READY pending PAUSED, desired next PLAYING
0:00:00.053663779  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2935:gst_bin_change_state_func:<pipeline0> child 'decodebin0' is changing state asynchronously to PLAYING
0:00:00.053700351  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<rtspsrc0> completed state change to PLAYING
0:00:00.053717369  4020 0x55e10835cd60 INFO              GST_STATES gstelement.c:2706:_priv_gst_element_state_changed:<rtspsrc0> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:00.053744787  4020 0x55e10835cd60 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<pipeline0> child 'rtspsrc0' changed state to 4(PLAYING) successfully
Segmentation fault (core dumped)

2

Answers


  1. Chosen as BEST ANSWER

    Problem solved itself by making sure gstreamer is the first library to be called. Not sure why, but it works. Tested on ubuntu, ubuntu server and debian. With WSL the order of libraries does not matter.

    import gi
    gi.require_version('Gst', '1.0')
    gi.require_version("GstApp","1.0")
    from gi.repository import Gst, GLib, GstApp
    _ = GstApp
    
    from collections import deque
    
    ...
    

  2. Rtspsrc needs dynamic pad handling, which the commandline application does automatically, but python doesn’t. Rtspsrc pads are created during runtime which means they need to be linked during runtime. This is usually done with the on_pad_added() callback function for the "pad-added" signal. I have a simple example here:

    # Connect dynamic pads to rtph264, otherwise will get not linked error
    rtspsrc.connect("pad-added", self.on_pad_added, rtph264depay)
    

    And the on_pad_added() function:

    def on_pad_added(self, src: Gst.Element, pad: Gst.Pad, target: Gst.Element):
        """Callback function to connect the dynamic pads of the elements"""
        sink_pad: Gst.Pad = self.get_static_pad(target, "sink")
        if not sink_pad.is_linked():
            pad.link(sink_pad)
            logger.info(f"Linked {src.name} to {target.name}")
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search