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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Ian-2
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Mathieu Duponchelle
Your queue before x264enc might be running full, x264enc requiring a large
number of buffers before outputting anything is a common issue. Maybe try
to either set tune=zerolatency on x264enc, or larger max-size values on both
queues after the tee?

Best,

--
Mathieu Duponchelle · https://www.centricular.com

On 7/5/20 8:22 AM, Ian wrote:

> 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
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel