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