Skip to main content

One Cut - Edit Video by Editing Code

One Cut will transcribe your video using fast-whisper and generate Python code like example.py. The code contains all the subtitles from ASR and allows you to modify the video by changing the code.

Run onecut to transcribe your video:

uvx onecut path/to/your/video.mp4

The OneCut CLI will generate code like this. You can easily fix ASR errors by changing the text.

movie = Movie("a.txt", [])
SUB_1 = sub("Sub1", 0, 1)
SUB_2 = sub("Sub2", 1, 2)
SUB_3 = sub("Sub3", 2, 3)

FINAL_CLIPS = [SUB_1.to(SUB_3)]

You can cut one section of your video (like SUB_2) by doing this.

FINAL_CLIPS = [SUB_1, SUB_3]

Or use the helper function to cut it, the function is super useful if you only want to remove a small portion of clips.

FINAL_CLIPS = remove_subs(movie.all_subtitles, [SUB_2])

After finishing cutting & fixing, just run python {generated_file}.py to generate the final video and subtitle(.srt) file.

Dependencies

  1. Python 3
  2. FFmpeg

The generated file is self-contained. It does not depend on the onecut package. The only dependency is ffmpeg.

Why?

I want to share some of my videos but the only computer I have is a Steamdeak. Running any modern video editors will kill my Steamdeak and it's super laggy as well. There are some online services like the Descript but I don't want to upload the video over my slow internet and pay $12 per month.

Also, the coding agent is very good at spotting ASR errors and I want to generate something for them to work on. All the existing tools are based on text but I think using code as intermediate representation is much better for coding agents.

Agent Edit

Most of the time, I just ask the agent to fix the ASR errors in generated.py and it will think for a long time and fix most of the ASR issues. You can ask the agent to do additional things like:

  1. Burn-in the subtitles.
  2. Remove part of video.
  3. Only export part of the video.

Basically, the agents can do anything supported by the FFmpeg filter.

Using Deepseek-V4 Flash, fixing all the ASR errors costs about $0.1 in API pricing.

Future Plans

  1. Support Word Level Editing: I don't know what's the best way to support that since I don't want to put a lot of timestamps in the code.
  2. Bugfix

LLM Usage

This project is written in the old-fashioned way. LLM is used for data collection and some debugging.

Metadata

Release files for onecut 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 onecut 0.2.1
File Size Uploaded Provenance Actions
onecut-0.2.1.tar.gz 4.4 kB Without provenance Details for onecut-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 10.3 kB

Release files / onecut-0.2.1.tar.gz

Download URL onecut-0.2.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bb1b6105c9d3a9b5a48d6414c81c7f6fc3d7a3f55b48dcdc94e7e5d6f39a7014
BLAKE2b-256 checksum
How to use checksums
f2e1f5037b3ad94c23231a28d294fc2836ee557714529b0484a456c4e885cf76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":"20250504.0.344409","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL onecut-0.2.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5b0f42f4809b27ff9acd2e76e50fea562c1196410082d1ff7ec883c674fa1c7
BLAKE2b-256 checksum
How to use checksums
94e46a30f46dc2a322f3a8a6139c9d52dcbaf6e4e1dde5c2047bb2c45c52ced2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":"20250504.0.344409","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for onecut 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.

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