What this workflow does
This workflow helps add chapters to YouTube videos automatically. It solves the problem of videos missing clear chapters that show viewers where different topics start. After running, the video description will have labeled chapters with timestamps, making the video easier to watch and navigate.
The workflow gets video info and captions from YouTube, reads the text from captions, then uses Google Gemini AI to find chapter points. It formats these into a list and adds them to the video description on YouTube.
Who should use this workflow
This helps video creators with long tutorials or lessons that lack clear segments. Non-technical creators who want fast, error-free chapters can use it. It also suits anyone wanting to save hours spent manually marking chapters.
You should have some n8n knowledge and access to YouTube and Google Gemini APIs.
Tools and services used
- n8n: Automates the workflow steps.
- YouTube Data API: Gets video metadata and captions.
- Google Gemini (PaLM) API: Uses AI to create chapter timestamps.
- HTTP Request node: Fetches caption files.
- Extract from File node: Reads SRT captions text.
Use OAuth2 credentials for secure YouTube access and API keys for Google Gemini.
Beginner step-by-step: How to use this workflow in n8n
Step 1: Import the workflow
- Download the provided workflow file using the Download button on this page.
- Open your n8n editor and click “Import from File”.
- Select the saved workflow file to load it.
Step 2: Add your credentials
- Go to Credentials and add your YouTube OAuth2 API Key.
- Add your Google Gemini (PaLM) API Key.
Step 3: Update video ID
- Find the Set Video ID node.
- Replace the example video ID with the video you want chapters for.
Step 4: Test the workflow
- Click the Manual Trigger node When clicking ‘Test workflow’.
- Make sure it runs without error and creates chapter timestamps.
Step 5: Activate for production
- Switch the workflow toggle ON in n8n to enable scheduled or webhook triggers.
- Optionally add a trigger for new uploads or schedule video checks.
For better privacy or speed, try self-host n8n.
Inputs → Processing → Output
Inputs
- YouTube video ID.
- YouTube OAuth2 credentials.
- Google Gemini API key.
Processing Steps
- Get video metadata including title from YouTube API.
- Fetch available caption track IDs for the video.
- Download captions in SRT format.
- Extract raw text from captions.
- Send transcript to Google Gemini Large Language Model to find chapter points and names.
- Parse AI response to structure chapters with time and titles.
- Format chapters as a description block for YouTube.
- Update YouTube video description to include new chapter timestamps.
Output
The YouTube video description is updated with timestamped chapters titled clearly. This lets viewers jump directly to different video parts.
Handling edge cases and failures
- No captions found: Confirm video has uploaded captions or auto-subtitles enabled.
- API 403 error: Reauthorize YouTube OAuth2 credentials inside n8n.
- Google Gemini errors: Check API key validity and model name correctness.
Always test workflows with a video known to have captions before bulk use.
Customizations
- Change video by updating the video ID in the Set Video ID node.
- Modify chapter display by editing the prompt in the Chain LLM node called “Tag Chapters in Description”.
- Switch Google Gemini model to find balance between speed and cost.
- Add multi-language caption logic by changing caption fetch HTTP requests.
- Add logging nodes after each step to see outputs for debugging.
Conclusion
With this workflow, YouTube video chapters get made automatically every time. It saves hours of work and avoids errors from manual chapter marking. Videos become easier to watch, and viewers stay longer.
After this, automate thumbnail creation or viewer data for even better results.
Sample prompt used in the “Tag Chapters in Description” node
This prompt sends SRT transcript and AI results to format chapters:
{
"description":"00:00 Introduction\n02:15 Topic One\n05:30 Topic Two\n10:45 Conclusion"
}Use this when editing the Chain LLM node to keep format uniform and easy to read.

