Skip to main content

rewatch

You give rewatch a long video, it gives you short clips with captions. Everything runs on your own laptop. No API keys, no uploading your videos anywhere, no paying per clip.

I'm building this from scratch to learn, so it's still early. This is v0.2.0.

What it can do right now

It finds the good moments in a long video by itself. Every moment becomes its own clip, under a minute, with captions already on it.

rewatch auto episode.mp4

I tried it on a 2 hr 12 min podcast and got 7 clips. The moments it picked were actually nice, I'd say it's about 80% there.

You can still cut a clip by hand, or put captions on a clip you already have.

How it picks the moments (for now)

There's no AI chatbot in here. For now it's just rules I wrote, and I kept tweaking them by watching what came out:

  1. Check how loud every second is, and how fast people are talking.
  2. Slide a 30 second window over the whole video and score each one.
  3. Keep the top 10 windows that don't overlap.
  4. Move the edges so the clip starts where a sentence starts and ends where one ends. Clips starting in the middle of a word look bad.
  5. If someone asked a question right before the moment, start the clip from the question. I added this because it kept cutting off the host's question and only showing the answer lol.
  6. Merge clips that overlap, and if one goes over 60 seconds, cut it back to the last full sentence.

These rules are only the starting point.

What's next

I want to train a model on what people actually rewatch on YouTube, using the "Most Replayed" graph. Then I can check if it does better than these rules, and better than just asking a chatbot.

After that: a vertical crop that follows whoever is talking, and proper Hindi and Telugu captions. The tiny Whisper model I'm using messes up Hinglish a lot right now.

Before you install

You need Python 3.11 or newer, and FFmpeg.

On a Mac, the normal brew install ffmpeg can't draw captions because it doesn't come with a library called libass (took me a while to figure this out). Install ffmpeg-full instead:

brew install ffmpeg-full
brew unlink ffmpeg
brew link --force ffmpeg-full

To check, run ffmpeg -hide_banner -filters | grep subtitles. If nothing prints, captions won't work.

Install

pip install rewatchx

It's rewatchx because someone already took rewatch on PyPI. The command is still just rewatch.

Or from source:

git clone https://github.com/shaikashfaaqhamja/rewatch.git
cd rewatch
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

How to use it

Let it find the moments and make the clips:

rewatch auto episode.mp4

Clips go into a folder called clips. If you want a different folder:

rewatch auto episode.mp4 --out-dir my_clips

You get 3 files for every moment: clip_1.mp4 is the plain cut, clip_1.srt has the captions, and clip_1_burned.mp4 is the one with captions on it (the one you'd actually post).

Cut 30 seconds yourself, starting at 1:30:

rewatch cut episode.mp4 90 120 clip.mp4

Put captions on a clip:

rewatch captions clip.mp4 clip_captioned.mp4

The first run downloads the Whisper model, so give it a minute. auto on a long video takes a few minutes because it has to listen to the whole thing.

What happens inside

FFmpeg cuts the clip and turns it into H.264 video with AAC audio, because that plays everywhere. faster-whisper listens to the video and gives back every word with the exact time it was said. In auto, it listens to the full video only once, and each clip reuses those words with the times shifted so they start from zero. I group the words into lines of up to 5 words, and a line also ends wherever a sentence ends. The lines go into an SRT file and FFmpeg draws them onto the video.

License

MIT, use it however you want. See LICENSE.

Metadata

Release files for rewatchx 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rewatchx 0.2.1
File Size Uploaded Provenance Actions
rewatchx-0.2.1.tar.gz 9.4 kB Without provenance Details for rewatchx-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rewatchx 0.2.1
File Interpreter ABI Platform Actions
rewatchx-0.2.1-py3-none-any.whl Python 3 none any Details for rewatchx-0.2.1-py3-none-any.whl

Total release size: 18.7 kB

Release files / rewatchx-0.2.1.tar.gz

Download URL rewatchx-0.2.1.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9e9b555efd56f09957a0844fd50f2faff503ca829694efd97a5b1537ba523f83
BLAKE2b-256 checksum
How to use checksums
f01c4288212faeadc0e074576f5018537181bbd7f79fe1acba19826bb3570e15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / rewatchx-0.2.1-py3-none-any.whl

Download URL rewatchx-0.2.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
709eb07751e44983118cb3d8263e6782eaf16b02c064ef23190aace1a3d973b1
BLAKE2b-256 checksum
How to use checksums
a072ff0a6d7d45f10873cb63955d340248d308a7474150e637cab366d73eb7f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for rewatchx 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page