如何使用gstreamer通过RTSP传输麦克风输入

如何使用gstreamer通过RTSP传输麦克风输入,gstreamer,rtsp,rtp,sdp,gst-launch,Gstreamer,Rtsp,Rtp,Sdp,Gst Launch,我想从RTSP服务器传输麦克风输入。 我使用gstreamer1.0和gstreamer1.0-rtsp-server(v1.12.3) 我尝试了以下命令,但管道创建的RTSP服务器没有响应。我怎样才能流媒体呢 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

我想从RTSP服务器传输麦克风输入。 我使用gstreamer1.0和gstreamer1.0-rtsp-server(v1.12.3)

我尝试了以下命令,但管道创建的RTSP服务器没有响应。我怎样才能流媒体呢

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
结果(tx)为

结果(tx):

我认为这个错误表明我应该将SDP添加到rx或tx管道中。 如何将SDP添加到管道中


为了回答评论,我在这里描述命令

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
结果(Tx):

结果(Rx):


您需要设置rtpL16pay的名称,请尝试以下TX管道:

对于最初从audiotestsrc开始的测试:

测试启动”(audiotestsrc!audioconvert!rtpL16pay name=pay0)

从您的麦克风(如果其在0处连接,请使用以下管道):

测试启动”(alsasrc device=“hw:0”!audioparse!decodebin!audioconvert!audioresample!avenc_g722!rtpg722pay name=pay0)

对于RX,请尝试以下管道:

gst-launch-1.0-v-e rtspsrc位置=rtsp://127.0.0.1:8554/test ! rtpjitterbuffer延迟=100!rtpL16depay!音频转换!阿尔萨斯辛


非常感谢。我试着服从命令,效果很好!Tx:test launch“(alsasrc设备=“hw:0”!audioconvert!rtpL16pay name=pay0 pt=11)”,Rx:gst-launch-1.0 rtspsrc位置=rtsp://10.5.41.11:8554/test 延迟=0!rtpL16depay!音频转换!体积=1.3!还有两个问题。1.当我将延迟设置为0时,是否存在任何问题?2。我想使用其他编解码器,例如G722、PCMA。什么管道可以正常工作?我尝试了这个,但出现了错误。Tx:test launch“(alsasrc device=“hw:0”!audioconvert!audioresample!avenc_g722!rtpg722pay name=pay0 pt=9)”,Rx:gst-launch-1.0 rtspsrc位置=rtsp://10.5.41.11:8554/test 延迟=0!RTPG722准备!avdec_g722!音频转换!体积=1.3!ALASINK,ERROR(tx):获取错误内部数据流ERROR.for tx./test launch“(audiotestsrc!avenc_g722!rtpg722pay name=pay0)”和for RX:gst-launch-1.0 rtspsrc位置=rtsp://127.0.0.1:8554/test ! rtpjitterbuffer延迟=0!RTPG722准备!avdec_g722!音频转换!阿尔萨斯辛
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
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))
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.
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
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
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 ...