0

I would like to stream mic input from RTSP server. I use gstreamer1.0 and gstreamer1.0-rtsp-server (v1.12.3).

I tried the following commands, but RTSP server created by the pipeline is not responsed. How can I stream it?

Tx: GST_DEBUG=3 test-launch "( alsasrc device="hw:0" ! audioconvert ! rtpL16pay )"
Rx: gst-launch-1.0 -q rtspsrc location=rtsp://10.5.41.11:8554/test ! decodebin ! audioconvert ! alsasink

The result(tx) is

stream ready at rtsp://127.0.0.1:8554/test
0:00:08.267067376   800 0x7601dd80 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<alsasrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:08.274445501   800 0x7601dd80 WARN                    alsa pcm_hw.c:1250:snd_pcm_hw_get_chmap: alsalib error: Cannot read Channel Map ctl
: No such file or directory
0:00:08.299559918   800 0x7601dd80 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<alsasrc0> error: Internal data stream error.
0:00:08.299722543   800 0x7601dd80 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<alsasrc0> error: streaming stopped, reason not-linked (-1)
0:00:08.300421793   800 0x7601d920 WARN               rtspmedia rtsp-media.c:2433:default_handle_message: 0x7600e7d0: got error Internal data stream error. (../../../../gstreamer-1.12.3/libs/gst/base/gstbasesrc.c(2939): gst_base_src_loop (): /GstPipeline:media-pipeline/GstBin:bin0/GstAlsaSrc:alsasrc0:
streaming stopped, reason not-linked (-1))
0:00:08.300855501   800   0xdef890 WARN               rtspmedia rtsp-media.c:2728:wait_preroll: failed to preroll pipeline
0:00:08.301006459   800   0xdef890 WARN               rtspmedia rtsp-media.c:3032:gst_rtsp_media_prepare: failed to preroll pipeline
0:00:08.314116334   800   0xdef890 ERROR             rtspclient rtsp-client.c:977:find_media: client 0xdcfb40: can't prepare media
0:00:08.316345126   800   0xdef890 ERROR             rtspclient rtsp-client.c:2696:handle_describe_request: client 0xdcfb40: no media

I also tried the following command.

Tx: GST_DEBUG=3 test-launch "( alsasrc device="hw:0" ! audio decodebin ! audioconvert ! rtpL16pay )"
Rx: gst-launch-1.0 -q rtspsrc location=rtsp://10.5.41.11:8554/test ! decodebin ! audioconvert ! alsasink

The result(tx):

stream ready at rtsp://127.0.0.1:8554/test
0:00:03.216280583   805 0x75f105b0 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<alsasrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:03.222776083   805 0x75f105b0 WARN                    alsa pcm_hw.c:1250:snd_pcm_hw_get_chmap: alsalib error: Cannot read Channel Map ctl
: No such file or directory
0:00:03.238019083   805  0x1b82890 FIXME              rtspmedia rtsp-media.c:3581:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing
0:00:03.256477500   805 0x75f105b0 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<alsasrc0> error: Internal data stream error.
0:00:03.256641250   805 0x75f105b0 WARN                 basesrc gstbasesrc.c:2939:gst_base_src_loop:<alsasrc0> error: streaming stopped, reason not-linked (-1)
0:00:03.257567125   805 0x75f10150 WARN               rtspmedia rtsp-media.c:2433:default_handle_message: 0x75f0ea70: got error Internal data stream error. (../../../../gstreamer-1.12.3/libs/gst/base/gstbasesrc.c(2939): gst_base_src_loop (): /GstPipeline:media-pipeline/GstBin:bin0/GstAlsaSrc:alsasrc0:
streaming stopped, reason not-linked (-1))

PS:

The first tx pipeline including no decodebin, the error of rx is 503 service unavailable. So the tx pipeline is wrong I think.

