1 # Stream Desktop/Video/Webcam to Kodi/Beamer/other PCs
2 Gregor and I had a closer look at the following projects:
5 Simple WebRTC implementation in GO: https://github.com/adamyordan/laplace.git
6 Simple to compile and just works.
7 WebRTC actually uses SRTP (Secure Real-time Transport Protocol).
12 gstreamer has a WebRTC implementation.
13 The examples at https://github.com/centricular/gstwebrtc-demos.git work once
15 export OPENSSL_CONF=''
17 has been set (see https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/811)
21 Note that you have to close VLC and open it again for new streaming as VLC leaves the connections
22 open (I spent hours figuring out why http based streaming doesn't work - `netstat -4 --ip` is nice
23 for debugging in that respect).
27 The address has to be the address where the video should be streamed **to**. In the following
28 examples, a multicast address is used. It is either the IP address of the device receiving the video (unicast address) or a multicast address
29 like 239.255.12.42 (multicast addresses are between 224.0.0.0 and 239.255.255.255, some of
30 them being reserved, 239.0.0.0 to 239.255.255.255 are Organization-Local Scope so they are
32 https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml).
34 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
35 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
36 cvlc -vv --sout '#transcode{vcodec=h264,acodec=mpga,channels=2}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name="Videokamera"}' v4l2:///dev/video0 # long latency
37 cvlc -vv --sout '#transcode{vcodec=h264,acodec=mpga,channels=2}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name="Desktop"}' screen:// # not convincing
40 cvlc rtp://239.255.12.42
44 For VLC, RTSP means RTSP combined with RTP.
47 We assume that the video source computer has the external IP 192.168.1.54.
48 Instead of rtsp://192.168.1.54:8554/ we could also use rtsp://192.168.1.54:8554/mystream.sdp
50 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
51 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
55 The address needs to be the address of the source. Note the backslash at the end.
57 vlc rtsp://192.168.1.54:8554/
61 * Latency: The following options are said to reduce latency:
63 --network-caching=150 --clock-jitter=0 --clock-synchro=0
65 * Duplicating a stream is nice for debugging:
67 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
68 cvlc rtp://239.255.12.42
72 The address at the source side has to be the external one of the local computer.
75 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
79 vlc http://192.168.1.54:8080
83 The player built into code knows at least the following streaming protocols: http, rtsp.
85 https://kodi.wiki/index.php?title=Internet_video_and_audio_streams