Kodi Community Forum
Python interface to add chapters to a video stream - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Feature Requests (https://forum.kodi.tv/forumdisplay.php?fid=9)
+--- Thread: Python interface to add chapters to a video stream (/showthread.php?tid=347080)



Python interface to add chapters to a video stream - dag- - 2019-09-07

We have an add-on for a VOD service of a public broadcaster (VRT NU) and some of the VOD content comes with metadata including chapter information (basically a name + offset).
Now currently it does not seem possible (in Python at least) to add chapter information to an existing video stream (i.e. by adding the information to the ListItem).

However for our users it would be very useful to skip the current chapter and move to the next. This is supported by most of the News programs (usually covering multiple topics).
Some of these programs (e.g. program about local politics) take up to 2 hours with up to 12 items (interviews, debates, music).

The metadata looks like this:
json:

{
...
    "chapters": [
        {
            "startTime": 56,
            "title": "Lerarentekort",
            "id": "8a5ad532-cf67-4e62-b5e7-43af03d4b93d",
            "externalImageUrl": null,
            "duration": "00:10:57",
            "thumbnail": ".thumb.319.319.png",
            "formattedStartTime": "00:00:56",
            "startTimeInMillis": 56353
        }, {
            "startTime": 713,
            "title": "Sociaal Incapabele Michiel",
            "id": "76303240-6ff4-4ef3-9f2b-c1e7ce1e8438",
            "externalImageUrl": null,
            "duration": "00:05:04",
            "thumbnail": ".thumb.319.319.png",
            "formattedStartTime": "00:11:53",
            "startTimeInMillis": 713485
        }, {
            "startTime": 1017,
            "title": "De aangever van Alex Agnew",
            "id": "3ab0cb0d-facb-463a-b75b-bbc761b3ad74",
            "externalImageUrl": null,
            "duration": "00:01:27",
            "thumbnail": ".thumb.319.319.png",
            "formattedStartTime": "00:16:57",
            "startTimeInMillis": 1017987
        },
...
    ],
...
    "programName": "de-ideale-wereld",
...
    "shortDescription": "Met Alex Agnew",
...
    "title": "Alex Agnew",
}



RE: Python interface to add chapters to a video stream - dag- - 2019-09-09

This request relates to the recent work to add Chapter support to streams for inputstream.adaptive. https://github.com/xbmc/xbmc/pull/16581

A python interface for Kodi 19 would be very welcome.

Something like:

python:

listitem.setChapters([
    dict(starttime=56, label='Lerarentekort', thumb='https://foo.bar/thumbnail/some_thumb.png'),
    dict(starttime=713, label='Sociaal Incapabele Michiel', thumb='https://foo.bar/thumbnail/another_thumb2.png'),
])



RE: Python interface to add chapters to a video stream - dag- - 2020-01-05

The chapter support was backported to Kodi Leia (18.6) in https://github.com/xbmc/xbmc/pull/16977

Still missing a python interface though.


RE: Python interface to add chapters to a video stream - yeahme49 - 2022-09-13

Did anything ever come of this? I haven't found anything so I'm assuming not but just wanted to double check.


RE: Python interface to add chapters to a video stream - Schattenechse - 2024-04-06

I would also like to have this feature.
It's several streaming services by now which use chapters in some way or another. (YouTube does so directly from the video description, Crunchyroll and many others do so indirectly by providing skip intro/outro functions in their players and APIs.)

All my research discovered so far is that chapters are supported if present in the media file container. But manually manipulating that in a stream seems like a whole lot of work and very difficult to me.

So some API function to add or edit chapters in streams (or media files) would be very useful to a lot of streaming plugins.


RE: Python interface to add chapters to a video stream - scott967 - 2024-04-07

Chapters are really a subset of bookmarks.  Currently JSON-RPC Files.SetFileDetails method provides for playcount, lastplayed, and resume.  Not sure if there would be resistance from a software architecture standpoint to adding setters/getters for bookmarks.
scott s.
.