Metadata-Version: 2.5
Name: vicecut
Version: 0.1.0
Summary: Self-hosted tool for the Vietnamese market: finds GTA 6 moments from Vietnamese YouTube livestreams, renders 9:16 captioned clips and can publish them to TikTok.
Project-URL: Homepage, https://github.com/khangbuiquoc203/vicecut
Project-URL: Documentation, https://github.com/khangbuiquoc203/vicecut/tree/main/docs
Project-URL: Issues, https://github.com/khangbuiquoc203/vicecut/issues
Project-URL: Changelog, https://github.com/khangbuiquoc203/vicecut/blob/main/CHANGELOG.md
Author-email: "Khang Q. Bui" <khangbuiquoc203@gmail.com>
License: MIT
License-File: LICENSE
License-File: NOTICE.md
Keywords: clips,gta6,self-hosted,tiktok,vietnamese,youtube
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Video
Requires-Python: >=3.12
Requires-Dist: av<16,>=15
Requires-Dist: chat-downloader>=0.2.8
Requires-Dist: cryptography>=42
Requires-Dist: fastapi>=0.115
Requires-Dist: faster-whisper>=1.0.3
Requires-Dist: numpy>=1.26
Requires-Dist: opencv-python-headless<5,>=4.9
Requires-Dist: playwright>=1.45
Requires-Dist: pydantic>=2.6
Requires-Dist: pyvi>=0.1.1
Requires-Dist: uvicorn>=0.30
Requires-Dist: yt-dlp-ejs>=0.8
Requires-Dist: yt-dlp>=2026.11.23
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: hypothesis>=6.100; extra == 'dev'
Requires-Dist: import-linter>=2.1; extra == 'dev'
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pip-audit>=2.7; extra == 'dev'
Requires-Dist: pip-licenses>=5; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: gpu
Requires-Dist: nvidia-cublas-cu12; extra == 'gpu'
Requires-Dist: nvidia-cudnn-cu12<10,>=9; extra == 'gpu'
Provides-Extra: quality
Requires-Dist: demucs>=4.0.1; extra == 'quality'
Requires-Dist: torch>=2.4; extra == 'quality'
Requires-Dist: torchaudio>=2.4; extra == 'quality'
Description-Content-Type: text/markdown

<p align="center">
  <img src="docs/brand/logo-readme.png" alt="ViceCut logo: a palm tree and a Vietnamese conical hat in front of a Vice City sunset" width="280">
</p>

<h1 align="center">ViceCut</h1>

<p align="center">
  <strong>GTA VI moments, found by AI, cut into 9:16 clips with Vietnamese subtitles.</strong><br>
  Self-hosted, open source, no telemetry. Review every clip in a web studio before it goes anywhere.
</p>

<p align="center">
  <a href="https://github.com/khangbuiquoc203/vicecut/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/khangbuiquoc203/vicecut/actions/workflows/ci.yml/badge.svg?branch=main"></a>
  <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
  <img alt="Python 3.12 | 3.13" src="https://img.shields.io/badge/python-3.12%20%7C%203.13-3776AB.svg?logo=python&logoColor=white">
  <img alt="Windows, macOS, Linux" src="https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-555.svg">
  <a href="#docker-3-commands"><img alt="Docker" src="https://img.shields.io/badge/docker-compose-2496ED.svg?logo=docker&logoColor=white"></a>
</p>

<p align="center">
  <a href="#quick-start">Quick start</a> ·
  <a href="#see-it-in-action">Demo</a> ·
  <a href="docs/getting-started.md">Getting started</a> ·
  <a href="docs/configuration.md">Configuration</a> ·
  <a href="README.vi.md">Tiếng Việt</a>
</p>

---

ViceCut watches the Vietnamese GTA 6 (GTA VI) scene for you. It finds the moments worth sharing in the
finished live streams and uploads of the channels you follow, cuts them into vertical clips with
word-by-word Vietnamese subtitles and a meme-style hook, and queues them for TikTok once you approve them.
Everything runs on your own machine with local AI models. The name nods at Vice City.

## See it in action

<p align="center">
  <img src="docs/images/review.gif" alt="Reviewing a clip in ViceCut Studio: read the post as it will go out, edit the caption, approve, go to the next clip" width="800">
</p>
<p align="center"><em>Review a clip: see the exact post, edit it, approve, move on to the next one.</em></p>

<p align="center">
  <img src="docs/images/scan.gif" alt="Scanning a YouTube video in ViceCut Studio and following every stage on the Jobs page" width="800">
