Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GStreamer shmsink assertion 'segment->format == format' failed

I have the following pipeline running from inside my program using OpenCV VideoWriter element.

gst-launch-1.0 -v videotestsrc ! clockoverlay ! shmsink socket-path=/tmp/sink shm-size=2000000 name=/dev/shm wait-for-connection=false

When I consume the stream through the following pipeline everything works

gst-launch-1.0 -v shmsrc is-live=true socket-path=/tmp/sink shm-area-name=/dev/shm ! \
    "video/x-raw, format=BGR, width=(int)160, height=(int)120, framerate=(fraction)30/1" ! \
    queue ! videoconvert ! autovideosink

but when I attempt to encode the stream in h264 with the following pipeline

gst-launch-1.0 -vvv shmsrc is-live=true socket-path=/tmp/sink shm-area-name=/dev/shm ! \
    "video/x-raw, format=BGR, width=(int)160, height=(int)120, framerate=(fraction)30/1" ! \
    queue ! videoconvert ! x264enc bitrate=1000 ! video/x-h264,profile=baseline ! \
    rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=127.0.0.1 port=5000

I get

(gst-launch-1.0:8119): GStreamer-CRITICAL **: gst_segment_to_running_time: assertion 'segment->format == format' failed

and I can't see anything from VLC. What am I missing?

Note: To reproduce the problem one can use the following producer/consumer pipelines:

gst-launch-1.0 -v videotestsrc ! clockoverlay ! shmsink socket-path=/tmp/sink shm-size=2000000 name=/dev/shm wait-for-connection=false
sudo gst-launch-1.0 -vvv shmsrc is-live=true socket-path=/tmp/sink shm-area-name=/dev/shm ! \
    "video/x-raw, format=BGR, width=(int)160, height=(int)120, framerate=(fraction)30/1" ! \
    queue ! videoconvert ! x264enc bitrate=1000 ! video/x-h264,profile=baseline ! rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=127.0.0.1 port=5000

System information

  • Ubuntu 16.04
  • GStreamer 1.8.3
  • OpenCV 3.4.0
like image 528
mattdibi Avatar asked Jul 10 '26 15:07

mattdibi


1 Answers

Finally I found this article which helped me solve the problem.

My final pipelines look as follows.

Producer pipeline

gst-launch-1.0 -v videotestsrc is-live=true ! clockoverlay ! shmsink socket-path=/tmp/sink shm-size=2000000 name=/dev/shm sync=true wait-for-connection=false

Consumer pipeline

gst-launch-1.0 -vvv shmsrc is-live=true do-timestamp=true socket-path=/tmp/sink shm-area-name=/dev/shm ! \
    "video/x-raw, format=BGR, width=(int)160, height=(int)120, framerate=(fraction)30/1" ! \
    queue ! videoconvert ! x264enc bitrate=1000 ! video/x-h264,profile=baseline ! rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=192.168.200.255 port=5000 sync=false
like image 104
mattdibi Avatar answered Jul 17 '26 19:07

mattdibi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!