Sending a 1080p stream to YouTube, and a 720p stream to Facebook?

Ian yoitsmeremember at gmail.com
Sun Jul 5 06:22:01 UTC 2020


We have a network camera (RTSP) and an audio interface (OSS) that I'd 
like to mux and stream to both YouTube and Facebook simultaneously.  As 
I'd like to stream in the highest possible quality to both, but YouTube 
supports higher resolution streams compared to Facebook, which is 
limited to 720p.

I've already successfully sent the same 720p stream to both, and I've 
been able to send a 1080p stream to YouTube alone.  But my attempts at 
downscaling the 1080p stream to 720p, encoding it, and sending it off to 
FaceBook at the same time we send a 1080p stream to YouTube have all 
failed.  What's odd is there is no error in gstreamer's terminal output, 
it all looks normal (i.e. the same as when we successfully stream to 
either or both of them at 720p).

Here's the pipeline I'm attempting to use:

gst-launch-1.0 -e \
rtspsrc location="rtsp://re:d@cted/" protocols=tcp is-live=true ! 
rtph264depay ! h264parse ! tee name=v ! queue ! flvmux streamable=true 
name=m1080 ! rtmpsink location="rtmp://a.rtmp.youtube.com/live2/redacted 
app=live2" \
v. ! queue ! avdec_h264 ! videoscale add-borders=false method=1 ! 
video/x-raw,width=1280,height=720 ! x264enc pass=qual speed-preset=slow 
psy-tune=film quantizer=23 bitrate=4000 key-int-max=48 ! 
video/x-h264,profile=high ! h264parse ! flvmux streamable=true name=m720 
! rtmpsink location="rtmp://localhost/rtmp/redacted live=1" \
osssrc ! deinterleave name=ra \
ra.src_0 ! audioconvert ! faac bitrate=128000 ! aacparse ! tee name=a ! 
queue max-size-time=3000000000 ! m1080. \
a. ! queue max-size-time=5000000000 ! m720.

The stream to "localhost" is going to FaceBook, which requires rtmps, 
but is not supported by gstreamer as far as I can tell, so it's tunneled 
via stunnel.  The audio queues are different length due to the added 
latency of x264enc.  Additionally, even if I don't mux in audio or have 
any audio sources, it still does not stream to both of them, so the 
problem appears to be somewhere in the video pipeline.  I was concerned 
that not having queues in the appropriate areas might be causing 
deadlocks, but I've put a queue after each 'tee' output in the pipeline, 
so I'm not sure if that's the issue.

Any ideas?

Thanks,
- Ian


More information about the gstreamer-devel mailing list