</p>
<p align="center"><em>Paste a YouTube link and follow the scan stage by stage, from the first signal to the rendered clips.</em></p>

<p align="center">
  <img src="docs/images/keyboard.gif" alt="ViceCut Studio from the keyboard: the command palette, the clip table, a clip played with J, K and L, N for the next clip, A to approve, and the shortcut list" width="800">
</p>
<p align="center"><em>Keyboard first: Ctrl/Cmd+K to jump anywhere, J/K/L to scrub, N for the next clip, A to approve, ? for every shortcut.</em></p>

> Every screenshot and recording here comes from the built-in demo mode (`vicecut serve --demo`): invented
> streamers and clips, demo videos drawn by ffmpeg (no game footage), no real service called. The web UI is in English; everything the
> audience sees (hooks, subtitles, captions, hashtags) is in Vietnamese.

## What it does

- 🔎 **Finds Vietnamese GTA 6 videos:** the finished live streams and uploads of the channels you follow, plus
  (optional) a YouTube search for this week's Vietnamese GTA 6 / GTA VI videos on the **Discover** page. A
  video that is not in Vietnamese, or not about GTA 6, is skipped. Each video is scanned once, and a video
  YouTube keeps behind a sign-in is set aside instead of being retried.
- ⚡ **Finds the moments from several signals:** the chat replay (bursts against the stream's baseline,
  Vietnamese hype words like `vãi`, `=))`), timestamps in the comments, YouTube's "Most replayed" curve,
  loudness and, when there is no chat, **the streamer's own speech**, which a local AI reads for reactions,
  fails and jokes. Only the chosen regions are downloaded, never the whole video.
- 🧠 **AI picks, trims and writes:** Whisper transcribes, a local LLM (Ollama) trims each clip to the moment,
  rates it 0–10 and writes a Vietnamese meme-style hook, caption and hashtags; a vision model checks that the
  clip really shows the game. About 5 clips of 30–45 s per hour of video by default.
- 📱 **Renders 9:16:** the webcam panel on top when the video has one, gameplay below or a blurred background;
  word-by-word subtitles, the hook, streamer credit, −14 LUFS loudness. NVENC when the GPU allows it.
- ✅ **You stay in control:** every clip waits for your review (keyboard shortcuts, undo, "next clip"), you
  see the exact post before approving, and posting can be paused at any time. Failed posts can be retried.
- 🖥️ **Studio:** dark and light themes, a command palette (Ctrl/Cmd+K) that jumps to any page or scans
  a pasted YouTube link, keyboard shortcuts for reviewing (A approve, R reject, J/K/L to move through
  the clip, N for the next one), the clip library as stills or a table, guided first-run setup, system
  health with fixes for your OS, jobs with live progress and logs, streamer and account management,
  every setting editable live.
- 💾 **Keeps your disk in check:** a storage limit for the data folder (50 GB by default). The oldest finished
  clips give their files back first; clips still waiting for you are never touched.
- 🎥 **Live recording (off by default):** live streams can still be recorded into a ring buffer and cut from
  chat bursts as they happen (`live.enabled`).
- 📤 **Posting (experimental):** TikTok through a logged-in browser or the official API. The default is a dry run
  that only writes files.

## Screenshots

