Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.1 instead.
Reason given by maintainers: Broken CLI (IndentationError). Use 0.2.1 instead.

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.0

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.0
File Size Uploaded Provenance Actions
rewatchx-0.2.0.tar.gz 9.4 kB Without provenance Details for rewatchx-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 18.7 kB

Release files / rewatchx-0.2.0.tar.gz

Download URL rewatchx-0.2.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
295b53e34ffc19a35a872590fbf3d8606d89f27db5babc5aaeb336117e952b1c
BLAKE2b-256 checksum
How to use checksums
c09683a78cd4c8b2eed80b8719a3adc7392b51c562f9427b52db3ab0e2dac550
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.0-py3-none-any.whl

Download URL rewatchx-0.2.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96130c81564c854d0db7a0b4aeff35ad5bf9d0f986e71970c0640f4911be4544
BLAKE2b-256 checksum
How to use checksums
7a3f5f190c37332ec2a8f6a909f24b4733bb3a063c4e8e8288b157ab0d17dde2
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.0

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.0 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