X-Git-Url: https://git.toastfreeware.priv.at/toast/stream2beamer.git/blobdiff_plain/f67effc9e95b0f18f926ad56098c539c0f88bb6e..e97741140341d1c98f6cb350d819a988c8b73bbd:/stream2beamer.md diff --git a/stream2beamer.md b/stream2beamer.md index 33ed905..61ebe4d 100644 --- a/stream2beamer.md +++ b/stream2beamer.md @@ -6,8 +6,28 @@ Simple WebRTC implementation in GO: https://github.com/adamyordan/laplace.git Simple to compile and just works. WebRTC actually uses SRTP (Secure Real-time Transport Protocol). +IPv6+IPv4, and no TLS: + + ./laplace -addr "[::]:8080" -tls=false + +## WebRTC signaling + +* https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling +* https://www.tutorialspoint.com/webrtc/webrtc_signaling.htm +* https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/ +* https://github.com/topics/webrtc-signaling # gstreamer +* Supports RTP +* Supports webcam capture via v4l (video for linux) +* Supports screen capture via xmanager/ximagesrc +* Interesting URLs: + * WebRTC in one direction only: https://stackoverflow.com/questions/57430215/how-to-use-webrtcbin-create-offer-only-receive-video + * gstreamer to VLC via RTP: https://stackoverflow.com/questions/13154983/gstreamer-rtp-stream-to-vlc + * https://github.com/intel/gstreamer-media-SDK/issues/138 + * https://developer.ridgerun.com/wiki/index.php?title=GstWebRTC_Pipelines + * https://developer.ridgerun.com/wiki/index.php?title=GstWebRTC_-_H264-Opus_Examples#Receive_Pipeline + ## WebRTC gstreamer has a WebRTC implementation. The examples at https://github.com/centricular/gstwebrtc-demos.git work once @@ -16,6 +36,90 @@ The examples at https://github.com/centricular/gstwebrtc-demos.git work once has been set (see https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/811) +There's a new recvonly example: + +* https://github.com/centricular/gstwebrtc-demos/commit/000cfb6cd817ca0f07d761795b352a8b8b9074f8 +* `sendonly/webrtc-recvonly-h264.c` + +## gstreamer examples + gst-launch-1.0 -v playbin uri=file:///home/philipp/tmp/GerisGame.mp4 + + # send + gst-launch-1.0 ximagesrc ! videoconvert ! videoscale ! video/x-raw,width=800,height=600 ! vp8enc ! rtpvp8pay ! udpsink host=239.255.12.42 port=5004 + # receive + gst-launch-1.0 udpsrc address=239.255.12.42 port=5004 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8-DRAFT-IETF-01, payload=(int)96, ssrc=(uint)2990747501, clock-base=(uint)275641083, seqnum-base=(uint)34810" ! rtpvp8depay ! vp8dec ! autovideosink + + # send + gst-launch-1.0 -v ximagesrc ! videoconvert ! videoscale ! video/x-raw,format=I420,width=800,height=600,framerate=25/1 ! jpegenc ! rtpjpegpay ! udpsink host=239.255.12.42 port=5004 + # receive + gst-launch-1.0 udpsrc address=239.255.12.42 port=5004 ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink + + +* https://stackoverflow.com/questions/33747500/using-gstreamer-to-capture-screen-and-show-it-in-a-window/33822024#33822024 +* http://www.einarsundgren.se/gstreamer-basic-real-time-streaming-tutorial/ +* https://gist.github.com/tetkuz/0c038321d05586841897 +* https://gist.github.com/esrever10/7d39fe2d4163c5b2d7006495c3c911bb +* https://gist.github.com/nebgnahz/26a60cd28f671a8b7f522e80e75a9aa5 +* https://salsa.debian.org/debconf-video-team/ansible/-/blob/master/roles/voctomix/templates/videoteam-stream.j2 +* https://github.com/xfxf/video-scripts/blob/master/michael/youtube-live.sh + (and others in the same repo) + +## gstreamer webrtc, another example + +* blog post: https://aweirdimagination.net/2020/07/05/gstreamer-webrtc/ +* code: https://git.aweirdimagination.net/perelman/minimal-webrtc-gstreamer + +## websockets + +connecting to websockets (plus gstreamer and v4l2sink) + +https://michael.stapelberg.ch/posts/2020-06-06-iphone-camera-linux-v4l2loopback/ + + # send + laplace / chromium + + # receive + websocat --insecure "wss://localhost:8080/ws_connect?id=cranky_kind_chipmunk" + +## more v4l2loopback/v4l2sink + + # send + gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video42 + + # receive + cvlc v4l2:///dev/video42 + +## SRT and gstreamer + +* https://github.com/Haivision/srt/blob/master/docs/gstreamer.md +* https://srtlab.github.io/srt-cookbook/ + +## gstreamer and rtsp + +working minimal example: https://github.com/Enne2/PyGObject-GstRtspServer/blob/master/rtsp-server.py + +other maybe helpful links (for getting an existing pipeline streamed): + +* https://stackoverflow.com/questions/52562499/is-it-possible-to-stream-an-existing-gstreamer-pipeline-through-gstrtspserver +* http://gstreamer-devel.966125.n4.nabble.com/Continuously-streaming-a-video-file-code-review-td4671364.html +* https://stackoverflow.com/questions/59858898/how-to-convert-a-video-on-disk-to-a-rtsp-stream +* http://gstreamer-devel.966125.n4.nabble.com/RTSP-Server-from-a-manually-created-and-linked-pipeline-td4680305.html +* http://gstreamer-devel.966125.n4.nabble.com/Using-C-API-based-pipelines-in-RTSP-server-without-quot-launch-quot-arg-td4680144.html +* RTSP on_media_configure and appsrc: https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-appsrc.c +* Link two pipelines: http://gstreamer-devel.966125.n4.nabble.com/Two-pipelines-link-them-merge-them-easy-handling-td4686753.html + +a "relay" between cameras and rtsp, in rust: + +* https://github.com/thirtythreeforty/neolink + +## gstreamer: from udp to rtsp + +* http://trac.gateworks.com/wiki/Yocto/gstreamer/streaming + +## HLS + +or gstreamer's `hlssink(2)`, if we want to serve files via HTTP and kodi can +read/play .m3u8 playlist # VLC Note that you have to close VLC and open it again for new streaming as VLC leaves the connections @@ -26,7 +130,10 @@ for debugging in that respect). ### Source The address has to be the address where the video should be streamed **to**. In the following examples, a multicast address is used. It is either the IP address of the device receiving the video (unicast address) or a multicast address -like 239.255.12.42 (multicast addresses are between 225.0.0.0 and 238.255.255.255). +like 239.255.12.42 (multicast addresses are between 224.0.0.0 and 239.255.255.255, some of +them being reserved, 239.0.0.0 to 239.255.255.255 are Organization-Local Scope so they are +good candidates, see +https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml). cvlc -vv --sout '#transcode{vcodec=h264,acodec=mpga,channels=2,vb=800,ab=128}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name="Geris Game"}' GerisGame.mp4 cvlc -vv --sout '#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:rtp{dst=239.255.12.42,port=5004,mux=ts,sap,name=Geris Game}' :no-sout-all :sout-keep GerisGame.mp4 @@ -41,13 +148,48 @@ like 239.255.12.42 (multicast addresses are between 225.0.0.0 and 238.255.255.25 For VLC, RTSP means RTSP combined with RTP. ### Source +We assume that the video source computer has the external IP 192.168.1.54. +Instead of rtsp://192.168.1.54:8554/ we could also use rtsp://192.168.1.54:8554/mystream.sdp + cvlc -vv --sout '#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:rtp{sdp=rtsp://:8554/}' :no-sout-all :sout-keep GerisGame.mp4 + cvlc -vv --sout '#rtp{dst=239.255.12.42,port=1234,sdp=rtsp://192.168.1.54:8554/}' :no-sout-all :sout-keep GerisGame.mp4 + ### Player -The address needs to be the address of the souce. Note the backslash at the end. +The address needs to be the address of the source. Note the backslash at the end. + + vlc rtsp://192.168.1.54:8554/ + + +## VLC Remarks +* Latency: The following options are said to reduce latency: + + --network-caching=150 --clock-jitter=0 --clock-synchro=0 + +* Duplicating a stream is nice for debugging: + + cvlc -vv --sout '#duplicate{dst=display,dst="transcode{vcodec=h264,acodec=mpga,channels=2,vb=800,ab=128}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name=Geris Game}"}' GerisGame.mp4 + cvlc rtp://239.255.12.42 + + +## HTTP +The address at the source side has to be the external one of the local computer. + +### Source (server) + cvlc -vv --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:standard{access=http,mux=ogg,dst=0.0.0.0:8080}' GerisGame.mp4 + +### Player (client) + + vlc http://192.168.1.54:8080 + + +# Kodi +The player built into code knows at least the following streaming protocols: http, rtsp. + +https://kodi.wiki/index.php?title=Internet_video_and_audio_streams - cvlc rtsp://192.168.1.54:8554/ +# Random other projects -# HTTP -Works as well, the address at the source side has to be the external one of the local computer. \ No newline at end of file +* µstreamer: https://github.com/pikvm/ustreamer +* minimal-webrtc-gstreamer: https://git.aweirdimagination.net/perelman/minimal-webrtc-gstreamer