Restreaming UDP A/V to RTMP. ERROR: WriteN, RTMP send error 32

Adam Langley linux at irisdesign.co.nz
Fri Sep 18 23:02:36 PDT 2015


Hi,

I have created a pipeline based on the gstreamer test examples:
http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp

My use case is I am using a UDP pipeline to create an A/V stream which I
can use to feed many UDP clients for other pipelines.

The server works, and transmits both audio and video (h264 and AAC) based
on the above example.

My client however, only work when receive EITHER the audio, OR the video -
but not both at the same time.

The client is sending the A/V up to an RTMP server and this fails when the
client script is receiving both audio and video. If I choose to dump the
muxed FLV to disk instead of rtmpsink - then also there are no problems.

My error during failure:

ERROR: WriteN, RTMP send error 32 (136 bytes)
ERROR: WriteN, RTMP send error 32 (42 bytes)
ERROR: WriteN, RTMP send error 9 (42 bytes)
ERROR: from element /GstPipeline:pipeline0/GstRTMPSink:rtmpsink0: Could not
write to resource.
Additional debug info:
gstrtmpsink.c(258): gst_rtmp_sink_render ():
/GstPipeline:pipeline0/GstRTMPSink:rtmpsink0:
Failed to write data


My script is below. Notice I have create 2 variables (AUDIO, and VIDEO) so
that I can turn either of them off for my testing.



#!/bin/sh
#
# A simple RTP receiver
#
#  receives H264 encoded RTP video on port 5000, RTCP is received on  port
5001.
#  the receiver RTCP reports are sent to port 5005
#  receives alaw encoded RTP audio on port 5002, RTCP is received on  port
5003.
#  the receiver RTCP reports are sent to port 5007
#
#             .-------.      .----------.     .---------.   .---------.
.-----------.
#  RTP        |udpsrc |      | rtpbin   |     |h264depay|   |h264parse|   |
  flvmux  |
#  port=5000  |      src->recv_rtp recv_rtp->sink     src->sink
src->sink         |
#             '-------'      |          |     '---------'   '---------'
'-----------'
#                            |          |
#                            |          |     .-------.
#                            |          |     |udpsink|  RTCP
#                            |    send_rtcp->sink     | port=5005
#             .-------.      |          |     '-------' sync=false
#  RTCP       |udpsrc |      |          |               async=false
#  port=5001  |     src->recv_rtcp      |
#             '-------'      |          |
#                            |          |
#             .-------.      |          |     .---------.   .--------.
.-------------.
#  RTP        |udpsrc |      | rtpbin   |     |mp4adepay|   |mp4parse|   |
  flvmux    |
#  port=5002  |      src->recv_rtp recv_rtp->sink     src->sink
 src->sink           |
#             '-------'      |          |     '---------'   '--------'
'-------------'
#                            |          |
#                            |          |     .-------.
#                            |          |     |udpsink|  RTCP
#                            |    send_rtcp->sink     | port=5007
#             .-------.      |          |     '-------' sync=false
#  RTCP       |udpsrc |      |          |               async=false
#  port=5003  |     src->recv_rtcp      |
#             '-------'      '----------'

# the destination machine to send RTCP to. This is the address of the
sender and
# is used to send back the RTCP reports of this receiver. If the data is
sent
# from another machine, change this address.
DEST=127.0.0.1

# this adjusts the latency in the receiver
LATENCY=0

# the caps of the sender RTP stream. This is usually negotiated out of band
with
# SDP or RTSP. normally these caps will also include SPS and PPS but we
don't
# have a mechanism to get this from the sender with a -launch line.
VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)44100,encoding-name=(string)MP4A-LATM,config=(string)40002410"

VIDEO_DEC="rtph264depay"
AUDIO_DEC="rtpmp4adepay"

VIDEO_SINK="mux."
AUDIO_SINK="mux."

AUDIO=1
VIDEO=1

GST_COMMAND="gst-launch-1.0 -v rtpbin name=rtpbin
   \
     flvmux name=mux ! rtmpsink location=rtmp://IP_ADDRESS:1935/live"

if [ $VIDEO -eq 1 ]
then
    GST_COMMAND="$GST_COMMAND udpsrc caps=$VIDEO_CAPS port=5000 !
rtpbin.recv_rtp_sink_0                        \
                                    rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK
                                     \
                                udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0
                                     \
                                    rtpbin.send_rtcp_src_0 ! udpsink
port=5005 host=$DEST sync=false async=false"
fi

if [ $AUDIO -eq 1 ]
then
    GST_COMMAND="$GST_COMMAND udpsrc caps=$AUDIO_CAPS port=5002 !
rtpbin.recv_rtp_sink_1                        \
                                    rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK
                                     \
                                udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1
                                     \
                                    rtpbin.send_rtcp_src_1 ! udpsink
port=5007 host=$DEST sync=false async=false"
fi

exec $GST_COMMAND

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150919/629d3bfc/attachment.html>


More information about the gstreamer-devel mailing list