1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries from July
2018</title>
5 <description>Entries from July
2018</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Streaming the Linux desktop to Kodi using VLC and RTSP
</title>
11 <link>http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
</guid>
13 <pubDate>Thu,
12 Jul
2018 02:
00:
00 +
0200</pubDate>
14 <description><p
>A while back, I was asked by a friend how to stream the desktop to
15 my projector connected to Kodi. I sadly had to admit that I had no
16 idea, as it was a task I never had tried. Since then, I have been
17 looking for a way to do so, preferable without much extra software to
18 install on either side. Today I found a way that seem to kind of
19 work. Not great, but it is a start.
</p
>
21 <p
>I had a look at several approaches, for example
22 <a href=
"https://github.com/mfoetsch/dlna_live_streaming
">using uPnP
23 DLNA as described in
2011</a
>, but it required a uPnP server, fuse and
24 local storage enough to store the stream locally. This is not going
25 to work well for me, lacking enough free space, and it would
26 impossible for my friend to get working.
</p
>
28 <p
>Next, it occurred to me that perhaps I could use VLC to create a
29 video stream that Kodi could play. Preferably using
30 broadcast/multicast, to avoid having to change any setup on the Kodi
31 side when starting such stream. Unfortunately, the only recipe I
32 could find using multicast used the rtp protocol, and this protocol
33 seem to not be supported by Kodi.
</p
>
35 <p
>On the other hand, the rtsp protocol is working! Unfortunately I
36 have to specify the IP address of the streaming machine in both the
37 sending command and the file on the Kodi server. But it is showing my
38 desktop, and thus allow us to have a shared look on the big screen at
39 the programs I work on.
</p
>
41 <p
>I did not spend much time investigating codeces. I combined the
42 rtp and rtsp recipes from
43 <a href=
"https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/
">the
44 VLC Streaming HowTo/Command Line Examples
</a
>, and was able to get
45 this working on the desktop/streaming end.
</p
>
47 <blockquote
><pre
>
48 vlc screen:// --sout \
49 '#transcode{vcodec=mp4v,acodec=mpga,vb=
800,ab=
128}:rtp{dst=projector.local,port=
1234,sdp=rtsp://
192.168.11.4:
8080/test.sdp}
'
50 </pre
></blockquote
>
52 <p
>I ssh-ed into my Kodi box and created a file like this with the
53 same IP address:
</p
>
55 <blockquote
><pre
>
56 echo rtsp://
192.168.11.4:
8080/test.sdp \
57 > /storage/videos/screenstream.m3u
58 </pre
></blockquote
>
60 <p
>Note the
192.168.11.4 IP address is my desktops IP address. As far
61 as I can tell the IP must be hardcoded for this to work. In other
62 words, if someone elses machine is going to do the steaming, you have
63 to update screenstream.m3u on the Kodi machine and adjust the vlc
64 recipe. To get started, locate the file in Kodi and select the m3u
65 file while the VLC stream is running. The desktop then show up in my
66 big screen. :)
</p
>
68 <p
>When using the same technique to stream a video file with audio,
69 the audio quality is really bad. No idea if the problem is package
70 loss or bad parameters for the transcode. I do not know VLC nor Kodi
71 enough to tell.
</p
>
73 <p
><strong
>Update
2018-
07-
12</strong
>: Johannes Schauer send me a few
74 succestions and reminded me about an important step. The
"screen:
"
75 input source is only available once the vlc-plugin-access-extra
76 package is installed on Debian. Without it, you will see this error
77 message:
"VLC is unable to open the MRL
'screen://
'. Check the log
78 for details.
" He further found that it is possible to drop some parts
79 of the VLC command line to reduce the amount of hardcoded information.
80 It is also useful to consider using cvlc to avoid having the VLC
81 window in the desktop view. In sum, this give us this command line on
84 <blockquote
><pre
>
85 cvlc screen:// --sout \
86 '#transcode{vcodec=mp4v,acodec=mpga,vb=
800,ab=
128}:rtp{sdp=rtsp://:
8080/}
'
87 </pre
></blockquote
>
89 <p
>and this on the Kodi end
<p
>
91 <blockquote
><pre
>
92 echo rtsp://
192.168.11.4:
8080/ \
93 > /storage/videos/screenstream.m3u
94 </pre
></blockquote
>
96 <p
>Still bad image quality, though. But I did discover that streaming
97 a DVD using dvdsimple:///dev/dvd as the source had excellent video and
98 audio quality, so I guess the issue is in the input or transcoding
99 parts, not the rtsp part. I
've tried to change the vb and ab
100 parameters to use more bandwidth, but it did not make a
101 difference.
</p
>
103 <p
>I further received a suggestion from Einar Haraldseid to try using
104 gstreamer instead of VLC, and this proved to work great! He also
105 provided me with the trick to get Kodi to use a multicast stream as
106 its source. By using this monstrous oneliner, I can stream my desktop
107 with good video quality in reasonable framerate to the
239.255.0.1
108 multicast address on port
1234:
110 <blockquote
><pre
>
111 gst-launch-
1.0 ximagesrc use-damage=
0 ! video/x-raw,framerate=
30/
1 ! \
112 videoconvert ! queue2 ! \
113 x264enc bitrate=
8000 speed-preset=superfast tune=zerolatency qp-min=
30 \
114 key-int-max=
15 bframes=
2 ! video/x-h264,profile=high ! queue2 ! \
115 mpegtsmux alignment=
7 name=mux ! rndbuffersize max=
1316 min=
1316 ! \
116 udpsink host=
239.255.0.1 port=
1234 ttl-mc=
1 auto-multicast=
1 sync=
0 \
117 pulsesrc device=$(pactl list | grep -A2
'Source #
' | \
118 grep
'Name: .*\.monitor$
' | cut -d
" " -f2|head -
1) ! \
119 audioconvert ! queue2 ! avenc_aac ! queue2 ! mux.
120 </pre
></blockquote
>
122 <p
>and this on the Kodi end
<p
>
124 <blockquote
><pre
>
125 echo udp://@
239.255.0.1:
1234 \
126 > /storage/videos/screenstream.m3u
127 </pre
></blockquote
>
129 <p
>Note the trick to pick a valid pulseaudio source. It might not
130 pick the one you need. This approach will of course lead to trouble
131 if more than one source uses the same multicast port and address.
132 Note the ttl-mc=
1 setting, which limit the multicast packages to the
133 local network. If the value is increased, your screen will be
134 broadcasted further, one network
"hop
" for each increase (read up on
135 multicast to learn more. :)!
</p
>
137 <p
>Having cracked how to get Kodi to receive multicast streams, I
138 could use this VLC command to stream to the same multicast address.
139 The image quality is way better than the rtsp approach, but gstreamer
140 seem to be doing a better job.
</p
>
142 <blockquote
><pre
>
143 cvlc screen:// --sout
'#transcode{vcodec=mp4v,acodec=mpga,vb=
800,ab=
128}:rtp{mux=ts,dst=
239.255.0.1,port=
1234,sdp=sap}
'
144 </pre
></blockquote
>
146 <p
>As usual, if you use Bitcoin and want to show your support of my
147 activities, please send Bitcoin donations to my address
148 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
153 <title>What is the most supported MIME type in Debian in
2018?
</title>
154 <link>http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html
</link>
155 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html
</guid>
156 <pubDate>Mon,
9 Jul
2018 08:
05:
00 +
0200</pubDate>
157 <description><p
>Five years ago,
158 <a href=
"http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_.html
">I
159 measured what the most supported MIME type in Debian was
</a
>, by
160 analysing the desktop files in all packages in the archive. Since
161 then, the DEP-
11 AppStream system has been put into production, making
162 the task a lot easier. This made me want to repeat the measurement,
163 to see how much things changed. Here are the new numbers, for
164 unstable only this time:
166 <p
><strong
>Debian Unstable:
</strong
></p
>
170 ----- -----------------------
182 30 audio/x-vorbis+ogg
183 29 image/x-portable-pixmap
185 27 image/x-portable-bitmap
193 <p
>The list was created like this using a sid chroot:
"cat
194 /var/lib/apt/lists/*sid*_dep11_Components-amd64.yml.gz| zcat | awk
'/^
195 - \S+\/\S+$/ {print $
2 }
' | sort | uniq -c | sort -nr | head -
20"</p
>
197 <p
>It is interesting to see how image formats have passed text/plain
198 as the most announced supported MIME type. These days, thanks to the
199 AppStream system, if you run into a file format you do not know, and
200 want to figure out which packages support the format, you can find the
201 MIME type of the file using
"file --mime
&lt;filename
&gt;
", and then
202 look up all packages announcing support for this format in their
203 AppStream metadata (XML or .desktop file) using
"appstreamcli
204 what-provides mimetype
&lt;mime-type
&gt;. For example if you, like
205 me, want to know which packages support inode/directory, you can get a
206 list like this:
</p
>
208 <p
><blockquote
><pre
>
209 % appstreamcli what-provides mimetype inode/directory | grep Package: | sort
216 Package: doublecmd-common
218 Package: enlightenment
238 </pre
></blockquote
></p
>
240 <p
>Using the same method, I can quickly discover that the Sketchup file
241 format is not yet supported by any package in Debian:
</p
>
243 <p
><blockquote
><pre
>
244 % appstreamcli what-provides mimetype application/vnd.sketchup.skp
245 Could not find component providing
'mimetype::application/vnd.sketchup.skp
'.
247 </pre
></blockquote
></p
>
249 <p
>Yesterday I used it to figure out which packages support the STL
3D
252 <p
><blockquote
><pre
>
253 % appstreamcli what-provides mimetype application/sla|grep Package
258 </pre
></blockquote
></p
>
260 <p
>PS: A new version of Cura was uploaded to Debian yesterday.
</p
>
262 <p
>As usual, if you use Bitcoin and want to show your support of my
263 activities, please send Bitcoin donations to my address
264 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
269 <title>Debian APT upgrade without enough free space on the disk...
</title>
270 <link>http://people.skolelinux.org/pere/blog/Debian_APT_upgrade_without_enough_free_space_on_the_disk___.html
</link>
271 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Debian_APT_upgrade_without_enough_free_space_on_the_disk___.html
</guid>
272 <pubDate>Sun,
8 Jul
2018 12:
10:
00 +
0200</pubDate>
273 <description><p
>Quite regularly, I let my Debian Sid/Unstable chroot stay untouch
274 for a while, and when I need to update it there is not enough free
275 space on the disk for apt to do a normal
'apt upgrade
'. I normally
276 would resolve the issue by doing
'apt install
&lt;somepackages
&gt;
' to
277 upgrade only some of the packages in one batch, until the amount of
278 packages to download fall below the amount of free space available.
279 Today, I had about
500 packages to upgrade, and after a while I got
280 tired of trying to install chunks of packages manually. I concluded
281 that I did not have the spare hours required to complete the task, and
282 decided to see if I could automate it. I came up with this small
283 script which I call
'apt-in-chunks
':
</p
>
285 <p
><blockquote
><pre
>
288 # Upgrade packages when the disk is too full to upgrade every
289 # upgradable package in one lump. Fetching packages to upgrade using
290 # apt, and then installing using dpkg, to avoid changing the package
291 # flag for manual/automatic.
296 if [
"$
1" ]; then
297 grep -v
"$
1"
303 for p in $(apt list --upgradable | ignore
"$@
" |cut -d/ -f1 | grep -v
'^Listing...
'); do
304 echo
"Upgrading $p
"
306 apt install --download-only -y $p
307 for f in /var/cache/apt/archives/*.deb; do
308 if [ -e
"$f
" ]; then
309 dpkg -i /var/cache/apt/archives/*.deb
314 </pre
></blockquote
></p
>
316 <p
>The script will extract the list of packages to upgrade, try to
317 download the packages needed to upgrade one package, install the
318 downloaded packages using dpkg. The idea is to upgrade packages
319 without changing the APT mark for the package (ie the one recording of
320 the package was manually requested or pulled in as a dependency). To
321 use it, simply run it as root from the command line. If it fail, try
322 'apt install -f
' to clean up the mess and run the script again. This
323 might happen if the new packages conflict with one of the old
324 packages. dpkg is unable to remove, while apt can do this.
</p
>
326 <p
>It take one option, a package to ignore in the list of packages to
327 upgrade. The option to ignore a package is there to be able to skip
328 the packages that are simply too large to unpack. Today this was
329 'ghc
', but I have run into other large packages causing similar
330 problems earlier (like TeX).
</p
>
332 <p
>Update
2018-
07-
08: Thanks to Paul Wise, I am aware of two
333 alternative ways to handle this. The
"unattended-upgrades
334 --minimal-upgrade-steps
" option will try to calculate upgrade sets for
335 each package to upgrade, and then upgrade them in order, smallest set
336 first. It might be a better option than my above mentioned script.
337 Also,
"aptutude upgrade
" can upgrade single packages, thus avoiding
338 the need for using
"dpkg -i
" in the script above.
</p
>
340 <p
>As usual, if you use Bitcoin and want to show your support of my
341 activities, please send Bitcoin donations to my address
342 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>