Automate YouTube Chapter Creation with n8n & Google Gemini

Struggling to manually create YouTube video chapters? This n8n workflow fetches captions, uses Google Gemini AI to generate chapter timestamps, and updates your video description automatically, saving hours of tedious work.
httpRequest
youTube
manualTrigger
+5
Workflow Identifier: 1120
NODES in Use: Manual Trigger, HTTP Request, Extract From File, YouTube, Set, outputParserStructured, lmChatGoogleGemini, chainLlm
Automate YouTube chapters with n8n and Google Gemini

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

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

  1. Download the provided workflow file using the Download button on this page.
  2. Open your n8n editor and click “Import from File”.
  3. Select the saved workflow file to load it.

Step 2: Add your credentials

  1. Go to Credentials and add your YouTube OAuth2 API Key.
  2. Add your Google Gemini (PaLM) API Key.

Step 3: Update video ID

  1. Find the Set Video ID node.
  2. Replace the example video ID with the video you want chapters for.

Step 4: Test the workflow

  1. Click the Manual Trigger node When clicking ‘Test workflow’.
  2. Make sure it runs without error and creates chapter timestamps.

Step 5: Activate for production

  1. Switch the workflow toggle ON in n8n to enable scheduled or webhook triggers.
  2. 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.


Automate YouTube chapters with n8n and Google Gemini

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

It uses the YouTube Data API to list caption tracks, then downloads captions in SRT format using authenticated HTTP requests.
This means the OAuth2 credentials are invalid or expired. Reauthorize the YouTube OAuth2 credentials in n8n credentials settings.
No, the workflow relies on captions to analyze transcript text. Videos need captions uploaded or auto-subtitles enabled.
Google Gemini’s AI reads the transcript text to find logical chapter points and generates human-readable chapter names with timestamps.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.