The second one result is as follows.

ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not get/set settings from/on resource.
Additional debug info:
../../../gst-plugins-good-1.8.3/gst/rtsp/gstrtspsrc.c(6361): gst_rtspsrc_setup_streams (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
SDP contains no streams
ERROR: pipeline doesn't want to preroll.

I think this error says I should add SDP to rx or tx pipeline. How can I add SDP to the pipeline?


To answer comment, I describe commands here.

Tx: GST_DEBUG=3 test-launch "( alsasrc device="hw:0" ! avenc_g722 ! rtpg722pay name=pay0 )"
Rx: gst-launch-1.0 rtspsrc location=rtsp://10.5.41.11:8554/test rtpjitterbuffer latency=0 ! fakesink

Result(Tx):

0:00:30.110267253  1979   0xe62830 WARN               rtspmedia rtsp-media.c:243                                    3:default_handle_message: 0xe90d20: got error Internal data stream error. (../..                                    /../../gstreamer-1.12.3/libs/gst/base/gstbasesrc.c(2939): gst_base_src_loop ():                                     /GstPipeline:media-pipeline/GstBin:bin2/GstAlsaSrc:alsasrc2:
streaming stopped, reason not-negotiated (-4))
0:00:30.118076170  1979 0x75f3b4f0 ERROR             rtspclient rtsp-client.c:97                                    7:find_media: client 0xe42c60: can't prepare media
0:00:30.119548961  1979 0x75f3b4f0 ERROR             rtspclient rtsp-client.c:26                                    96:handle_describe_request: client 0xe42c60: no media

Result(Rx):

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://10.5.41.11:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
../../../gst-plugins-good-1.8.3/gst/rtsp/gstrtspsrc.c(5670): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Got error response: 503 (Service Unavailable).
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
user8257918
  • 55
  • 3
  • 13

1 Answers1

2

you need to set the name for rtpL16pay, try the following pipeline for TX:

For testing initially start with audiotestsrc:

test-launch "(audiotestsrc ! audioconvert ! rtpL16pay name=pay0 )"

and from your mic(if its connected at 0 use the following pipeline):

test-launch "(alsasrc device="hw:0" ! audioparse ! decodebin ! audioconvert ! audioresample ! avenc_g722 ! rtpg722pay name=pay0 )"

And for RX try the following pipeline:

gst-launch-1.0 -v -e rtspsrc location=rtsp://127.0.0.1:8554/test ! rtpjitterbuffer latency=100 ! rtpL16depay ! audioconvert ! alsasink

Prabhakar Lad
  • 1,248
  • 1
  • 8
  • 12
  • Thank you. I tried following command and this worked fine! Tx: test-launch "( alsasrc device="hw:0" ! audioconvert ! rtpL16pay name=pay0 pt=11 )", Rx: gst-launch-1.0 rtspsrc location=rtsp://10.5.41.11:8554/test latency=0 ! rtpL16depay ! audioconvert ! volume volume=1.3 ! alsasink – user8257918 Jan 23 '18 at 10:40
  • Two more question please. 1. Are there any concern when I set latency=0? – user8257918 Jan 23 '18 at 10:47
  • 2. I would like to use other codec e.g. G722, PCMA. What pipeline will work fine? – user8257918 Jan 23 '18 at 10:47
  • I tried this, but the error has occured. Tx: test-launch "( alsasrc device="hw:0" ! audioconvert ! audioresample ! avenc_g722 ! rtpg722pay name=pay0 pt=9 )", Rx: gst-launch-1.0 rtspsrc location=rtsp://10.5.41.11:8554/test latency=0 ! rtpg722depay ! avdec_g722 ! audioconvert ! volume volume=1.3 ! alsasink, ERROR(tx): got error Internal data stream error. – user8257918 Jan 23 '18 at 10:49
  • for Tx ./test-launch "(audiotestsrc ! avenc_g722 ! rtpg722pay name=pay0 )" and for RX: gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test ! rtpjitterbuffer latency=0 ! rtpg722depay ! avdec_g722 ! audioconvert ! alsasink – Prabhakar Lad Jan 23 '18 at 11:20
  • audiotestsrc worked fine. However error occurs if I changed audiotestsrc into alsasrc device="hw:0"... – user8257918 Jan 23 '18 at 11:55
  • Try following for TX: test-launch "(alsasrc device="hw:0" ! audioparse ! decodebin ! audioconvert ! audioresample ! avenc_g722 ! rtpg722pay name=pay0 )" – Prabhakar Lad Jan 23 '18 at 12:16
  • Sorry. I updated my article and wrote the error. Please see it. – user8257918 Jan 23 '18 at 12:27
  • I have tried your Tx pipeline and it worked! However Rx fails when the pipeline has rtpjitterbuffer (deleting it makes work fine). Failed Rx: gst-launch-1.0 rtspsrc location=rtsp://10.5.41.11:8554/test rtpjitterbuffer latency=0 ! rtpg722depay ! avdec_g722 ! audioconvert ! volume volume=0.3 ! alsasink – user8257918 Jan 23 '18 at 12:30
  • Result(Rx):ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0: Internal data flow error. Additional debug info: ../../../../gstreamer-1.8.3/libs/gst/base/gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0: streaming task paused, reason not-linked (-1) – user8257918 Jan 23 '18 at 12:30
  • Rx needs to be : gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test ! rtpjitterbuffer latency=0 ! rtpg722depay ! avdec_g722 ! audioconvert ! alsasink (Note you have ! missing in your pipeline before rtpjitterbuffer) – Prabhakar Lad Jan 23 '18 at 12:32
  • I am sorry. I did not respond you... Thank you for your help! The last one also worked. – user8257918 May 17 '18 at 04:10