live streaming from camera to html

Nicolas Dufresne nicolas at ndufresne.ca
Wed Oct 3 16:55:24 UTC 2018


Le mercredi 03 octobre 2018 à 06:57 -0500, Marianna S. Buschle a écrit :
> Hi,
> 
> I have a camera with a V4L2 driver and a HW H264 encoder and I would like to
> be able to stream from it in a way that it can be easily show in a website.
> 
> I am able to stream H264 packed as MPEG-TS using either the rtpbin or a rtsp
> server.
> and I'm able to receive and show those streams using fx VLC installed in my
> machine or gstreamer pipelines.
> However is seems that being able to show that in HTML is a problem.

RTSP and MPEG-TS isn't in the HTML standard. You're options are WebRTC
(for low latency) or DASH/HLS. For HLS there is hlssink and hlssink2
that may help you get going. For DASH, I guess it's splitmuxsink that
need to be used, but you have to create your own mpd (not sure what
else we have). For WebRTC, there is examples here:

  https://github.com/centricular/gstwebrtc-demos

It's all a bit involving, and a simple gst-launch-1.0 won't do.

> 
> rtpbin name=rbin
> v4l2src io-mode=2 hw-center-crop=true device=/dev/qt5023_video0 !
> video/x-raw,width=1920,height=1080,framerate=60/1,pixel-aspect-ratio=1/1,format=NV12
> !
> tee name=t
> t. ! queue !
> vaapih264enc name=h264enc ! video/x-h264,profile=constrained-baseline !
> mpegtsmux ! rtpmp2tpay !
> rbin.send_rtp_sink_0
> rbin.send_rtp_src_0 ! udpsink port=5000 host=224.1.1.1 auto-multicast=1
> sync=0
> rbin.send_rtcp_src_0 ! udpsink port=5001 host=224.1.1.1 sync=false
> async=false
> udpsrc port=5003 address=224.1.1.1 ! rbin.recv_rtcp_sink_0
> t. ! queue leaky=1 ! videorate drop-only=1 ! videoscale !
> video/x-raw,width=[0,960],height=[0,540],framerate=[0/1,20/1] !
> timeoverlay ! appsink name=previewsink max-buffers=1 drop=1 sync=0
> 
> and the rtsp server:
> rtsp_add_service: Build new RTSP factory context at mount '/preview' with
> pipe: ( appsrc name=mysrc !  vaapih264enc !
> video/x-h264,profile=constrained-baseline ! mpegtsmux ! rtpmp2tpay name=pay0
> )
> rtsp_server_attatch: Rtsp service attatched to 0.0.0.0:6001
> 
> vlc rtsp://@10.100.10.101:6001/preview
> vlc rtp://@224.1.1.1:5000 --miface=eth1
> 
> From what I can see the <video> tag expects either mpeg-dash, HLS or similar
> and it doesnt really work with RTSP.
> And from what I can read using those formats will mean high latency and I
> really need low latency.
> 
> One of the "solutions" I can think of is to stream MJPEG so that I can
> render that in  
> Something like: http-launch 8080 videotestsrc ! jpegenc ! multipartmux
> name=stream
> 
> or maybe using webRTC is an option now there is the webrtcbin?
> 
> or is there some better/easier way to do it?
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list