Code-Only Video Editing: How AI Edited a 4K Promo Without Any Editing Software
This article walks through a code-only approach to editing a 4K promo, where an AI completed the edit without opening any graphical editing software. It explains how the original S-Log3 footage was transcribed with word-level timestamps, how editing decisions were written into auditable JSON files, and how rendering was driven from those files. The piece also covers the resulting roughly 2-minute-50-second rough cut and offers reusable practices for decision and execution separation, natural pause-based cuts, exception rules, decision logs, and layer decoupling, including a cloud-oriented pattern for turning a one-off script into a repeatable pipeline.
1. Why Code-Only Video Editing Is Worth Discussing
Traditional video post-production relies heavily on graphical editing software. The workflow accumulates a large amount of tacit experience: reviewing footage, noting timecodes, and judging which take “feels more natural” by intuition. The problem with this approach is that decisions are not traceable, are hard to reuse, and cannot converge reliably across many clips and scenarios.
A recent practice offers a different answer: a user of an AI coding tool described the requirements in natural language, and the AI edited a 4K promo without opening any editing software. The source material consisted of 17 clips, about 25GB in S-Log3 original format, covering four scenes—opening introduction, thinking partner, goals and validation, and ambitious vision. The final output was a rough cut of about 2 minutes and 50 seconds. The core idea was to break editing down into a computable data problem.
2. Overall Architecture: Four Automatable Stages
- Footage understanding and transcription: generate word-level timestamps for each clip;
- Decision generation: select the best clip and in/out points for each scene and output a structured decision file;
- Rendering execution: automatically cut and concatenate clips based on the decision file;
- Validation and convergence: cross-check the basis for decisions to ensure repeatability and auditability.
The key to this architecture is the separation of decision and execution: the decision layer only produces data, and the execution layer only consumes data. This makes the whole process testable and rollback-able.
3. Stage One: One Prompt Defines All Constraints
The startup prompt does not describe interface operations; it describes the goal and constraints, for example:
Transcribe audio from all video files in the directory;select the best takes for each scene and concatenate them into the final video;provide multiple alternatives per scene; generally, later-shot takes with fewer filler words are better, but this is not absolute;the last scene is a reshoot; remove the warm-up lines at the beginning;output a JSON decision file recording scene, footage, in point, and out point;then call the command-line media tool to generate the final video;do not interrupt before the final video is produced.
The engineering implications are threefold. First, the goal is verifiable (a final video file exists). Second, the constraints are encodable (number of filler words, pause positions, shooting order). Third, the output is structured (JSON), making later auditing easier.
4. Stage Two: Word-Level Timestamps Are the Foundation of Automated Editing
The prerequisite for automated editing is that machines can “understand” the footage. By running a speech recognition model on local compute and transcribing the 17 clips word by word with millisecond-level start and end times, the machine gains the ability to locate positions.
The following is an illustrative data structure:
{"file": "scene1_take03","words": [{"text": "we", "start": 1.240, "end": 1.410},{"text": "build", "start": 1.430, "end": 1.980}]}
With word-level timestamps, “filler word counting,” “natural pause detection,” and “whether the ending is clean” all become computable metrics rather than subjective judgments. In practice, even if a person’s name is recognized as a near-homophone, the clip-selection logic still holds as long as the timeline has not drifted—this indicates that the approach is somewhat robust to recognition errors.
5. Stage Three: Writing “Take Selection” as an Auditable Decision File
Multiple sub-agents process scenes in parallel, and a separate verification role cross-checks the results. The final output is a decision file:
{"scene": 1,"candidates": ["C003", "C017"],"selected": "C003","in": 12.480,"out": 78.260,"reason": "zero filler words, clean ending; C017 was excluded due to a 5.8-second pause in the middle"}
The value lies in the fact that every edit point falls on a natural pause, avoiding mid-sentence cuts; every choice has a written basis; and the overall number of retained filler words converges to zero. Compared with “going by feel,” this set of files makes the editing result reviewable and iterable.
6. Stage Four: Rendering Execution and Quality Convergence
The execution layer cuts each segment according to the in/out points and then concatenates them sequentially into a rough cut. This stage relies only on command-line media processing capabilities and the decision file and requires no graphical interface. The original footage remains in S-Log3 flat profile and has not been color-graded, but a structurally complete rough cut is already usable.
To engineering-grade this in a cloud environment such as Baidu AI Cloud, a combination of general capabilities can be used: object storage to hold 25GB-scale footage, message queues to trigger transcription and rendering tasks, container platforms to elastically schedule compute, and logging and monitoring services with alerts to track failed retries—turning a one-off script into a reusable pipeline.
7. Reusable Best Practices
- Separate decision from execution, and make intermediate artifacts structured data;
- Bind all edit points to natural pauses to reduce audible breaks;
- Set overridable exception rules for heuristics such as “the best take is usually the later one”;
- Keep complete decision logs to support manual spot checks and secondary modifications;
- Decouple transcription, take selection, and rendering into layers, so any one layer can be replaced independently.
8. Conclusion
The essence of this practice is not to replace video editors but to shift editing from “operating software” to “describing intent, generating data, and executing automatically.” When selection criteria can be quantified, recorded, and rerun, the stability and scalability of content production improve significantly, and this also provides a replicable engineering pattern for processing footage at scale.
