Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

All notable changes to `facut` are documented here.

## 0.2.0 — 2026-07-31

### Added

- Independent audio tracks for background music and sound effects.
- Audio gain, fade-in, fade-out, delayed placement, and source looping.
- Mixing of independent audio tracks with the original camera audio.
- SRT and VTT import, export, timing shift, listing, and removal.
- Styled text overlays with position, color, outline, and background controls.
- Automatic ASS compilation and subtitle/text burn-in during preview and render.
- Encoding fallback for UTF-8, UTF-16, and GB18030 subtitle files.

### Changed

- Narrow-terminal CLI help tests now use a deterministic terminal width.
- The render graph accepts an optional generated subtitle file.
- Project Schema includes audio-loop, subtitle, and text-overlay data.

### Verified

- Real FFmpeg rendering with transitions, native audio, looped music, text, and
subtitle burn-in.
- Windows, Linux, Python 3.11, and Python 3.13 remain covered by CI.

## 0.1.0 — 2026-07-28

- Initial installable CLI and Windows single-file executable.
- Project creation, media import and inspection, stable media IDs, and schema
validation.
- Non-destructive timeline editing with split, trim, move, delete, ripple
delete, undo, redo, and atomic JSON batches.
- Dissolve, fade-black, fade-white, slide, wipe, zoom, and blur transitions.
- Range preview and H.264/AAC final rendering through FFmpeg.
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

**facut**(Fast AI Cut)是一款面向 AI Agent、自动化脚本与高级用户的非破坏性命令行视频编辑器。它使用稳定素材 ID、结构化工程、可组合子命令及统一 JSON 返回值,让复杂剪辑既能由人操作,也能可靠地被程序调用。

当前版本 `0.1.0` 是首个可用版本:工程、素材探测、单视频轨时间线、帧级时间表示、原子批处理、基础转场、快速预览、H.264/AAC 渲染和撤销/重做均可实际执行。Windows 单文件发行版内置 FFmpeg/FFprobe,不依赖系统 Python。
当前开发版本 `0.2.0` 已形成完整的基础制作链路:工程、素材探测、单视频轨时间线、帧级时间表示、原子批处理、基础转场、快速预览、H.264/AAC 渲染、撤销/重做、独立背景音乐、原声混合、字幕和文字烧录均可实际执行。Windows 单文件发行版内置 FFmpeg/FFprobe,不依赖系统 Python。

## 安装

Expand Down Expand Up @@ -41,7 +41,8 @@ facut doctor

```text
facut init/import/inspect
facut timeline/clip/transition
facut timeline/clip/transition/audio
facut subtitle/text
facut preview/render
facut project/history
facut undo/redo/run/doctor
Expand Down Expand Up @@ -154,11 +155,38 @@ facut --project demo run ai-edit-plan.json --json
facut --project demo render --preset youtube-1080p --output result.mp4
```

字幕与文字:

```bash
facut --project demo timeline track add --type subtitle --name S1
facut --project demo subtitle import captions.srt --track S1
facut --project demo subtitle shift S1 --offset +500ms
facut --project demo subtitle export S1 --format vtt --output captions.vtt
facut --project demo text add --text "临港两日" --at 1s --duration 3s --y 20%
facut --project demo subtitle compile-ass --output render-text.ass
facut --project demo render --output subtitled.mp4
```

渲染和预览会自动将工程中的字幕与文字编译为临时 ASS 并烧录。`compile-ass` 仍可生成独立、可检查的 ASS 侧车文件。

背景音乐与原声混合:

```bash
facut --project demo import music.mp3
facut --project demo timeline track add --type audio --name A1
facut --project demo audio add <MUSIC_ID> --track A1 --at 0 --loop --volume-db -12 --fade-in 1s --fade-out 2s
facut --project demo render --output mixed.mp4
```

独立音频轨会与视频素材自带的相机原声混合;`--loop` 默认循环到视频时间线末尾,也可配合 `--duration` 指定长度。

### 当前明确限制

- 渲染器当前支持一个启用的视频/图片轨;多视频轨叠加不会伪造成功,而会明确返回 `NOT_IMPLEMENTED`。
- 首版最终编码为 H.264/AAC;H.265、AV1、ProRes 等已保留后端扩展边界,但尚未开放。
- 背景音乐专用音轨、字幕烧录、文字、关键帧 CLI、高级分析和自动剪辑属于后续版本。
- 音频首版支持独立轨混音、增益、淡入淡出和循环;自动闪避、降噪与响度标准化尚未开放。
- 字幕/文字支持工程编辑、SRT/VTT 往返、ASS 编译,并会自动烧录到预览和最终视频。
- 关键帧 CLI、高级分析和自动剪辑属于后续版本。
- `fade-in`/`fade-out` 已注册,首版成对片段间的稳定转场重点为 `dissolve`、`fade-black`、`fade-white`、`slide`、`wipe`、`zoom`、`blur`。

