Hi I am trying to build a video streaming pipeline using gstreamer and I have a hard time making it work. I have a camera that supports MJPG so I want to pass jpeg image to jpegparse and convert to rtp with rtpjpegpay.
./test-launch --gst-debug=3 '(v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96)'
For the receiver side I tried VLC player but had no luck opening the file. I am not sure why - does this mean the syntax above is incorrect ?
Can someone please help ?
I tried
examples$ ./test-launch --gst-debug=3 '(v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96)'
stream ready at rtsp://127.0.0.1:8554/test
0:00:05.121994463 207540 0x56458325ef60 ERROR GST_PIPELINE grammar.y:453:gst_parse_element_set: could not set property "pt" in element "pay0" to "96)"
0:00:05.122054890 207540 0x56458325ef60 WARN default grammar.y:1137:priv_gst_parse_yyerror: Error during parsing: syntax error, unexpected $end
0:00:05.122069622 207540 0x56458325ef60 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error
0:00:05.122084053 207540 0x56458325ef60 ERROR GST_PIPELINE grammar.y:1177:priv_gst_parse_launch: Unrecoverable syntax error while parsing pipeline (v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96)
** (test-launch:207540): CRITICAL **: 10:45:40.048: could not parse launch syntax ((v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96)): could not set property "pt" in element "pay0" to "96)"
** (test-launch:207540): CRITICAL **: 10:45:40.048: could not create element
0:00:05.122267325 207540 0x56458325ef60 ERROR rtspclient rtsp-client.c:660:find_media: client 0x5645832698b0: can't create media
0:00:05.122341856 207540 0x56458325ef60 ERROR rtspclient rtsp-client.c:2210:handle_describe_request: client 0x5645832698b0: no media
0:00:05.136507367 207540 0x56458325ef60 ERROR GST_PIPELINE grammar.y:453:gst_parse_element_set: could not set property "pt" in element "pay0" to "96)"
0:00:05.136559774 207540 0x56458325ef60 WARN default grammar.y:1137:priv_gst_parse_yyerror: Error during parsing: syntax error, unexpected $end
0:00:05.136578684 207540 0x56458325ef60 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error
0:00:05.136603260 207540 0x56458325ef60 ERROR GST_PIPELINE grammar.y:1177:priv_gst_parse_launch: Unrecoverable syntax error while parsing pipeline (v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96)
** (test-launch:207540): CRITICAL **: 10:45:40.062: could not parse launch syntax ((v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96)): could not set property "pt" in element "pay0" to "96)"
** (test-launch:207540): CRITICAL **: 10:45:40.062: could not create element
0:00:05.136801958 207540 0x56458325ef60 ERROR rtspclient rtsp-client.c:660:find_media: client 0x5645832699a0: can't create media
0:00:05.136884822 207540 0x56458325ef60 ERROR rtspclient rtsp-client.c:1993:handle_setup_request: client 0x5645832699a0: media '/test' not found
I have removed name=pay0 pt=96.
./test-launch --gst-debug=3 '(v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay )'
This is the new error
./test-launch --gst-debug=3 '(v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay )'
stream ready at rtsp://127.0.0.1:8554/test
0:00:04.905440270 207392 0x7f10b8002800 WARN v4l2bufferpool gstv4l2bufferpool.c:809:gst_v4l2_buffer_pool_start:<v4l2src0:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:06.060292605 207392 0x7f10b8002800 FIXME rtpjpegpay gstrtpjpegpay.c:751:gst_rtp_jpeg_pay_handle_buffer:<rtpjpegpay0> unhandled marker 0xff
0:00:06.060304923 207392 0x7f10b8002800 FIXME rtpjpegpay gstrtpjpegpay.c:751:gst_rtp_jpeg_pay_handle_buffer:<rtpjpegpay0> unhandled marker 0x00
0:00:06.060308114 207392 0x7f10b8002800 FIXME rtpjpegpay gstrtpjpegpay.c:751:gst_rtp_jpeg_pay_handle_buffer:<rtpjpegpay0> unhandled marker 0x00
0:00:06.060311498 207392 0x7f10b8002800 FIXME rtpjpegpay gstrtpjpegpay.c:751:gst_rtp_jpeg_pay_handle_buffer:<rtpjpegpay0> unhandled marker 0x00
0:00:06.060314299 207392 0x7f10b8002800 FIXME rtpjpegpay gstrtpjpegpay.c:751:gst_rtp_jpeg_pay_handle_buffer:<rtpjpegpay0> unhandled marker 0x00
There you go.
You missed my comment regarding space..
You need to use spaces after ( and before )
$ ./builddir/subprojects/gst-rtsp-server/examples/test-launch '( v4l2src device=/dev/video0 ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96 )'
stream ready at rtsp://127.0.0.1:8554/test
This actually works for me when I open it from vlc, no errors.
You forgot to mention that you use:
https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-launch.c
Related
Following tutorial of original page in Network Streaming
There is the command:
gst-launch-1.0 v4l2src \
! video/x-raw-yuv,width=128,height=96,format='(fourcc)'UYVY \
! videoconvert ! ffenc_h263 ! video/x-h263 ! rtph263ppay pt=96 \
! udpsink host=192.168.1.1 port=5000 sync=false
Resulting:
(gst-launch-1.0:2616): GStreamer-WARNING **: 10:02:12.327: 0.10-style raw video caps are being created. Should be video/x-raw,format=(string).. now.
WARNING: erroneous pipeline: could not parse caps "video/x-raw-yuv,width=128,height=96,format=(fourcc)UYVY"
And command doesn't get executed. Anyone knows why it doesn't get executed?
I want to switch between RTSP stream and test stream.
I use input-selector and this pipeline:
input-selector name=selector ! rtph264depay ! h264parse ! matroskamux \
streamable=false min-index-interval=100000 ! \
filesink location=test.mkv videotestsrc ! \
video/x-raw, width=1024, height=768, framerate=30/1, clock-rate=90000 ! \
x264enc ! rtph264pay ! selector.sink_0 rtspsrc name=rtspsrc \
location=rtsp://admin:admin#192.168.88.231:554/h264 retry=100 \
udp-buffer-size=30000000 latency=200 caps="application/x-rtp, \
media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! \
selector.sink_1
I wrote python code that switches the source every 5 seconds. But only the test stream is written to the file. Also I see warnings in the logs
0:00:00.353575129 13560 0x23f5540 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<udpsrc3> error: Internal data flow error.
0:00:00.353602076 13560 0x23f5540 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<udpsrc3> error: streaming task paused, reason not-linked (-1)
0:00:02.177975961 13560 0x23f2ed0 WARN x264enc :0::<x264enc0> VBV underflow (frame 298, -14405 bits)
0:00:02.338993437 13560 0x23f2ed0 WARN x264enc :0::<x264enc0> VBV underflow (frame 328, -4872 bits)
How to fix it?
When I replace selector.sink_0 with fakesink, RTSP stream is recorded normaly. Apparently the problem is caused by switching streams.
Initial Issue
I would like to use gstreamer plugin opusdec to decode an Opus bitstream. The final purpose is to make glue around it with appsrc and appsink as input/output, to decode 20 ms Opus packets coming from a RTP packet payload and provide PCM sample.
Remark: I can't use gstreamer rtpopusdepay
The following pipeline works:
gst-launch-1.0 filesrc location=testvector01.bit.opus ! oggdemux !
opusdec ! fakesink
In my final application I'm no expected OGG contained data so I did the following:
1) Desencapsulate Opus bitstream
gst-launch-1.0 filesrc location=testvector01.bit.opus ! oggdemux !
filesink location = testvector01.bit.demux
That works. And then:
2) Decode Opus bitstream
gst-launch-1.0 filesrc location=testvector01.bit.demux ! opusdec !
fakesink
and I have the following error:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming task paused, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ..
Input File
testvector01.bit.opus
From Opus test vector :https://people.xiph.org/~greg/opus_testvectors/
My question is:
What is the proper way to use gstreamer plugin opusec without transport container?
Update
Gstreamer version 1.2.4
As recommended I tried to add opusparse after filesrc and got the following error.
Pipeline is PREROLLING ...
(gst-launch-1.0:5147): GStreamer-WARNING **:
gstpad.c:4555:store_sticky_event:<opusparse0:src> Sticky event
misordering, got 'caps' before 'stream-start'
(gst-launch-1.0:5147): GStreamer-WARNING **:
gstpad.c:4555:store_sticky_event:<opusdec0:sink> Sticky event
misordering, got 'caps' before 'stream-start' Pipeline is PREROLLED
... Setting pipeline to PLAYING ... New clock: GstAudioSinkClock
ERROR: from element /GstPipeline:pipeline0/GstOpusDec:opusdec0:
Decoding error: -4 Additional debug info: gstopusdec.c(460):
opus_dec_chain_parse_data ():
/GstPipeline:pipeline0/GstOpusDec:opusdec0 Execution ended after
0:00:00.063372478 Setting pipeline to PAUSED ... Setting pipeline to
READY ... Setting pipeline to NULL ... Freeing pipeline ...
GStreamer 1.8.1
The following pipeline
gst-launch-1.0 filesrc location = testvector01.bit.demux ! opusparse !
opusdec ! audioconvert ! alsasink
halt here:
Setting pipeline to PAUSED ... Pipeline is PREROLLING ...
Gstreamer 1.13.1
gst-launch-1.0 filesrc location = testvector01.bit.demux ! opusparse !
opusdec ! alsasink
Playback just produce a short audio glitch while no gstreamer error is raised.
gst-launch-1.0 filesrc location = testvector01.bit.opus ! oggdemux ! opusparse !
opusdec ! alsasink
Playback is choppy while no gstreamer error is raised.
Regards,
appsrc is-live=true do-timestamp=true name=audiosrc ! opusparse ! oggmux ! filesink location=test.ogg
gstreamer 1.14.1 works fine
You need to have a parser (opusparse) in between as opusdec doesn’t know what format it is, try the following pipeline:
gst-launch-1.0 filesrc location=testvector01.bit.demux ! opusparse !
opusdec ! fakesink dump=true
I am trying to stream video using TCP. Following is the server pipeline:
gst-launch filesrc location=<movie>.mkv ! decodebin ! ffenc_mpeg4 bitrate=5000000 ! rtpmp4vpay mtu=1400 pt=96 ssrc=0 timestamp-offset=0 seqnum-offset=0 send-config=true ! tcpserversink host=0.0.0.0 port=5000
And the client pipeline is:
gst-launch tcpclientsrc host=192.168.1.93 port=5000 ! capsfilter caps="application/x-rtp, media=(string)video, clock-rate=(int)2147483647, encoding-name=(string)MP4V-ES, profile-level-id=(string)1, config=(string)000001b001000001b58913000001000000012000c48d88007d0a041e1463000001b24c61766335322e3132332e30, payload=(int)96, ssrc=(uint)298758266, clock-base=(uint)3097828288, seqnum-base=(uint)63478" ! rtpmp4vdepay ! ffdec_mpeg4 ! autovideosink
I had to include a capsfilter between tcpclientsrc and rtpmp4vdepay. This does not seem to be required if I use the udpsrc however. (I cant seem to get the multicast based streaming to work through my BT router). When started the client starts to play the video, but it is garbage and I can see following warning in the client side.
WARNING: from element /GstPipeline:pipeline0/GstRtpMP4VDepay:rtpmp4vdepay0: Could not decode stream.
Additional debug info:
gstbasertpdepayload.c(387): gst_base_rtp_depayload_chain (): /GstPipeline:pipeline0/GstRtpMP4VDepay:rtpmp4vdepay0:
Received invalid RTP payload, dropping
This warning is emitted continuously.
What am I doing wrong here?
i have created a web server and hosted a AAC stream for HLS streaming, i am able to play the file on another machine using
gst-launch-0.10 souphttpsrc location=http://xx.xx.xx.xx/prog_index.m3u8 ! hlsdemux ! decodebin2 ! alsasink
but when i do this
souphttpsrc location=http://xx.xx.xx.xx/prog_index.m3u8 ! hlsdemux ! aacparse ! faad ! alsasink
i get this error in hlsdemux log and no audio output as aacparse doesn't receive any data
0:00:00.066165787 8139 0xb07098f0 INFO hlsdemux gsthlsdemux.c:734:gst_hls_demux_loop:<hlsdemux0> First fragments cached successfully
0:00:00.066190861 8139 0xb07098f0 DEBUG hlsdemux gsthlsdemux.c:680:switch_pads: Switching pads (oldpad:(nil))
0:00:00.066450610 8139 0xb07098f0 DEBUG hlsdemux gsthlsdemux.c:757:gst_hls_demux_loop:<hlsdemux0> Sending new-segment. segment start:0:00:00.000000000
0:00:00.066510536 8139 0xb07098f0 DEBUG hlsdemux gsthlsdemux.c:796:gst_hls_demux_loop:<hlsdemux0> error, stopping task
Pipeline is PREROLLED ...
0:00:00.066541057 8139 0xb07098f0 DEBUG hlsdemux gsthlsdemux.c:989:gst_hls_demux_stop_update:<hlsdemux0> Stopping updates thread
i am able to play the individual segment file using
gst-launch-0.10 filesrc location=fileSequence0.aac ! aacparse ! faad ! alsasink
try adding a caps: ... ! hlsdemux ! audio/mpeg ! aacparse ! ...
Try adding mpegtsdemux between hlsdemux and aacparse...
because hlsdemux fetches uri till it get .ts streams n u will need mpegtsdemux to demux it.
This is the solution for the HLS audio stream:
... m3u8 ! hlsdemux ! decodebin ! audioconvert ! autoaudiosink
or if you need to stream it again as an UDP:
... m3u8 ! hlsdemux ! decodebin ! audioconvert ! faac ! audio/mpeg, stream-format=raw ! aacparse ! mpegtsmux ! udpsink host=230.0.0.1 port=5000