Muxing two tcpclientsrc sources to rtmp server

soylent soylent.tv at gmail.com
Mon Jul 14 08:45:44 PDT 2014


I'm trying to setup a gst-launch-1.0 pipe that get video and audio from two
TCP sources, mux them together and send the results to rtmp like
Ustream/Twitch/ ...

>From my experiments this pipe works Ok:

gst-launch-0.10 -v audiotestsrc ! 'audio/x-raw-int, rate=(int)44100,
channels=(int)2' ! queue ! faac bitrate=96000 !
'audio/mpeg,mpegversion=4,stream-format=raw' ! flvmux streamable=true
name=flvmux videotestsrc pattern=18 ! 'video/x-raw-yuv,
framerate=(fraction)25/1, width=(int)512, height=(int)288' ! queue !
videoscale ! ffmpegcolorspace ! x264enc pass=cbr threads=0 bitrate=512000
tune=zerolatency ! flvmux. flvmux. ! queue ! rtmpsink sync=false
location="rtmp://x.xxxxxxxx.fme.ustream.tv/ustreamVideo/xxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

I then translate it to be readable from the application I'm working on, with
TCP inputs, and it's working ok: (The "@" are tags translated by the
application)

gst-launch-0.10 tcpclientsrc port=@APORT !
audio/x-raw-int,rate=@FREQ,channels=2,signed=true,width=16,depth=16,endianness=4321
! queue ! audioconvert ! faac bitrate=@ABITRATE000 !
'audio/mpeg,mpegversion=4,stream-format=raw' ! flvmux streamable=true
name=flvmux tcpclientsrc port=@VPORT ! videoparse format=rgb width=@CWIDTH
height=@CHEIGHT framerate=@RATE/1 ! queue ! videoscale ! ffmpegcolorspace !
x264enc name=highenc pass=cbr threads=0 bitrate=@VBITRATE000
tune=zerolatency ! flvmux. flvmux. ! queue ! rtmpsink sync=false
location=@URL

Now i need this pipe working with gst-launch-1.0:
>From my experiments this one is working good:

gst-launch-1.0 -v videotestsrc ! videoparse width=320 height=240
framerate=25/1 ! queue ! videoscale ! videoconvert ! x264enc pass=cbr
threads=0 bitrate=512000 tune=zerolatency ! h264parse ! flvmux
streamable=true name=mux audiotestsrc ! audioconvert ! audio/x-raw,
format=S16BE, channels=2, rate=44100 ! queue ! audioconvert ! audioresample
! lamemp3enc bitrate=128000 ! mpegaudioparse ! mux. mux. ! queue ! rtmpsink
sync=false
location="rtmp://x.xxxxxxxx.fme.ustream.tv/ustreamVideo/xxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

But when i try to change the sources to TCP :

gst-launch-1.0 -v tcpclientsrc port=@VPORT ! videoparse format=rgb
width=@CWIDTH height=@CHEIGHT framerate=@RATE/1 ! queue max-size-buffers=0
max-size-time=0 ! videoscale ! videoconvert ! x264enc pass=cbr threads=0
bitrate=@VBITRATE000 tune=zerolatency ! h264parse ! flvmux streamable=true
name=mux tcpclientsrc port=@APORT ! audio/x-raw, format=S16BE,
channels=@CHANNELS, rate=@FREQ ! queue max-size-buffers=0 max-size-time=0 !
audioconvert ! audioresample ! lamemp3enc bitrate=@ABITRATE000 !
mpegaudioparse ! mux. mux. ! queue max-size-buffers=0 max-size-time=0 !
rtmpsink sync=false location=@URL

The pipe starts ok, but i get a lot of:

(gst-launch-1.0:5228): GStreamer-CRITICAL **: gst_segment_to_running_time:
assertion 'segment->format == format' failed
(gst-launch-1.0:5228): GStreamer-CRITICAL **: gst_segment_to_running_time:
assertion 'segment->format == format' failed
(gst-launch-1.0:5228): GStreamer-CRITICAL **: gst_segment_to_running_time:
assertion 'segment->format == format' failed

and the application crash ...

I tried also ( ... with the same results):

gst-launch-1.0 -v tcpclientsrc port=@VPORT ! queue ! videoparse format=rgb
width=@CWIDTH height=@CHEIGHT framerate=@RATE/1 ! queue max-size-buffers=0
max-size-time=0 ! videorate ! videoscale ! videoconvert ! video/x-raw,
format=RGB, framerate=@RATE/1, width=@CWIDTH, height=@CHEIGHT ! videoconvert
! x264enc pass=cbr threads=0 bitrate=@VBITRATE000 tune=zerolatency !
h264parse ! flvmux streamable=true name=mux tcpclientsrc port=@APORT !
audio/x-raw, format=S16BE, channels=@CHANNELS, rate=@FREQ ! queue
max-size-buffers=0 max-size-time=0 ! audioconvert ! audioresample !
audiorate ! lamemp3enc bitrate=@ABITRATE000 ! mpegaudioparse ! mux. mux. !
queue max-size-buffers=0 max-size-time=0 ! rtmpsink location=@URL sync=false

gst-launch-1.0 -v tcpclientsrc port=@APORT ! audio/x-raw, format=S16BE,
channels=@CHANNELS, rate=@FREQ ! queue max-size-buffers=0 max-size-time=0 !
audioconvert ! audioresample ! audiorate ! lamemp3enc bitrate=@ABITRATE000 !
mpegaudioparse ! flvmux name=mux tcpclientsrc port=@VPORT ! videoparse
format=rgb width=@CWIDTH height=@CHEIGHT framerate=@RATE/1 ! queue
max-size-buffers=0 max-size-time=0 ! videoconvert ! videoscale ! videorate !
video/x-raw, format=RGB, framerate=@RATE/1, width=@CWIDTH, height=@CHEIGHT !
videoconvert ! x264enc bitrate=@VBITRATE000 tune=zerolatency ! mux. mux. !
queue max-size-buffers=0 max-size-time=0 ! rtmpsink sync=false location=@URL

The TCP sources are rawvideo in RGB24 format for video and audio is in
s16be, two channels.
Hope someone can point me in the right direction.
Thanks for GStreamer ... 
I Love it and Hate it at the same time ... :)
karl.






--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Muxing-two-tcpclientsrc-sources-to-rtmp-server-tp4667922.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list