OBS for some time has had the feature to insert markers while you are recording
with a assigned hotkey. These are saved as chapters, and can be read with
ffprobe.
Example output:
Chapters:
Chapter #0:0: start 0.000000, end 6.250000
Metadata:
title : Start
Chapter #0:1: start 6.250000, end 10.083000
Metadata:
title : Unnamed 1
Chapter #0:2: start 10.083000, end 11.666000
Metadata:
title : Unnamed 2
Chapter #0:3: start 11.666000, end 12.900000
Metadata:
title : Unnamed 3
It would be great if kdenlive could read this upon video import, and assign
markers in the clip when it is brought into the timeline (markers in the clip are
preferable, timeline markers are less useful since they don't move along as you
cut up the clip).
INPUT: Video file path
OUTPUT: List of markers with timecode and name
ALGORITHM:
1. Invoke ffprobe with JSON output format to extract chapter metadata
- Command: ffprobe -v quiet -print_format json -show_chapters <video_file>
2. Parse JSON output to extract chapters array
- Each chapter has:
* start_time: beginning in seconds (float)
* end_time: ending in seconds (float)
* tags.title: chapter name (string, optional - use "Unnamed N" if missing)
3. For each chapter:
a. Convert start_time (seconds) to GenTime object
b. Extract chapter title from tags.title
c. Create CommentedTime marker with:
- Position: start_time as GenTime
- Comment: chapter title
- Type: default marker type (0 or user preference)
- Duration: optional range marker (end_time - start_time)
4. Import markers into clip using existing importJsonMarkers method
- Convert list to JSON format matching Kdenlive's marker structure
- Call ProjectClip::importJsonMarkers(json)
Hi, yeah I managed to extract the markers, though was wondering why do I need to convert to GenTime and CommentedTimeobjects when I can convert the markers to Kdenlive json format in a similar way as one done in the SceneSplitTask::runsince there’s GenTimeor CommentedTimeor even the QList don’t have a way to export to json?
Hi @saurabhs, thanks for looking into this. Best way to get answers for your valid questions is to create a MR in the Kdenlive repo so that the developer and other core team members can look into this and give you guidance or suggestions.
Hi, here’s the MR, though I’m not sure about auto binId = pCore->projectItemModel()->getAllClipIds()[0]; but I couldn’t find any other way to get the ProjectClip refenrence.