## 开发与测试
Expand All @@ -180,6 +208,7 @@ src/facut/
├── render/ 滤镜图、缓存、硬件和 FFmpeg 后端
├── transitions/ 插件式转场
├── effects/ 插件式视频/音频效果
├── subtitles/ SRT/VTT 解析、编辑与 ASS 编译
├── config.py 跨平台配置
├── exceptions.py 领域错误和稳定退出码
├── logging_config.py 轮转日志
Expand Down
7 changes: 7 additions & 0 deletions examples/demo.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
1
00:00:01,200 --> 00:00:02,400
Hello from facut

2
00:00:02,600 --> 00:00:03,500
Background music + subtitles
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "facut"
version = "0.1.0"
version = "0.2.0"
description = "Fast AI Cut — a deterministic, agent-friendly command-line video editor"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion src/facut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__all__ = ["__version__"]

__version__ = "0.1.0"
__version__ = "0.2.0"
87 changes: 87 additions & 0 deletions src/facut/cli/audio_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""Independent audio-track editing commands."""

from __future__ import annotations

from typing import Annotated

import typer

from facut.cli.timeline_commands import _execute


audio_app = typer.Typer(
help="Add and shape independent music or sound-effect tracks."
)


@audio_app.command("add")
def audio_add(
ctx: typer.Context,
media_id: Annotated[str, typer.Argument()],
track: Annotated[str, typer.Option("--track")],
at: Annotated[str, typer.Option("--at")] = "0",
source_in: Annotated[str, typer.Option("--in")] = "0",
source_out: Annotated[str | None, typer.Option("--out")] = None,
volume_db: Annotated[float, typer.Option("--volume-db")] = 0.0,
fade_in: Annotated[str, typer.Option("--fade-in")] = "0",
fade_out: Annotated[str, typer.Option("--fade-out")] = "0",
loop: Annotated[
bool,
typer.Option(
"--loop",
help="Repeat the selected source range; defaults to covering the video timeline.",
),
] = False,
duration: Annotated[
str | None,
typer.Option("--duration", help="Explicit looped timeline duration."),
] = None,
dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
) -> None:
"""Place music or a sound effect on an audio track."""

params = {
"media_id": media_id,
"track": track,
"at": at,
"in": source_in,
"volume_db": volume_db,
"fade_in": fade_in,
"fade_out": fade_out,
"loop": loop,
}
if source_out is not None:
params["out"] = source_out
if duration is not None:
params["duration"] = duration
_execute(ctx, "audio.add", params, dry_run)


@audio_app.command("volume")
def audio_volume(
ctx: typer.Context,
clip_id: Annotated[str, typer.Argument()],
db: Annotated[float, typer.Option("--db")],
dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
) -> None:
"""Set gain for an independent audio clip in decibels."""

_execute(ctx, "audio.volume", {"clip_id": clip_id, "db": db}, dry_run)


@audio_app.command("fade")
def audio_fade(
ctx: typer.Context,
clip_id: Annotated[str, typer.Argument()],
fade_in: Annotated[str | None, typer.Option("--in")] = None,
fade_out: Annotated[str | None, typer.Option("--out")] = None,
dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
) -> None:
"""Apply a fade-in, fade-out, or both."""

params = {"clip_id": clip_id}
if fade_in is not None:
params["fade_in"] = fade_in
if fade_out is not None:
params["fade_out"] = fade_out
_execute(ctx, "audio.fade", params, dry_run)
5 changes: 5 additions & 0 deletions src/facut/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def main() -> None:
transition_app,
)
from facut.cli.render_commands import preview_app, render_command # noqa: E402
from facut.cli.audio_commands import audio_app # noqa: E402
from facut.cli.subtitle_commands import subtitle_app, text_app # noqa: E402

app.command("init")(init_command)
app.command("import")(import_command)
Expand All @@ -200,6 +202,9 @@ def main() -> None:
app.add_typer(clip_app, name="clip")
app.add_typer(transition_app, name="transition")
app.add_typer(preview_app, name="preview")
app.add_typer(audio_app, name="audio")
app.add_typer(subtitle_app, name="subtitle")
app.add_typer(text_app, name="text")
app.command("render")(render_command)


Expand Down
Loading
Loading