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
Finally I found this article which helped me solve the problem.
My final pipelines look as follows.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With