One Cut – Edit Video by Editing Code

smy200111 pts0 comments

GitHub - smy20011/onecut · GitHub

/" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

smy20011

onecut

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>11 Commits<br>11 Commits

src/onecut

src/onecut

tests

tests

.gitignore

.gitignore

.python-version

.python-version

README.md

README.md

pyproject.toml

pyproject.toml

uv.lock

uv.lock

View all files

Repository files navigation

One Cut - Edit Video by Editing Code

One Cut will transcribe your video using fast-whisper and<br>generate Python code like example.py.<br>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@latest 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", [])<br>SUB_1 = sub("Sub1", 0, 1)<br>SUB_2 = sub("Sub2", 1, 2)<br>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

Python 3

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<br>kill my Steamdeak and it's super laggy as well. There are some online services like the Descript<br>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<br>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<br>ASR issues. You can ask the agent to do additional things like:

Burn-in the subtitles.

Remove part of video.

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

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.

Bugfix

LLM Usage

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

About<br>No description, website, or topics provided.<br>Resources<br>Readme<br>Activity<br>Stars<br>0 stars<br>Watchers<br>0 watching<br>Forks<br>0 forks<br>Report repository

Releases

Packages

Contributors

Languages

You can’t perform that action at this time.

video code onecut python like want

Related Articles