Comment keyword CHAT

CHAT: find a stream's best moments from chat spikes and cut them into vertical clips

When something big happens on stream, chat explodes. This one-file script finds those spikes and turns each one into a vertical 9:16 clip that starts 20 seconds early, so you catch the build-up.

Updated Nov 15, 2026 · Creator Autopilot

Affiliate disclosure: this page contains affiliate links. If you sign up for a paid plan through them, we earn a commission.

Only clip streamers who allow it. Ask first, or check the streamer's rules on clips and reuploads.

On your phone? This runs on a computer. Open this page on your laptop or desktop.

What it does

  • Counts chat messages in every 10-second window of a Twitch stream.
  • Finds the top 5 spikes (you can pick how many), skipping any that overlap.
  • Cuts a vertical 9:16 clip for each spike, starting 20 seconds before it, 45 seconds long. The center of the video is cropped to fill the frame.
  • Saves the clips in one folder, named by rank and time, plus spikes.txt: the time, the message count and the top words in chat for each spike.

Option A: download the script

Download chat_clips.py

One Python file, 11 KB. It uses only Python's standard library plus ffmpeg, so there's nothing else to install. It reads your two files and writes clips to a folder. It doesn't go online.

Option B: have Claude build it

This is the exact prompt we gave Claude. Fable 5.2 wrote the script above in about 3 minutes, and we didn't change anything.

Prompt · Chat clip finder
Build me a one-command tool that finds the best clips in a Twitch stream by looking at chat.

Input: the chat file (JSON) I download with TwitchDownloader, and the stream video file.
1. Count chat messages in every 10-second window.
2. Find the top N spikes (default 5) — the moments chat explodes. Don't pick spikes that overlap each other.
3. For each spike, cut a vertical 9:16 clip that starts 20 seconds before the spike (default length 45 seconds) with ffmpeg. Crop the center of the video to fill the vertical frame.
4. Save all clips in one folder, named by rank and timestamp, plus a small text file listing each spike (time, message count, top words in chat).

Make it a single Python file I can run with one command, like:
python chat_clips.py chat.json stream.mp4
Only use Python's standard library + ffmpeg (no extra installs). Print a short summary at the end.

Claude may write a slightly different script each time. The steps below are for our file.

How to run it, step by step

Everything below is free and works on Windows or Mac. You only do steps 1 to 3 once. Never used a terminal? It's a window where you paste a command and press Enter. Every grey box below has a Copy button.

1. Install Python

  • Go to python.org/downloads and download the installer for your computer.
  • Windows: on the first installer screen, tick "Add python.exe to PATH" before you click Install. If you skip this box, the commands below won't work.
  • Mac: open the downloaded file and click through the installer.

To check it worked, open a new terminal (Windows: Start menu, type PowerShell. Mac: press Cmd + Space, type Terminal) and paste:

Check Python · Windows
python --version
Check Python · Mac
python3 --version

You should see a version number like Python 3.x.x. On a Mac, always type python3 where this guide says python.

2. Install ffmpeg

ffmpeg is the free video tool that cuts the clips. Paste one line into the terminal:

Install ffmpeg · Windows
winget install Gyan.FFmpeg
Install ffmpeg · Mac (needs Homebrew)
brew install ffmpeg

Windows: if it asks you to agree to the source terms, type Y and press Enter. Mac: if brew isn't found, install Homebrew first from brew.sh. Then close the terminal, open a new one and check with ffmpeg -version.

3. Make a folder with two files

  • Make a new folder on your Desktop, for example chatclips.
  • Put chat_clips.py in it (the download button above).
  • Get TwitchDownloaderCLI: open the TwitchDownloader releases page (free, open source), find the newest release and download the CLI zip for your computer: Windows, or macOS (Arm64 for M1 to M4 Macs, x64 for Intel Macs). Unzip it and move TwitchDownloaderCLI into the same folder.

4. Open the terminal inside that folder

  • Windows: open the folder, right-click an empty spot and choose Open in Terminal.
  • Mac: open Terminal, type cd and a space, drag the folder into the window, then press Enter. The first time, also run the line below so your Mac lets the downloader start. If macOS still blocks it, go to System Settings → Privacy & Security and click Open Anyway.
Mac only, once
chmod +x TwitchDownloaderCLI

Type dir (Windows) or ls (Mac) and press Enter. You should see both files.

5. Download the stream's chat and video

On Twitch, open the streamer's Videos page, pick a past broadcast and copy its link. In the commands below, replace https://twitch.tv/videos/1234567890 with your link.

Windows
.\TwitchDownloaderCLI.exe chatdownload --id https://twitch.tv/videos/1234567890 -o chat.json
.\TwitchDownloaderCLI.exe videodownload --id https://twitch.tv/videos/1234567890 -o stream.mp4
Mac
./TwitchDownloaderCLI chatdownload --id https://twitch.tv/videos/1234567890 -o chat.json
./TwitchDownloaderCLI videodownload --id https://twitch.tv/videos/1234567890 -o stream.mp4

