Search code examples
cameraipgstreamerrtsp

GStreamer 1.0 "autovideosink" does not open the display


Using the default GStreamer 0.10 installed in my ubuntu 14.04 I can capture my IP camera:

gst-launch-0.10 rtspsrc location=rtsp://admin:[email protected]:554/mpeg4cif latency=0 ! decodebin ! ffmpegcolorspace ! autovideosink

It has the problem that the capture in the display stops after a while. Although the camera is still sending rtsp packets until I stop the execution (ctrl+c).

I recently installed the last version of gstreamer:

sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get update
sudo apt-get install gstreamer1.0*

to check if with this new version I get rid off that problem and I can continuously visualize the stream of my IP camera for later processing with openCV.

I've tried to execute the next pipelines:

gst-launch-1.0 rtspsrc location=rtsp://admin:[email protected]:554/mpeg4cif ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! autovideosink sync=false

gst-launch-1.0 rtspsrc location=rtsp://admin:[email protected]:554/mpeg4cif ! rtph264depay ! h264parse ! decodebin ! videoconvert ! autovideosink sync=false

gst-launch-1.0 rtspsrc location=rtsp://admin:[email protected]:554/mpeg4cif ! rtph264depay ! avdec_h264 ! decodebin ! videoconvert ! autovideosink sync=false

No one has an execution problem but no one opens a display. Using wireshark I can see that the camera is sending the same packets that when using gstreamer-0.10 which works. If I solve the display problem I could check if with this new version I am able to visualize continuously the stream or It will stops after a while, like when using gst-0.10.

Any suggestion to try? Maybe some different pipelines?

Thanks in advance.

EDIT: I launch the command with GST_DEBUG=4 and the last lines looks like this:

0:00:02.464441942  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<pipeline0> child 'decodebin0' changed state to 4(PLAYING) successfully
0:00:02.464531274  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2227:gst_bin_element_set_state:<h264parse0> current PLAYING pending VOID_PENDING, desired next PLAYING
0:00:02.465086353  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2344:gst_bin_element_set_state:<h264parse0> skipping transition from PLAYING to  PLAYING
0:00:02.465157352  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<pipeline0> child 'h264parse0' changed state to 4(PLAYING) successfully
0:00:02.465725181  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2227:gst_bin_element_set_state:<rtph264depay0> current PLAYING pending VOID_PENDING, desired next PLAYING
0:00:02.465791014  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2344:gst_bin_element_set_state:<rtph264depay0> skipping transition from PLAYING to  PLAYING
0:00:02.465838513  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<pipeline0> child 'rtph264depay0' changed state to 4(PLAYING) successfully
0:00:02.466158677  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2227:gst_bin_element_set_state:<rtspsrc0> current PLAYING pending VOID_PENDING, desired next PLAYING
0:00:02.466264010  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<rtspsrc0> child 'udpsink1' changed state to 4(PLAYING) successfully
0:00:02.466379426  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<rtspsrc0> child 'manager' changed state to 4(PLAYING) successfully
0:00:02.466448925  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<rtspsrc0> child 'udpsrc0' changed state to 4(PLAYING) successfully
0:00:02.467028587  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<rtspsrc0> child 'udpsrc1' changed state to 4(PLAYING) successfully
0:00:02.467105419  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<rtspsrc0> child 'udpsink0' changed state to 4(PLAYING) successfully
0:00:02.467439333  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<rtspsrc0> child 'fakesrc0' changed state to 4(PLAYING) successfully
0:00:02.467504750  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2328:gst_element_continue_state:<rtspsrc0> completed state change to PLAYING
0:00:02.467558749  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<pipeline0> child 'rtspsrc0' changed state to 4(PLAYING) successfully
0:00:02.467620332  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2328:gst_element_continue_state:<pipeline0> completed state change to PLAYING
0:00:02.467672581  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2233:_priv_gst_element_state_changed:<pipeline0> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:02.585214105  2517 0xb4e12c60 INFO               GST_EVENT gstevent.c:628:gst_event_new_caps: creating caps event application/x-rtcp
0:00:02.585415937  2517 0xb4e12c60 INFO               GST_EVENT gstevent.c:709:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:03.340291666  2517 0xb4e12af0 INFO               GST_EVENT gstevent.c:709:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:03.345178707  2517 0xb4e12af0 INFO                 basesrc gstbasesrc.c:2772:gst_base_src_loop:<udpsrc1> marking pending DISCONT
0:00:03.349542005  2517 0xb4e12af0 INFO               GST_EVENT gstevent.c:628:gst_event_new_caps: creating caps event application/x-rtcp, ssrc=(uint)246759908
0:00:03.352920727  2517 0xb4e12af0 INFO               GST_EVENT gstevent.c:628:gst_event_new_caps: creating caps event application/x-rtcp
0:00:03.358691179  2517 0xb4e12af0 INFO               GST_EVENT gstevent.c:628:gst_event_new_caps: creating caps event application/x-rtcp, ssrc=(uint)246759908

I dont know too much how gstreamer internally works but everythings seems correct.

The last lines related to autovideosink in the debug output are this ones:

0:00:02.458109994  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2227:gst_bin_element_set_state:<autovideosink0> current PAUSED pending VOID_PENDING, desired next PLAYING
0:00:02.458178994  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2227:gst_bin_element_set_state:<autovideosink0-actual-sink-nvoverlay> current PAUSED pending VOID_PENDING, desired next PLAYING
0:00:02.460078228  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2328:gst_element_continue_state:<autovideosink0-actual-sink-nvoverlay> completed state change to PLAYING
0:00:02.460137644  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2233:_priv_gst_element_state_changed:<autovideosink0-actual-sink-nvoverlay> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:02.460328226  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<autovideosink0> child 'autovideosink0-actual-sink-nvoverlay' changed state to 4(PLAYING) successfully
0:00:02.460389892  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2328:gst_element_continue_state:<autovideosink0> completed state change to PLAYING
0:00:02.460436142  2517 0xb4e364f0 INFO              GST_STATES gstelement.c:2233:_priv_gst_element_state_changed:<autovideosink0> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:02.460566224  2517 0xb4e364f0 INFO              GST_STATES gstbin.c:2656:gst_bin_change_state_func:<pipeline0> child 'autovideosink0' changed state to 4(PLAYING) successfully

I can not compare the debug with the debug of the 0.10 because is extremely large... Should be some "opened display" line in the debug output of gstreamer 1.0?

Thanks.


Solution

  • Since my objetive was to capture de video to process the frames with OpenCV, I changed my solution to use gstreamer-0.10 C API. I explain the solution in another post which I opened here:

    IP camera capture

    Using the C API, I dont have any problem capturing, processing and visualizing. :)