]> pere.pagekite.me Git - homepage.git/blob - blog/data/2018-07-12-kodi-linux-desktop-vlc.txt
New post.
[homepage.git] / blog / data / 2018-07-12-kodi-linux-desktop-vlc.txt
1 Title: Streaming the Linux desktop to Kodi using VLC and RTSP
2 Tags: english, debian, video
3 Date: 2018-07-12 02:00
4
5 <p>A while back, I was asked by a friend how to stream the desktop to
6 my projector connected to Kodi. I sadly had to admit that I had no
7 idea, as it was a task I never had tried. Since then, I have been
8 looking for a way to do so, preferable without much extra software to
9 install on either side. Today I found a way that seem to kind of
10 work. Not great, but it si a start.</p>
11
12 <p>I had a look at several approaches, for example
13 <ahref="https://github.com/mfoetsch/dlna_live_streaming">using uPnP
14 DLNA as described in 2011</a>, but it required a uPnP server, fuse and
15 local storage enough to store the stream locally. This is not going
16 to work well for me, lacking enough free space, and it would
17 impossible for my friend to get working.</p>
18
19 <p>Next, it occurred to me that perhaps I could use VLC to create a
20 video stream that Kodi could play. Preferably using
21 broadcast/multicast, to avoid having to change any setup on the Kodi
22 side when starting such stream. Unfortunately, the only recipe I
23 could find using multicast used the rtp protocol, and this protocol
24 seem to not be supported by Kodi.</p>
25
26 <p>On the other hand, the rtsp protocol is working! Unfortunately I
27 have to specify the IP address of the streaming machine in both the
28 sending command and the file on the Kodi server. But it is showing my
29 desktop, and thus allow us to have a shared look on the big screen at
30 the programs I work on.</p>
31
32 <p>I did not spend much time investigating codeces. I combined the
33 rtp and rtsp recipes from
34 <ahref="https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/">the
35 VLC Streaming HowTo/Command Line Examples</a>, and was able to get
36 this working on the desktop/streaming end. Note the 192.168.0.4 IP
37 address is my desktops IP address:</p>
38
39 <blockquote><pre>
40 vlc screen:// --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{dst=projector.local,port=1234,sdp=rtsp://192.168.0.4:8080/test.sdp}'
41 </pre></blockquote>
42
43 <p>I ssh-ed into my Kodi box and created a file like this with the
44 same IP address:</p>
45
46 <blockquote><pre>
47 echo rtsp://192.168.0.4:8080/test.sdp > /storage/videos/screenstream.m3u
48 </pre></blockquote>
49
50 <p>Next, first locate the file in Kodi and select the m3u file while
51 the VLC stream is running. The desktop then show up in my big
52 screen. :)</p>
53
54 <p>When using the same technique to stream a video file with audio,
55 the audio quality is really bad. No idea if the problem is package
56 loss or bad parameters for the transcode. I do not know VLC nor Kodi
57 enough to tell.</p>
58
59 <p>As usual, if you use Bitcoin and want to show your support of my
60 activities, please send Bitcoin donations to my address
61 <b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>