The chat takes a minute or two. The video is the whole broadcast, so a long stream can be several GB and take a while. For your first try, pick a shorter one. Subscriber-only or expired videos can't be downloaded.

6. Run the clip finder

Run it
python chat_clips.py chat.json stream.mp4

You get a folder named stream_clips with the vertical clips and spikes.txt. (Mac: python3 instead of python.)

Want more clips, longer clips or a different folder? Add options:

With options
python chat_clips.py chat.json stream.mp4 -n 8 --length 60 -o my_clips

-n = number of clips, --length = seconds per clip, -o = output folder. Add --dry-run to see the spikes without cutting anything. If you trimmed the start of the video, use --chat-offset (for example -600 for 10 minutes) so the chat times line up.

If something goes wrong

  • "python is not recognized", or the Microsoft Store opens: Python isn't on PATH. Run the installer again, tick "Add python.exe to PATH", then open a new terminal.
  • "ffmpeg not found on PATH": close the terminal and open a new one. Still there? Repeat step 2.
  • "chat file not found" or "video file not found": the terminal isn't in your folder, or the file names are different. Redo step 4 and check the names with dir or ls.
  • "chat file has no 'comments' list": the chat was saved in another format. Download it again with -o chat.json.
  • "no chat spikes fall inside the video": the video and chat don't match. Download both from the same link, or see --chat-offset above.
  • Anything else: paste the exact error and the command you ran into Claude. It can usually tell you what to fix.

How we tested it

  • We ran it once on our own 10-minute sample: a test video with a big clock on screen and 996 made-up chat messages in TwitchDownloader's JSON format.
  • It cut 5 vertical clips (1080 × 1920, 45 seconds each) in 47 seconds.
  • The 3 chat explosions we planted came out as #1 to #3, in the right order. Each clip started exactly 20 seconds before its spike: the 5:40 spike's clip opens at 5:20 on the clock.
  • We haven't tested it on a real Twitch stream yet, so on a real stream the results may differ. If your stream has fewer than 5 big spikes, the last clips may just be ordinary moments.

Next step: captions, or no code at all (OpusClip)

  • After the script: the clips come out with no captions. Add them in any editor, or try OpenShorts, the one in the Reel (open source, free if you run it yourself). OpusClip is another option: it adds captions and reframes clips for vertical video.
  • If you'd rather not run code: OpusClip clips long videos in your browser, with no code.
  • What it costs (official pricing page, checked Nov 2026): the Free plan gives 60 minutes of video a month, with a watermark, and clips expire after 3 days. Starter is $15 a month for 150 minutes; Pro is $29 a month for 300 minutes. Twitch links work on Pro only; on Free, upload the video file instead.
  • Same rule here: only clip streamers who allow it.

No coding? Paste a past stream's link into OpusClip (or upload the video file on the Free plan), and it cuts vertical clips with captions for you.

Try OpusClip free → Affiliate link

Full breakdown of plans and credits: OpusClip free plan limits and pricing.

More GTA 6: clip GTA 6 streams with Claude Code (free clipper + GTA plugin).

Made for our Instagram Reel. More Claude experiments every week: @theoautomates

More Claude skills

PLANPLAN: make Claude plan your whole month of Instagram (Content Globe Planner + Metricool)One prompt builds a planner inside Claude. It reads your real Instagram numbers through Metricool, spins ideas on a globe, and drops a post on each day of your calendar.NIGHTNIGHT: let Claude clip your videos while you sleep. The setup + 3 promptsConnect one connector, send one prompt, and Claude has OpusClip find the best moments in your 1-hour video and turn them into vertical, captioned clips. Here's the setup, the 3 prompts, what each side needs, and a free way to start without the connector.TESTTEST: Instagram trial reels: test every reel on strangers first (and schedule them from Claude with Metricool)Your followers are the reason your reels flop. Trial reels show your reel to people who don't follow you first. Here's who gets them, where the button is, and how to schedule them from Claude on Metricool's free plan.TRIMTRIM: edit your videos with Claude. The 4-step setup + 3 promptsMake three folders, install four free tools with one prompt, show Claude a few reels you love, then drop in your clips and approve the plan before it renders. Here's the 4-step setup, the 3 prompts to copy, and a no-install option if you'd rather do it in your browser.CLASSCLASS: turn a 1-hour video into 5 clips. 3 prompts + the free toolYour 1-hour Zoom call, class or webinar has a few minutes that matter. Here are the 3 one-line prompts that pick just those moments, the free tool that cuts them into short captioned clips, and the 3 steps.TAGSTAGS: posts with hashtags got 31% fewer views. The 3-step checkA study of 24 million Instagram posts found that posts with at least one hashtag got 31% fewer views than average. Here's what the study really says, and the 3-step check: cut to 1–2 hashtags, rewrite your caption with search words, then compare views on your own posts for free.

See all skills →