| | |
|---|---|
| ![Dashboard: what needs you today, the latest clips and running jobs](docs/images/dashboard.png) | ![A clip under review: the video, the AI's reasons and the post exactly as it will go out](docs/images/clip-review.png) |
| ![Clips: everything ViceCut made, by status, as stills](docs/images/clips.png) | ![The clip library as a table: hook, channel, score, length, date](docs/images/clips-table.png) |
| ![The command palette: jump to a page or scan a pasted YouTube link](docs/images/palette.png) | ![Every keyboard shortcut, opened with ?](docs/images/shortcuts.png) |
| ![Discover: this week's GTA VI videos as one list, sorted by how fast they are watched](docs/images/discover.png) | ![A scan on the Jobs page, stage by stage](docs/images/jobs.png) |
| ![Publishing: the queue, with retry and a pause switch](docs/images/publishing.png) | ![Settings > Storage: the data folder against its limit](docs/images/storage.png) |
| ![The light theme: the dashboard](docs/images/dashboard-light.png) | ![The light theme: a clip under review](docs/images/clip-review-light.png) |
| ![On a phone: the dashboard with More open, and a clip under review](docs/images/phone.png) | ![The setup wizard checks your system and suggests fixes](docs/images/wizard-system.png) |

## Quick start

### Docker (3 commands)

```bash
git clone https://github.com/khangbuiquoc203/vicecut.git && cd vicecut
cp .env.example .env            # then open .env and set VICECUT_PASSWORD to something long
docker compose up -d            # Studio is at http://127.0.0.1:8080
```

Open <http://127.0.0.1:8080>, sign in with that password, and follow the setup wizard (it checks your system,
downloads the AI models with a progress bar, and ends with a test clip). The compose file starts an Ollama
container too; for an NVIDIA GPU uncomment the `deploy` block in `docker-compose.yml`. Your data lives in
`./workspace`.

### Try it without installing anything real

```bash
pip install -e .
vicecut serve --demo           # http://127.0.0.1:8080, simulated data, calls no real service
```

`vicecut serve --demo --first-run` behaves like a brand-new installation, so you can walk through the wizard.

### On your own machine

Requirements: Python 3.12+, ffmpeg 6+ (with libass and libx264), [deno](https://deno.com) (yt-dlp needs it for
YouTube), Node.js 20+ only to build the UI, and, recommended, [Ollama](https://ollama.com) and a font with
Vietnamese diacritics.

```bash
git clone https://github.com/khangbuiquoc203/vicecut.git && cd vicecut
python -m venv .venv && source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -e .
cd web && npm ci && npm run build && cd ..               # build the web UI once
vicecut serve                                           # → http://127.0.0.1:8080
```

A wheel with the UI built in (no Node.js needed to install it) comes from `python scripts/build_release.py`
or from the GitHub Release. Everything after that happens in the setup wizard. The full walkthrough is in
[docs/getting-started.md](docs/getting-started.md).

### With pipx (no Node.js, no clone)

```bash
pipx install vicecut                                   # once 0.1.0 is on PyPI
pipx install ./vicecut-0.1.0-py3-none-any.whl          # or the wheel from a GitHub Release (UI included)
vicecut serve
```

pipx installs only ViceCut itself: ffmpeg, deno and (recommended) Ollama still come from your system; the
setup wizard tells you what is missing and how to install it.

**Windows + NVIDIA GPU:** `uv pip install -e ".[gpu]"` adds the cuBLAS/cuDNN runtime Whisper needs;
`winget install Gyan.FFmpeg`, `winget install DenoLand.Deno`, `winget install Ollama.Ollama`;
`. .\scripts\env.ps1` sets up a terminal.

## What hardware do I need?

The setup wizard detects your machine and recommends models; this table shows what it picks.

| Your machine | Speech model | AI model (Ollama) | Notes |
|---|---|---|---|
| CPU, under 8 GB RAM | `base` (int8) | `qwen2.5:3b-instruct` | Slow; record at most 2 streams |
| CPU, 8–16 GB RAM | `small` (int8) | `qwen2.5:7b-instruct` | The default |
| CPU, over 16 GB RAM | `small` | `qwen2.5:7b-instruct` | |
| NVIDIA GPU, 6–12 GB VRAM | `medium` (float16, CUDA) | `qwen2.5:7b-instruct` | |
| NVIDIA GPU, 12 GB+ VRAM | `large-v3` (float16, CUDA) | `qwen2.5:14b-instruct` | Best quality |
| No Ollama | any | none: ranked by chat activity | Works, with weaker picks |

Videos without a chat replay are also transcribed whole with `large-v3-turbo` (`moments.speech_model`), and the
picture check uses a vision model (`ai.vision_model`, default `gemma3:12b`, empty to switch it off). On an RTX
4060 Ti (16 GB) with `qwen2.5:14b-instruct`, a 55-minute upload gave 5 clips in 9.5 minutes; a smaller
AI model is faster, at some cost to the picks and hooks.

Disk: the images, models and recordings add up; plan for 20 GB free. The Docker image is about 3.6 GB.

## Configuration

Almost everything is in **Settings** in the web UI, stored in the database and applied while the engine runs
where possible. [docs/configuration.md](docs/configuration.md) lists every setting with its default and limits
(generated from the code). `config.toml` is imported once on the first run; secrets (API keys, tokens, optional
YouTube cookies) are write-only in the UI and may also come from environment variables (`.env.example`).

## Password protection

Studio listens on `127.0.0.1` only. To reach it from another machine (Docker does this) set a password first;
the server refuses to start otherwise:

```bash
vicecut set-password            # or set VICECUT_PASSWORD, or Settings > System in the UI
vicecut serve --host 0.0.0.0
```

Put a reverse proxy with TLS in front of it if you expose it beyond a trusted network. See [SECURITY.md](SECURITY.md).

## FAQ

**YouTube says "Sign in to confirm you're not a bot".** ViceCut does not bypass that and never will. Wait and
retry, update yt-dlp (`pip install -U yt-dlp`), or give yt-dlp the cookies of **your own** account under
**Settings > Live** (a `cookies.txt` file or a browser name). They grant access to your YouTube session: use only
your own and never share the file. Details: [docs/troubleshooting.md](docs/troubleshooting.md).

**Do I need a GPU?** No, but transcription is much faster with one. On CPU use the `small` or `base` speech model
and record fewer streams at once.

**Does it work on Windows / macOS?** Yes; CI runs the tests on Windows, macOS and Linux with Python 3.12 and 3.13.
Windows needs ffmpeg, deno and Ollama (the three `winget` commands above). Docker works everywhere Docker does.

**Is anything posted automatically?** Not unless you switch it on. The default publishing mode is a dry run that
writes clips and captions to `data/dry-run/`. Posting is experimental (next section).

**Where is my data?** In `data/` (Docker: `./workspace/data`): the database, clips, recordings, secrets vault and
browser profiles. Nothing is sent anywhere: ViceCut has no telemetry.

**Port 8080 is taken.** `vicecut serve --port 8081`, or change the published port in `docker-compose.yml`.

## Posting to TikTok (experimental)

Both posting modes are **experimental and not verified by the maintainers**, and are off by default.

- **Browser mode:** `vicecut tiktok-login main` opens a real browser window, you sign in yourself, the session is
  kept in `data/browser-profiles/main/`. If TikTok changes its page, edit the selectors in
  `[tiktok_browser] selectors` of `config.toml`.
- **Official API:** create an app on developers.tiktok.com with *Login Kit* and *Content Posting API*, add redirect
  URI `http://localhost:8765/callback`, set the client key and secret in Settings > Publishing (or `.env`), run
  `vicecut tiktok-auth main`. Apps that have not passed TikTok's audit can only post privately.

Automating a browser may breach TikTok's terms and the account can be restricted. ViceCut does not fake browser
fingerprints or bypass captchas. Keep volumes low (defaults: 6 posts a day, 90 minutes apart).

## Command line

Everything also runs headless: `vicecut run` (find → scan → cut → score → render → queue → post),
`vicecut scan-vod <url>`, `vicecut queue`, `vicecut approve <id>`, `vicecut rehook <clip>`, `vicecut status`.
`vicecut --help` lists them all.

## Development

```bash
ruff check . && ruff format --check . && mypy && lint-imports && pytest
cd web && npm run typecheck && npm run lint && npm run depcruise && npm run test:coverage && npm run build
cd web && npm run build-storybook && npm run test:e2e
```

Read [CONTRIBUTING.md](CONTRIBUTING.md), [docs/development.md](docs/development.md),
[docs/architecture.md](docs/architecture.md) and the [ADRs](docs/adr/) first.

## Known limits

- The parts that talk to real YouTube and TikTok (yt-dlp, chat-downloader, Playwright, the TikTok API) are tested
  against simulated data in CI. Scanning finished videos was also exercised by hand on real Vietnamese GTA 6
  videos before 0.1.0; TikTok posting was not.
- Some videos (age-restricted, or when YouTube asks for a bot check) can only be scanned with your own cookies.
- YouTube's HLS links expire after a few hours; the recorder re-resolves them, but a very long stream can still
  have gaps.
- Facebook Gaming, TikTok Live and Twitch are not supported; add a platform by writing adapters for the
  `LiveFinder`, `LiveChatSource` and `Recorder` ports.
- Field help in Settings is English only; the web UI has no Vietnamese translation yet.

## Disclaimer

ViceCut is published as source code for learning and for the community. The maintainer does not run it on other
people's videos and does not publish clips. The MIT licence covers the code only. It does not give anyone the
right to cut or repost a stream. The person who runs the program is responsible for copyright and for the
platforms' terms. Posting to TikTok through an automated browser may breach TikTok's terms and can get an account
restricted. ViceCut has no captcha, bot-check or fingerprint evasion and will not accept any. It is not affiliated
with Rockstar Games, YouTube, Google, TikTok or ByteDance. Read the full [DISCLAIMER](DISCLAIMER.md).

## License

The source in this repository is [MIT](LICENSE). Grand Theft Auto, YouTube and TikTok are trademarks of their owners. Details and third-party licences are in [NOTICE.md](NOTICE.md).
