Nodes/MKRShift_Nodes/Chapter Marker Generator
ComfyUI Node

Chapter Marker Generator

Turn your timeline data into real YouTube chapters in one pass

By criskb·Created 7 months ago·Updated 5 months ago· 0
Chapter Marker Generator
    • chapters_json
    • ffmetadata_text
    • chapter_count
    • summary
    duration_sec60.00
    scene_ranges_json[]
    beat_markers_json[]
    silence_ranges_json[]
    min_chapter_sec8.0
    title_prefixChapter

    If you're publishing AI-generated edits, chapters are the difference between a video people scrub through and a video people can navigate. MKRChapterMarkerGenerator takes whatever timing data you've already produced - scene ranges, beat markers, silence ranges - and fuses it into a clean chapter list, then hands you the exact ffmetadata text that makes ffmpeg write those chapters into the file. It's the "finishing" step in the pack's timeline lane, and it slots neatly next to MKRBeatSyncRetimer and MKRBlackFrameDetector.

    Part of MKRShift_Nodes by criskb. Install: ComfyUI Manager → search "MKRShift_Nodes", or git clone https://github.com/criskb/MKRShift_Nodes into custom_nodes/, restart. Nothing else to install for this one.

    How it works

    The node collects candidate chapter points from three sources:

    • scene_ranges_json - it grabs the start_time (or start_sec) of each scene range,
    • beat_markers_json - beat timestamps from a beat-sync pass,
    • silence_ranges_json - silence start points from an audio analysis.

    It sorts all candidates, drops any that land within min_chapter_sec of a chapter already placed, and emits a numbered sequence. You get chapters_json (structured data, for other nodes) and ffmetadata_text - the ready-to-mux text with [CHAPTER] blocks containing START/END timestamps and titles like "Chapter 1". chapter_count and a summary round it out.

    The few inputs you'll actually set

    • duration_sec - the total video length; needed to cap the last chapter.
    • min_chapter_sec (default 8) - the shortest allowed chapter. This is your clutter control; too low and you get a chapter every two seconds.
    • title_prefix (default "Chapter") - the label stem.

    The three JSON inputs all default to [], so the node is fine with only one source wired up. Feed it just your beat markers if that's all you have.

    Using the ffmetadata

    Classic ffmpeg move, and the one this node exists to feed:

    ffmpeg -i video.mp4 -i chapters.txt -map_metadata 1 -c copy -y out.mp4
    

    Paste ffmetadata_text into chapters.txt and run that. Because it's a stream copy, it's fast. If your player ignores the chapters, check that you're not transcoding with a container that drops metadata. Nothing here calls any API and nothing needs a key - it's pure text generation, which makes it a nice, boring, dependable node in a pack that isn't always boring.

    CategoryMKRShift Nodes/Media/Timeline

    Inputs (6)

    NameTypeDefaultDescription
    duration_secFLOAT60.000–86400
    scene_ranges_jsonSTRING[]
    beat_markers_jsonSTRING[]
    silence_ranges_jsonSTRING[]
    min_chapter_secFLOAT8.01–600
    title_prefixSTRINGChapter

    Outputs (4)

    NameTypeDescription
    chapters_jsonSTRING
    ffmetadata_textSTRING
    chapter_countINT
    summarySTRING