1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries tagged kodi
</title>
5 <description>Entries tagged kodi
</description>
6 <link>https://people.skolelinux.org/pere/blog/
</link>
10 <title>Invidious add-on for Kodi
20</title>
11 <link>https://people.skolelinux.org/pere/blog/Invidious_add_on_for_Kodi_20.html
</link>
12 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Invidious_add_on_for_Kodi_20.html
</guid>
13 <pubDate>Thu,
10 Aug
2023 19:
50:
00 +
0200</pubDate>
14 <description><p
>I still enjoy
<a href=
"https://kodi.tv/
">Kodi
</a
> and
15 <a href=
"https://libreelec.tv/
">LibreELEC
</a
> as my multimedia center
16 at home. Sadly two of the services I really would like to use from
17 within Kodi are not easily available. The most wanted add-on would be
18 one making
<a href=
"https://archive.org/
">The Internet Archive
</a
>
20 <a href=
"https://kodi.wiki/view/Add-on:Internet_Archive
">not been
21 working
</a
> for many years. The second most wanted add-on is one
22 using
<a href=
"https://invidious.io/
">the Invidious privacy enhanced
23 Youtube frontent
</a
>. A plugin for this has been partly working, but
24 not been kept up to date in the Kodi add-on repository, and its
25 upstream seem to have given it up in april this year, when the git
26 repository was closed. A few days ago I got tired of this sad state
27 of affairs and decided to have a improve the Invidious add-on. As
28 <a href=
"https://github.com/iv-org/invidious/issues/
3872">Google has
29 already attacked
</a
> the Invidious concept, so it need all the support
30 if can get. My small contribution here is to improve the service
31 status on Kodi.
</p
>
33 <p
>I added support to the Invidious add-on for automatically picking a
34 working Invidious instance, instead of requiring the user to specify
35 the URL to a specific instance after installation. I also had a look
36 at the set of patches floating around in the various forks on github,
37 and decided to clean up at least some of the features I liked and
38 integrate them into my new release branch. Now the plugin can handle
39 channel and short video items in search results. Earlier it could
40 only handle single video instances in the search response. I also
41 brushed up the set of metadata displayed a bit, but hope I can figure
42 out how to get more relevant metadata displayed.
</p
>
44 <p
>Because I only use Kodi
20 myself, I only test on version
20 and am
45 only motived to ensure version
20 is working. Because of API changes
46 between version
19 and
20, I suspect it will fail with earlier Kodi
50 <a href=
"https://github.com/xbmc/repo-plugins/pull/
4363">asked to have
51 the add-on added
</a
> to the official Kodi
20 repository, and is
52 waiting to heard back from the repo maintainers.
</p
>
54 <p
>As usual, if you use Bitcoin and want to show your support of my
55 activities, please send Bitcoin donations to my address
56 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
61 <title>New and improved Frikanalen Kodi addon version
0.0.3</title>
62 <link>https://people.skolelinux.org/pere/blog/New_and_improved_Frikanalen_Kodi_addon_version_0_0_3.html
</link>
63 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/New_and_improved_Frikanalen_Kodi_addon_version_0_0_3.html
</guid>
64 <pubDate>Thu,
8 Nov
2018 10:
30:
00 +
0100</pubDate>
65 <description><p
>If you read my blog regularly, you probably know I am involved in
66 running and developing the
<a href=
"https://frikanalen.no/
">Norwegian
67 TV channel Frikanalen
</a
>. It is an open channel, allowing everyone
68 in Norway to publish videos on a TV channel with national coverage.
69 You can think of it as Youtube for national television.
70 In addition to distribution on RiksTV and Uninett, Frikanalen is also
71 available as a Kodi addon. The last few days I have updated the code
72 to add more features. A
73 <a href=
"https://kodi.tv/addon/plugins-video-add-ons/frikanalen-nett-tv
">new
74 and improved version
0.0.3 Frikanalen addon
</a
> was just made
75 available via the Kodi repositories. This new version include a
76 option to browse videos by category, as well as free text search
77 in the video archive. It will now also show the video duration in the
78 video lists, which were missing earlier. A new and experimental
79 link to the HD video stream currently being worked on is provided, for
80 those that want to see what the
<a href=
"https://casparcg.com/
">CasparCG
</a
>
81 output look like. The alternative is the SD video stream, generated
82 using MLT. CasparCG is controlled by our
83 <a href=
"https://github.com/Frikanalen/mltplayout/
">mltplayout
84 server
</a
> which instead of talking to mlt is giving PLAY instructions
85 to the CasparCG server when it is time to start a new program.
</p
>
87 <p
>By now, you are probably wondering what kind of content is being
88 played on the channel. These days, it is filled with technical
89 presentations like those from
<a href=
"https://www.nuug.no/
">NUUG
</a
>,
90 <a href=
"https://www.debconf.org/
">Debconf
</a
>, Makercon, and TED,
91 but there are also some periods with
92 <a href=
"https://www.empo.no/
">EMPT TV
</a
> and
93 <a href=
"https://www.p7.no/
">P7
</a
>.
95 <p
>As usual, if you use Bitcoin and want to show your support of my
96 activities, please send Bitcoin donations to my address
97 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
102 <title>Using the Kodi API to play Youtube videos
</title>
103 <link>https://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html
</link>
104 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html
</guid>
105 <pubDate>Sun,
2 Sep
2018 23:
40:
00 +
0200</pubDate>
106 <description><p
>I continue to explore my Kodi installation, and today I wanted to
107 tell it to play a youtube URL I received in a chat, without having to
108 insert search terms using the on-screen keyboard. After searching the
109 web for API access to the Youtube plugin and testing a bit, I managed
110 to find a recipe that worked. If you got a kodi instance with its API
111 available from http://kodihost/jsonrpc, you can try the following to
112 have check out a nice cover band.
</p
>
114 <p
><blockquote
><pre
>curl --silent --header
'Content-Type: application/json
' \
115 --data-binary
'{
"id
":
1,
"jsonrpc
":
"2.0",
"method
":
"Player.Open
",
116 "params
": {
"item
": {
"file
":
117 "plugin://plugin.video.youtube/play/?video_id=LuRGVM9O0qg
" } } }
' \
118 http://projector.local/jsonrpc
</pre
></blockquote
></p
>
120 <p
>I
've extended kodi-stream program to take a video source as its
121 first argument. It can now handle direct video links, youtube links
122 and
'desktop
' to stream my desktop to Kodi. It is almost like a
123 Chromecast. :)
</p
>
125 <p
>As usual, if you use Bitcoin and want to show your support of my
126 activities, please send Bitcoin donations to my address
127 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
132 <title>Simple streaming the Linux desktop to Kodi using GStreamer and RTP
</title>
133 <link>https://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html
</link>
134 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html
</guid>
135 <pubDate>Thu,
12 Jul
2018 17:
55:
00 +
0200</pubDate>
136 <description><p
>Last night, I wrote
137 <a href=
"http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
">a
138 recipe to stream a Linux desktop using VLC to a instance of Kodi
</a
>.
139 During the day I received valuable feedback, and thanks to the
140 suggestions I have been able to rewrite the recipe into a much simpler
141 approach requiring no setup at all. It is a single script that take
142 care of it all.
</p
>
144 <p
>This new script uses GStreamer instead of VLC to capture the
145 desktop and stream it to Kodi. This fixed the video quality issue I
146 saw initially. It further removes the need to add a m3u file on the
147 Kodi machine, as it instead connects to
148 <a href=
"https://kodi.wiki/view/JSON-RPC_API/v8
">the JSON-RPC API in
149 Kodi
</a
> and simply ask Kodi to play from the stream created using
150 GStreamer. Streaming the desktop to Kodi now become trivial. Copy
151 the script below, run it with the DNS name or IP address of the kodi
152 server to stream to as the only argument, and watch your screen show
153 up on the Kodi screen. Note, it depend on multicast on the local
154 network, so if you need to stream outside the local network, the
155 script must be modified. Also note, I have no idea if audio work, as
156 I only care about the picture part.
</p
>
158 <blockquote
><pre
>
161 # Stream the Linux desktop view to Kodi. See
162 # http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
163 # for backgorund information.
165 # Make sure the stream is stopped in Kodi and the gstreamer process is
166 # killed if something go wrong (for example if curl is unable to find the
167 # kodi server). Do the same when interrupting this script.
171 params=
"$
3"
172 curl --silent --header
'Content-Type: application/json
' \
173 --data-binary
"{ \
"id\
":
1, \
"jsonrpc\
": \
"2.0\
", \
"method\
": \
"$cmd\
", \
"params\
": $params }
" \
174 "http://$host/jsonrpc
"
177 if [ -n
"$kodihost
" ] ; then
178 # Stop the playing when we end
179 playerid=$(kodicmd
"$kodihost
" Player.GetActivePlayers
"{}
" |
180 jq .result[].playerid)
181 kodicmd
"$kodihost
" Player.Stop
"{ \
"playerid\
" : $playerid }
" > /dev/null
183 if [
"$gstpid
" ]
&& kill -
0 "$gstpid
" >/dev/null
2>&1; then
184 kill
"$gstpid
"
187 trap cleanup EXIT INT
189 if [ -n
"$
1" ]; then
200 pasrc=$(pactl list | grep -A2
'Source #
' | grep
'Name: .*\.monitor$
' | \
201 cut -d
" " -f2|head -
1)
202 gst-launch-
1.0 ximagesrc use-damage=
0 ! video/x-raw,framerate=
30/
1 ! \
203 videoconvert ! queue2 ! \
204 x264enc bitrate=
8000 speed-preset=superfast tune=zerolatency qp-min=
30 \
205 key-int-max=
15 bframes=
2 ! video/x-h264,profile=high ! queue2 ! \
206 mpegtsmux alignment=
7 name=mux ! rndbuffersize max=
1316 min=
1316 ! \
207 udpsink host=$mcast port=$mcastport ttl-mc=$mcastttl auto-multicast=
1 sync=
0 \
208 pulsesrc device=$pasrc ! audioconvert ! queue2 ! avenc_aac ! queue2 ! mux. \
209 > /dev/null
2>&1 &
212 # Give stream a second to get going
215 # Ask kodi to start streaming using its JSON-RPC API
216 kodicmd
"$kodihost
" Player.Open \
217 "{\
"item\
": { \
"file\
": \
"udp://@$mcast:$mcastport\
" } }
" > /dev/null
219 # wait for gst to end
220 wait
"$gstpid
"
221 </pre
></blockquote
>
223 <p
>I hope you find the approach useful. I know I do.
</p
>
225 <p
>As usual, if you use Bitcoin and want to show your support of my
226 activities, please send Bitcoin donations to my address
227 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
232 <title>Streaming the Linux desktop to Kodi using VLC and RTSP
</title>
233 <link>https://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
</link>
234 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
</guid>
235 <pubDate>Thu,
12 Jul
2018 02:
00:
00 +
0200</pubDate>
236 <description><p
>PS: See
237 <ahref=
"http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html
">the
238 followup post
</a
> for a even better approach.
</p
>
240 <p
>A while back, I was asked by a friend how to stream the desktop to
241 my projector connected to Kodi. I sadly had to admit that I had no
242 idea, as it was a task I never had tried. Since then, I have been
243 looking for a way to do so, preferable without much extra software to
244 install on either side. Today I found a way that seem to kind of
245 work. Not great, but it is a start.
</p
>
247 <p
>I had a look at several approaches, for example
248 <a href=
"https://github.com/mfoetsch/dlna_live_streaming
">using uPnP
249 DLNA as described in
2011</a
>, but it required a uPnP server, fuse and
250 local storage enough to store the stream locally. This is not going
251 to work well for me, lacking enough free space, and it would
252 impossible for my friend to get working.
</p
>
254 <p
>Next, it occurred to me that perhaps I could use VLC to create a
255 video stream that Kodi could play. Preferably using
256 broadcast/multicast, to avoid having to change any setup on the Kodi
257 side when starting such stream. Unfortunately, the only recipe I
258 could find using multicast used the rtp protocol, and this protocol
259 seem to not be supported by Kodi.
</p
>
261 <p
>On the other hand, the rtsp protocol is working! Unfortunately I
262 have to specify the IP address of the streaming machine in both the
263 sending command and the file on the Kodi server. But it is showing my
264 desktop, and thus allow us to have a shared look on the big screen at
265 the programs I work on.
</p
>
267 <p
>I did not spend much time investigating codeces. I combined the
268 rtp and rtsp recipes from
269 <a href=
"https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/
">the
270 VLC Streaming HowTo/Command Line Examples
</a
>, and was able to get
271 this working on the desktop/streaming end.
</p
>
273 <blockquote
><pre
>
274 vlc screen:// --sout \
275 '#transcode{vcodec=mp4v,acodec=mpga,vb=
800,ab=
128}:rtp{dst=projector.local,port=
1234,sdp=rtsp://
192.168.11.4:
8080/test.sdp}
'
276 </pre
></blockquote
>
278 <p
>I ssh-ed into my Kodi box and created a file like this with the
279 same IP address:
</p
>
281 <blockquote
><pre
>
282 echo rtsp://
192.168.11.4:
8080/test.sdp \
283 > /storage/videos/screenstream.m3u
284 </pre
></blockquote
>
286 <p
>Note the
192.168.11.4 IP address is my desktops IP address. As far
287 as I can tell the IP must be hardcoded for this to work. In other
288 words, if someone elses machine is going to do the steaming, you have
289 to update screenstream.m3u on the Kodi machine and adjust the vlc
290 recipe. To get started, locate the file in Kodi and select the m3u
291 file while the VLC stream is running. The desktop then show up in my
292 big screen. :)
</p
>
294 <p
>When using the same technique to stream a video file with audio,
295 the audio quality is really bad. No idea if the problem is package
296 loss or bad parameters for the transcode. I do not know VLC nor Kodi
297 enough to tell.
</p
>
299 <p
><strong
>Update
2018-
07-
12</strong
>: Johannes Schauer send me a few
300 succestions and reminded me about an important step. The
"screen:
"
301 input source is only available once the vlc-plugin-access-extra
302 package is installed on Debian. Without it, you will see this error
303 message:
"VLC is unable to open the MRL
'screen://
'. Check the log
304 for details.
" He further found that it is possible to drop some parts
305 of the VLC command line to reduce the amount of hardcoded information.
306 It is also useful to consider using cvlc to avoid having the VLC
307 window in the desktop view. In sum, this give us this command line on
310 <blockquote
><pre
>
311 cvlc screen:// --sout \
312 '#transcode{vcodec=mp4v,acodec=mpga,vb=
800,ab=
128}:rtp{sdp=rtsp://:
8080/}
'
313 </pre
></blockquote
>
315 <p
>and this on the Kodi end
<p
>
317 <blockquote
><pre
>
318 echo rtsp://
192.168.11.4:
8080/ \
319 > /storage/videos/screenstream.m3u
320 </pre
></blockquote
>
322 <p
>Still bad image quality, though. But I did discover that streaming
323 a DVD using dvdsimple:///dev/dvd as the source had excellent video and
324 audio quality, so I guess the issue is in the input or transcoding
325 parts, not the rtsp part. I
've tried to change the vb and ab
326 parameters to use more bandwidth, but it did not make a
327 difference.
</p
>
329 <p
>I further received a suggestion from Einar Haraldseid to try using
330 gstreamer instead of VLC, and this proved to work great! He also
331 provided me with the trick to get Kodi to use a multicast stream as
332 its source. By using this monstrous oneliner, I can stream my desktop
333 with good video quality in reasonable framerate to the
239.255.0.1
334 multicast address on port
1234:
336 <blockquote
><pre
>
337 gst-launch-
1.0 ximagesrc use-damage=
0 ! video/x-raw,framerate=
30/
1 ! \
338 videoconvert ! queue2 ! \
339 x264enc bitrate=
8000 speed-preset=superfast tune=zerolatency qp-min=
30 \
340 key-int-max=
15 bframes=
2 ! video/x-h264,profile=high ! queue2 ! \
341 mpegtsmux alignment=
7 name=mux ! rndbuffersize max=
1316 min=
1316 ! \
342 udpsink host=
239.255.0.1 port=
1234 ttl-mc=
1 auto-multicast=
1 sync=
0 \
343 pulsesrc device=$(pactl list | grep -A2
'Source #
' | \
344 grep
'Name: .*\.monitor$
' | cut -d
" " -f2|head -
1) ! \
345 audioconvert ! queue2 ! avenc_aac ! queue2 ! mux.
346 </pre
></blockquote
>
348 <p
>and this on the Kodi end
<p
>
350 <blockquote
><pre
>
351 echo udp://@
239.255.0.1:
1234 \
352 > /storage/videos/screenstream.m3u
353 </pre
></blockquote
>
355 <p
>Note the trick to pick a valid pulseaudio source. It might not
356 pick the one you need. This approach will of course lead to trouble
357 if more than one source uses the same multicast port and address.
358 Note the ttl-mc=
1 setting, which limit the multicast packages to the
359 local network. If the value is increased, your screen will be
360 broadcasted further, one network
"hop
" for each increase (read up on
361 multicast to learn more. :)!
</p
>
363 <p
>Having cracked how to get Kodi to receive multicast streams, I
364 could use this VLC command to stream to the same multicast address.
365 The image quality is way better than the rtsp approach, but gstreamer
366 seem to be doing a better job.
</p
>
368 <blockquote
><pre
>
369 cvlc screen:// --sout
'#transcode{vcodec=mp4v,acodec=mpga,vb=
800,ab=
128}:rtp{mux=ts,dst=
239.255.0.1,port=
1234,sdp=sap}
'
370 </pre
></blockquote
>
372 <p
>As usual, if you use Bitcoin and want to show your support of my
373 activities, please send Bitcoin donations to my address
374 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
379 <title>Add-on to control the projector from within Kodi
</title>
380 <link>https://people.skolelinux.org/pere/blog/Add_on_to_control_the_projector_from_within_Kodi.html
</link>
381 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Add_on_to_control_the_projector_from_within_Kodi.html
</guid>
382 <pubDate>Tue,
26 Jun
2018 23:
55:
00 +
0200</pubDate>
383 <description><p
>My movie playing setup involve
<a href=
"https://kodi.tv/
">Kodi
</a
>,
384 <a href=
"https://openelec.tv
">OpenELEC
</a
> (probably soon to be
385 replaced with
<a href=
"https://libreelec.tv/
">LibreELEC
</a
>) and an
386 Infocus IN76 video projector. My projector can be controlled via both
387 a infrared remote controller, and a RS-
232 serial line. The vendor of
388 my projector,
<a href=
"https://www.infocus.com/
">InFocus
</a
>, had been
389 sensible enough to document the serial protocol in its user manual, so
390 it is easily available, and I used it some years ago to write
391 <a href=
"https://github.com/petterreinholdtsen/infocus-projector-control
">a
392 small script to control the projector
</a
>. For a while now, I longed
393 for a setup where the projector was controlled by Kodi, for example in
394 such a way that when the screen saver went on, the projector was
395 turned off, and when the screen saver exited, the projector was turned
398 <p
>A few days ago, with very good help from parts of my family, I
399 managed to find a Kodi Add-on for controlling a Epson projector, and
400 got in touch with its author to see if we could join forces and make a
401 Add-on with support for several projectors. To my pleasure, he was
402 positive to the idea, and we set out to add InFocus support to his
403 add-on, and make the add-on suitable for the official Kodi add-on
404 repository.
</p
>
406 <p
>The Add-on is now working (for me, at least), with a few minor
407 adjustments. The most important change I do relative to the master
408 branch in the github repository is embedding the
409 <a href=
"https://github.com/pyserial/pyserial
">pyserial module
</a
> in
410 the add-on. The long term solution is to make a
"script
" type
411 pyserial module for Kodi, that can be pulled in as a dependency in
412 Kodi. But until that in place, I embed it.
</p
>
414 <p
>The add-on can be configured to turn on the projector when Kodi
415 starts, off when Kodi stops as well as turn the projector off when the
416 screensaver start and on when the screesaver stops. It can also be
417 told to set the projector source when turning on the projector.
419 <p
>If this sound interesting to you, check out
420 <a href=
"https://github.com/fredrik-eriksson/kodi_projcontrol
">the
421 project github repository
</a
>. Perhaps you can send patches to
422 support your projector too? As soon as we find time to wrap up the
423 latest changes, it should be available for easy installation using any
424 Kodi instance.
</p
>
426 <p
>For future improvements, I would like to add projector model
427 detection and the ability to adjust the brightness level of the
428 projector from within Kodi. We also need to figure out how to handle
429 the cooling period of the projector. My projector refuses to turn on
430 for
60 seconds after it was turned off. This is not handled well by
431 the add-on at the moment.
</p
>
433 <p
>As usual, if you use Bitcoin and want to show your support of my
434 activities, please send Bitcoin donations to my address
435 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>