- <title>Streaming the Linux desktop to Kodi using VLC and RTSP</title>
- <link>http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html</link>
- <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html</guid>
- <pubDate>Thu, 12 Jul 2018 02:00:00 +0200</pubDate>
- <description><p>PS: See
-<ahref="http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html">the
-followup post</a> for a even better approach.</p>
-
-<p>A while back, I was asked by a friend how to stream the desktop to
-my projector connected to Kodi. I sadly had to admit that I had no
-idea, as it was a task I never had tried. Since then, I have been
-looking for a way to do so, preferable without much extra software to
-install on either side. Today I found a way that seem to kind of
-work. Not great, but it is a start.</p>
-
-<p>I had a look at several approaches, for example
-<a href="https://github.com/mfoetsch/dlna_live_streaming">using uPnP
-DLNA as described in 2011</a>, but it required a uPnP server, fuse and
-local storage enough to store the stream locally. This is not going
-to work well for me, lacking enough free space, and it would
-impossible for my friend to get working.</p>
-
-<p>Next, it occurred to me that perhaps I could use VLC to create a
-video stream that Kodi could play. Preferably using
-broadcast/multicast, to avoid having to change any setup on the Kodi
-side when starting such stream. Unfortunately, the only recipe I
-could find using multicast used the rtp protocol, and this protocol
-seem to not be supported by Kodi.</p>
-
-<p>On the other hand, the rtsp protocol is working! Unfortunately I
-have to specify the IP address of the streaming machine in both the
-sending command and the file on the Kodi server. But it is showing my
-desktop, and thus allow us to have a shared look on the big screen at
-the programs I work on.</p>
-
-<p>I did not spend much time investigating codeces. I combined the
-rtp and rtsp recipes from
-<a href="https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/">the
-VLC Streaming HowTo/Command Line Examples</a>, and was able to get
-this working on the desktop/streaming end.</p>
-
-<blockquote><pre>
-vlc screen:// --sout \
- '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{dst=projector.local,port=1234,sdp=rtsp://192.168.11.4:8080/test.sdp}'
-</pre></blockquote>
-
-<p>I ssh-ed into my Kodi box and created a file like this with the
-same IP address:</p>
-
-<blockquote><pre>
-echo rtsp://192.168.11.4:8080/test.sdp \
- > /storage/videos/screenstream.m3u
-</pre></blockquote>
-
-<p>Note the 192.168.11.4 IP address is my desktops IP address. As far
-as I can tell the IP must be hardcoded for this to work. In other
-words, if someone elses machine is going to do the steaming, you have
-to update screenstream.m3u on the Kodi machine and adjust the vlc
-recipe. To get started, locate the file in Kodi and select the m3u
-file while the VLC stream is running. The desktop then show up in my
-big screen. :)</p>
-
-<p>When using the same technique to stream a video file with audio,
-the audio quality is really bad. No idea if the problem is package
-loss or bad parameters for the transcode. I do not know VLC nor Kodi
-enough to tell.</p>
-
-<p><strong>Update 2018-07-12</strong>: Johannes Schauer send me a few
-succestions and reminded me about an important step. The "screen:"
-input source is only available once the vlc-plugin-access-extra
-package is installed on Debian. Without it, you will see this error
-message: "VLC is unable to open the MRL 'screen://'. Check the log
-for details." He further found that it is possible to drop some parts
-of the VLC command line to reduce the amount of hardcoded information.
-It is also useful to consider using cvlc to avoid having the VLC
-window in the desktop view. In sum, this give us this command line on
-the source end
-
-<blockquote><pre>
-cvlc screen:// --sout \
- '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{sdp=rtsp://:8080/}'
-</pre></blockquote>
-
-<p>and this on the Kodi end<p>
-
-<blockquote><pre>
-echo rtsp://192.168.11.4:8080/ \
- > /storage/videos/screenstream.m3u
-</pre></blockquote>
-
-<p>Still bad image quality, though. But I did discover that streaming
-a DVD using dvdsimple:///dev/dvd as the source had excellent video and
-audio quality, so I guess the issue is in the input or transcoding
-parts, not the rtsp part. I've tried to change the vb and ab
-parameters to use more bandwidth, but it did not make a
-difference.</p>
-
-<p>I further received a suggestion from Einar Haraldseid to try using
-gstreamer instead of VLC, and this proved to work great! He also
-provided me with the trick to get Kodi to use a multicast stream as
-its source. By using this monstrous oneliner, I can stream my desktop
-with good video quality in reasonable framerate to the 239.255.0.1
-multicast address on port 1234:
-
-<blockquote><pre>
-gst-launch-1.0 ximagesrc use-damage=0 ! video/x-raw,framerate=30/1 ! \
- videoconvert ! queue2 ! \
- x264enc bitrate=8000 speed-preset=superfast tune=zerolatency qp-min=30 \
- key-int-max=15 bframes=2 ! video/x-h264,profile=high ! queue2 ! \
- mpegtsmux alignment=7 name=mux ! rndbuffersize max=1316 min=1316 ! \
- udpsink host=239.255.0.1 port=1234 ttl-mc=1 auto-multicast=1 sync=0 \
- pulsesrc device=$(pactl list | grep -A2 'Source #' | \
- grep 'Name: .*\.monitor$' | cut -d" " -f2|head -1) ! \
- audioconvert ! queue2 ! avenc_aac ! queue2 ! mux.
-</pre></blockquote>
-
-<p>and this on the Kodi end<p>
-
-<blockquote><pre>
-echo udp://@239.255.0.1:1234 \
- > /storage/videos/screenstream.m3u
-</pre></blockquote>
-
-<p>Note the trick to pick a valid pulseaudio source. It might not
-pick the one you need. This approach will of course lead to trouble
-if more than one source uses the same multicast port and address.
-Note the ttl-mc=1 setting, which limit the multicast packages to the
-local network. If the value is increased, your screen will be
-broadcasted further, one network "hop" for each increase (read up on
-multicast to learn more. :)!</p>
-
-<p>Having cracked how to get Kodi to receive multicast streams, I
-could use this VLC command to stream to the same multicast address.
-The image quality is way better than the rtsp approach, but gstreamer
-seem to be doing a better job.</p>
-
-<blockquote><pre>
-cvlc screen:// --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{mux=ts,dst=239.255.0.1,port=1234,sdp=sap}'
-</pre></blockquote>
-
-<p>As usual, if you use Bitcoin and want to show your support of my
-activities, please send Bitcoin donations to my address
-<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>
+ <title>What would it cost to store all 2018 phone calls in Norway?</title>
+ <link>http://people.skolelinux.org/pere/blog/What_would_it_cost_to_store_all_2018_phone_calls_in_Norway_.html</link>
+ <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/What_would_it_cost_to_store_all_2018_phone_calls_in_Norway_.html</guid>
+ <pubDate>Mon, 25 Nov 2019 20:15:00 +0100</pubDate>
+ <description><p>Four years ago, I did a back of the envelope calculation on
+<a href="http://people.skolelinux.org/pere/blog/What_would_it_cost_to_store_all_phone_calls_in_Norway_.html">how
+much it would cost to store audio recordings of all the phone calls in
+Norway</a>, and came up with NOK 2.1 million / EUR 250 000 for the
+year 2013. It is time to repeat the calculation using updated
+numbers. The calculation is based on how much data storage is needed
+for each minute of audio, how many minutes all the calls in Norway
+sums up to, multiplied by the cost of data storage.</p>
+
+<p>The number of phone call minutes for 2018 was fetched from
+<a href="https://ekomstatistikken.nkom.no/">the NKOM statistics
+site</a>, and for 2018, land line calls are listed as 434 238 000
+minutes, while mobile phone calls are listed with 7 542 006 000
+minutes. The total number of minutes is thus 7 976 244 000. For
+simplicity, I decided to ignore any advantages in audio compression the
+last four years, and continue to assume 60 Kbytes/min as the last
+time.</p>
+
+<p>Storage prices still varies a lot, but as last time, I decide to
+take a reasonable big and cheap hard drive, and double its price to
+include the surrounding costs into account. A 10 TB disk cost less
+than 4500 NOK / 450 EUR these days, and doubling it give 9000 NOK per
+10 TB.</p>
+
+<p>So, with the parameters in place, lets update the old table
+estimating cost for calls in a given year:</p>
+
+<table border="1">
+<tr><th>Year</th><th>Call minutes</th><th>Size</th><th>Price in NOK / EUR</th></tr>
+<tr><td>2005</td><td align="right">24 000 000 000</td><td align="right">1.3 PiB</td><td align="right">1 170 000 / 117 000</td></tr>
+
+<tr><td>2012</td><td align="right">18 000 000 000</td><td align="right">1.0 PiB</td><td align="right">900 000 / 90 000</td></tr>
+
+<tr><td>2013</td><td align="right">17 000 000 000</td><td align="right">950 TiB</td><td align="right">855 000 / 85 500</td></tr>
+
+<tr><td>2018</td><td align="right">7 976 244 000</td><td align="right">445 TiB</td><td align="right">401 100 / 40 110</td></tr>
+</table>
+
+<p>Both the cost of storage and the number of phone call minutes have
+dropped since the last time, bringing the cost down to a level where I
+guess even small organizations can afford to store the audio recording
+from every phone call taken in a year in Norway. Of course, this is
+just the cost of buying the storage equipment. Maintenance, need to
+be included as well, but the volume of a single year is about a single
+rack of hard drives, so it is not much more than I could fit in my own
+home. Wonder how much the electricity bill would raise if I had that
+kind of storage? I doubt it would be more than a few tens of thousand
+NOK per year.</p>