Problems streaming webcam over UDP with gstreamer as MJPEG stream - gstreamer

First, I have read the following thread, but I want to harness the webcam hardware JPEG compression as opposed to software h264 compression.
Second, I tested the following pipeline and it works:
gst-launch-1.0 -v v4l2src device=/dev/video1 ! 'image/jpeg,width=640,height=480,videorate=8/1' ! jpegdec ! xvimagesink
Then I tried similar pipeline but with udpsink at the end:
gst-launch-1.0 -v v4l2src device=/dev/video1 ! 'image/jpeg,width=640,height=480,videorate=8/1' ! rtpjpegpay ! udpsink host=127.0.0.1 port=1234
Then I tried to play this stream:
gst-launch-1.0 -v udpsrc port=1234 ! "application/x-rtp, payload=96" ! rtpjpegdepay ! jpegdec ! xvimagesink
And it failed with the following errors:
/GstPipeline:pipeline0/GstJpegDec:jpegdec0.GstPad:sink: caps =
image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
** (gst-launch-1.0:10761): CRITICAL **: gst_adapter_push: assertion 'GST_IS_BUFFER (buf)' failed
** (gst-launch-1.0:10761): CRITICAL **: gst_jpeg_dec_fill_input_buffer: assertion 'dec->current_frame_map.data
!= NULL' failed
Any suggestions?

Related

How to stream motion (jpeg) images/data from folder in C++ using Gstream lib?

i am trying to play sequence of image(.jpeg) from my local folder to play as h264 video in VLC player through local host connection.
I am using Gstreamer lib to stream support and i am using from test-launch.c from github samples
OS : Linux 18.04
Gstremer ver: 1.14.2 Building from source using Cerbero
Following command is used to set the parser
multifilesrc location=/home/user/Downloads/gen/img.%4d.jpeg loop=true caps=image/jpeg,framerate=10/1 ! jpegdec ! x264enc ! h264parse ! rtph264pay name=pay0 pt=96
but no streaming happening insted i can see a error like below
(Gstremer_img2vid2:21273): GStreamer-CRITICAL **: 15:57:21.547: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed
0:01:26.143446201 21273 0x55555592b850 ERROR rtspclient rtsp-client.c:3105:handle_setup_request: client 0x5555559d5260: no control in path '/test'
Any help will be appreciated thanks
You may have to provide size of the frames for jpeg decoding (here using 640x480):
test-launch "multifilesrc location=/home/user/Downloads/gen/img.%4d.jpeg loop=true ! image/jpeg,width=640,height=480,framerate=10/1 ! jpegdec ! x264enc insert-vui=1 ! h264parse config-interval=1 ! rtph264pay name=pay0"
Should be ok for receiving on localhost using vlc:
cvlc rtsp://127.0.0.1:8554/test

Gstreamer: how to ouput mp4 video into /dev/video0?

I found that for .avi files
gst-launch-1.0 -v filesrc location=test.avi ! avidemux ! decodebin !
videoconvert ! "video/x-raw,format=YUY2" ! v4l2sink device=/dev/video0
and this one ouptput screen into /dev/video0 :
gst-launch-1.0 -v ximagesrc startx=1 starty=1 endx=320 endy=240 !
videoconvert ! "video/x-raw,format=YUY2" ! v4l2sink device=/dev/video0
Any idea on how to use Gstreamer to input a .mp4 file instead of .avi file ?
gst-launch-1.0 -v filesrc location=test.mp4 ! qtdemux ! decodebin ! videoconvert ! "video/x-raw,format=YUY2" ! v4l2sink device=/dev/video0
Since MP4 files do not have a concept of a fixed frame rate you have to add a video rate element and set a desired frame rate (may depend on the output device).
gst-launch-1.0 -v filesrc location=test.mp4 ! qtdemux ! decodebin ! videorate ! videoconvert ! "video/x-raw,format=YUY2,framerate=30/1" ! v4l2sink device=/dev/video0

Gstreamer rtsp to HLS, set EXT-X-PROGRAM-DATE-TIME tag in m3u8 playlist file

I'm using Gstreamer to convert an rtsp stream to HLS. I want to set the EXT-X-PROGRAM-DATE-TIME tag in the m3u8 playlist file. Is this possible? I'm using this terminal command but ideally I want to write a c program which does the same thing.
gst-launch-1.0 -v -e rtspsrc protocols=tcp \
location=rtsp://rtspadress \
do-timestamp=true ! queue ! rtph264depay ! h264parse config-interval=-1 ! mpegtsmux \
! hlssink location="%06d.ts" target-duration=5

GStreamer pipeline crash (splitmuxsink)

This is my pipeline:
gst-launch-1.0 rtspsrc location='<my_rtsp>'
! rtph264depay
! h264parse
! splitmuxsink location=/<my_path>/video%02d.mp4 max-size-time=60000000000
Every ~60 files (59-61) pipeline crash and i see this:
**
ERROR:gstsplitmuxsink.c:805:handle_gathered_gop: assertion failed: (queued_bytes >= splitmux->mux_start_bytes)
Aborted
is it possible to correct this error?
(I use GStreamer 1.8.0)

Playing mpeg2ts with Gstreamer-1.0

I am trying to play a .ts file with Gstreamer-1.0 as well as gst-omx have been successfully installed .
Try to play ts video using below command line format but failed to play.
test#test-Gardenia:~/Videos$ gst-launch-1.0 -v filesrc location= mpeg2.ts ! tsdemux ! mpegvideoparse ! omxmpeg2dec ! videoconvert ! ximagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstTSDemux:tsdemux0: Internal data stream error.
Additional debug info:
mpegtsbase.c(1347): mpegts_base_loop (): /GstPipeline:pipeline0/GstTSDemux:tsdemux0:
stream stopped, reason not-linked
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
/GstPipeline:pipeline0/GstTSDemux:tsdemux0.GstPad:audio_0044: caps = "NULL"
Freeing pipeline ...
Tried below command also but not did not work.
test#test:~/Videos$ gst-launch-1.0 filesrc location= mpeg2.ts ! tsdemux ! tsparse ! omxmpeg2dec ! videoconvert ! ximagesink
WARNING: erroneous pipeline: could not link mpegtsparse2-0 to omxmpeg2videodec-omxmpeg2dec0
Can any one help me how to play .ts file with mpeg2 codec format using gstreamer