vidsum-local 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vidsum_local-0.4.0/LICENSE +21 -0
- vidsum_local-0.4.0/PKG-INFO +339 -0
- vidsum_local-0.4.0/README.md +303 -0
- vidsum_local-0.4.0/pyproject.toml +53 -0
- vidsum_local-0.4.0/setup.cfg +4 -0
- vidsum_local-0.4.0/tests/test_cloud.py +87 -0
- vidsum_local-0.4.0/tests/test_failure_isolation.py +34 -0
- vidsum_local-0.4.0/tests/test_fetch.py +674 -0
- vidsum_local-0.4.0/tests/test_mcp.py +23 -0
- vidsum_local-0.4.0/tests/test_process_lock.py +31 -0
- vidsum_local-0.4.0/tests/test_public.py +107 -0
- vidsum_local-0.4.0/tests/test_visual.py +76 -0
- vidsum_local-0.4.0/tests/test_visual_batch.py +56 -0
- vidsum_local-0.4.0/vidsum/__init__.py +2 -0
- vidsum_local-0.4.0/vidsum/audio.py +52 -0
- vidsum_local-0.4.0/vidsum/cli.py +892 -0
- vidsum_local-0.4.0/vidsum/cloud.py +189 -0
- vidsum_local-0.4.0/vidsum/fetch.py +601 -0
- vidsum_local-0.4.0/vidsum/i18n.py +273 -0
- vidsum_local-0.4.0/vidsum/mcp_server.py +189 -0
- vidsum_local-0.4.0/vidsum/models.py +125 -0
- vidsum_local-0.4.0/vidsum/review.py +137 -0
- vidsum_local-0.4.0/vidsum/visual.py +211 -0
- vidsum_local-0.4.0/vidsum_local.egg-info/PKG-INFO +339 -0
- vidsum_local-0.4.0/vidsum_local.egg-info/SOURCES.txt +27 -0
- vidsum_local-0.4.0/vidsum_local.egg-info/dependency_links.txt +1 -0
- vidsum_local-0.4.0/vidsum_local.egg-info/entry_points.txt +4 -0
- vidsum_local-0.4.0/vidsum_local.egg-info/requires.txt +17 -0
- vidsum_local-0.4.0/vidsum_local.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VIDSUM contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vidsum-local
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Summarize any video locally, from a file or a link (YouTube, Bilibili, Douyin, TikTok, ...): transcript, key frames, on-screen text and a timestamped summary. CLI and MCP server for Apple Silicon, with an experimental cloud mode.
|
|
5
|
+
Author: allenwu-blip
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/allenwu-blip/vidsum
|
|
8
|
+
Project-URL: Repository, https://github.com/allenwu-blip/vidsum
|
|
9
|
+
Project-URL: Issues, https://github.com/allenwu-blip/vidsum/issues
|
|
10
|
+
Keywords: video,summarize,summary,transcribe,transcription,subtitles,whisper,mlx,apple-silicon,local-ai,mcp,mcp-server,ocr,vlm,yt-dlp,youtube,bilibili,douyin,tiktok,xiaohongshu
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Multimedia :: Video
|
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: huggingface-hub>=1.0
|
|
24
|
+
Requires-Dist: Pillow>=10.3
|
|
25
|
+
Requires-Dist: mcp<3,>=2.3
|
|
26
|
+
Requires-Dist: yt-dlp[curl-cffi,default,deno]>=2026.11.23
|
|
27
|
+
Requires-Dist: mlx-whisper<0.5,>=0.4.3; sys_platform == "darwin" and platform_machine == "arm64"
|
|
28
|
+
Requires-Dist: mlx-vlm<0.9,>=0.7.12; sys_platform == "darwin" and platform_machine == "arm64"
|
|
29
|
+
Requires-Dist: mlx-lm<0.34,>=0.32.2; sys_platform == "darwin" and platform_machine == "arm64"
|
|
30
|
+
Requires-Dist: pyobjc-framework-Vision>=11; sys_platform == "darwin"
|
|
31
|
+
Requires-Dist: pyobjc-framework-Quartz>=11; sys_platform == "darwin"
|
|
32
|
+
Requires-Dist: pyobjc-framework-SoundAnalysis>=11; sys_platform == "darwin"
|
|
33
|
+
Provides-Extra: browser
|
|
34
|
+
Requires-Dist: playwright>=1.49; extra == "browser"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# vidsum
|
|
38
|
+
|
|
39
|
+
**Summarize any video locally. No API cost, no upload.**
|
|
40
|
+
|
|
41
|
+
Give vidsum a video file or a link (YouTube, Bilibili, Douyin, Xiaohongshu, TikTok, Instagram, X, Weibo, Vimeo and other sites yt-dlp supports, or a whole pasted share message). It turns the video into a timestamped transcript, SRT/VTT subtitles, notes on what the key frames show, the text that appears on screen, and a short summary. Key points cite a timecode (`[audio 01:23]`, `[screen 00:40]`, `[OCR 00:12]`), and the quotes section is copied from the transcript by code. Links are downloaded first. On an Apple Silicon Mac the models (Whisper and Qwen) then run through MLX, so the video is never uploaded anywhere. Without a Mac there is a cloud profile for OpenAI-compatible APIs; it has only been tested against a mock server, and outside macOS there is no OCR.
|
|
42
|
+
|
|
43
|
+
Use it from the terminal, as an MCP server, or as an Agent Skill. The MCP server is tested in Claude Code; the Claude Desktop, Cursor and Codex configs below are untested.
|
|
44
|
+
|
|
45
|
+
<!-- mcp-name: io.github.allenwu-blip/vidsum -->
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
You need [uv](https://docs.astral.sh/uv/) and FFmpeg (`brew install ffmpeg`). Run `setup` once to download the models (7.6 GB); after that, give it a video file or a link and it prints the summary. Put links in quotes, because zsh treats `?` and `&` in a bare URL as special characters.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
uvx vidsum-local setup
|
|
55
|
+
uvx vidsum-local talk.mp4
|
|
56
|
+
uvx vidsum-local "https://www.youtube.com/watch?v=jNQXAC9IVRw"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Subtitles only:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uvx vidsum-local transcribe talk.mp4 --format srt > talk.srt
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Everything else (frames, contact sheet, OCR, transcript files) lands in `./vidsum-output/`.
|
|
66
|
+
|
|
67
|
+
## Links and share text
|
|
68
|
+
|
|
69
|
+
Links are downloaded with [yt-dlp](https://github.com/yt-dlp/yt-dlp), which is installed with vidsum. You can paste a whole share message, such as a Douyin or Xiaohongshu share text with Chinese around the link; vidsum finds the link and follows short links (`v.douyin.com`, `xhslink.com`, `b23.tv`). We downloaded one public video from each of these sites on 2026-11-24, from a US connection (download times are in [docs/benchmarks.md](https://github.com/allenwu-blip/vidsum/blob/main/docs/benchmarks.md#link-downloads)):
|
|
70
|
+
|
|
71
|
+
| Site | Result | Notes |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| YouTube, Bilibili, TikTok, X, Weibo | worked without cookies | some TikTok posts are blocked by region |
|
|
74
|
+
| Instagram | a public reel worked without cookies | other posts may need cookies; not tested |
|
|
75
|
+
| Xiaohongshu | worked without cookies | share links carry an `xsec_token`; a bare note link without it failed and needs cookies |
|
|
76
|
+
| Douyin | share text and short links worked | needs the browser extra (below); yt-dlp alone cannot sign Douyin's requests |
|
|
77
|
+
| Vimeo | worked | pages that ask for a login are retried through the public player; DRM-protected videos cannot be downloaded |
|
|
78
|
+
| Wikimedia Commons | worked | an example of the many other sites yt-dlp supports; we did not test the rest |
|
|
79
|
+
| Kuaishou | not supported | yt-dlp has no Kuaishou extractor; use `--fetch-command` with your own downloader |
|
|
80
|
+
|
|
81
|
+
**Douyin** opens the public video page in a headless browser and reads the page's own video details: no login, nothing stored. It needs the `browser` extra and Google Chrome (or Playwright's Chromium):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uvx --from "vidsum-local[browser]" vidsum-local "https://v.douyin.com/xxxxxxx/"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Without Chrome, install Playwright's Chromium once with `uvx --from "vidsum-local[browser]" playwright install chromium` (uv notes that `playwright` comes from a dependency; that is expected, and it keeps the browser matched to the Playwright version vidsum uses). For the MCP server, start it the same way: `uvx --from "vidsum-local[browser]" vidsum-local mcp`.
|
|
88
|
+
|
|
89
|
+
**Sites that need a login** (private videos, age checks, some Instagram posts) work with your own browser session. vidsum passes these options on to yt-dlp (a cookies file as a temporary copy):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
uvx vidsum-local "https://www.instagram.com/reel/xxxxxxx/" --cookies-from-browser chrome
|
|
93
|
+
uvx vidsum-local "https://www.instagram.com/reel/xxxxxxx/" --cookies cookies.txt
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`--cookies-from-browser` also takes `firefox`, `safari`, `edge`, `brave` and a profile (`"chrome:Profile 1"`, quoted because of the space). On macOS, reading Chrome's cookies may make the system ask for permission. Use one of the two options, not both. vidsum hands yt-dlp a temporary copy of your cookies file, so the file itself is never rewritten. For the MCP server, set one of `VIDSUM_COOKIES_FROM_BROWSER` or `VIDSUM_COOKIES` (a full path) in its environment.
|
|
97
|
+
|
|
98
|
+
**Use it responsibly.** Only process videos you have the right to use, and follow each site's terms of service. vidsum downloads one video per link for your own analysis: a playlist or channel link gives its first video, and live streams are skipped. It does not get around DRM, and cookies are only read when you ask for it.
|
|
99
|
+
|
|
100
|
+
## Add it to your AI agent
|
|
101
|
+
|
|
102
|
+
**Claude Code plugin** (skill and MCP server in one step). Type these two lines inside Claude Code, not in a terminal:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
/plugin marketplace add allenwu-blip/vidsum
|
|
106
|
+
/plugin install vidsum@vidsum
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Recent versions of Claude Code also take it as one line: `/plugin install vidsum --marketplace allenwu-blip/vidsum`.
|
|
110
|
+
|
|
111
|
+
**MCP server**, for any client. Run `uvx vidsum-local setup` in a terminal first: it downloads the models and lets uvx build its environment, so the server starts quickly and no tool call waits on a download.
|
|
112
|
+
|
|
113
|
+
Claude Code (tested):
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
claude mcp add vidsum -- uvx vidsum-local mcp
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For Douyin links, add the browser extra instead: `claude mcp add vidsum -- uvx --from "vidsum-local[browser]" vidsum-local mcp`.
|
|
120
|
+
|
|
121
|
+
Claude Desktop, Cursor and other JSON configs (untested; if the app cannot find `uvx`, put the full path from `which uvx` in `command`):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"mcpServers": {
|
|
126
|
+
"vidsum": {
|
|
127
|
+
"command": "uvx",
|
|
128
|
+
"args": ["vidsum-local", "mcp"]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Codex (`~/.codex/config.toml`, untested). Codex stops a tool call after 60 s by default, and a summary takes minutes, so raise the timeouts:
|
|
135
|
+
|
|
136
|
+
```toml
|
|
137
|
+
[mcp_servers.vidsum]
|
|
138
|
+
command = "uvx"
|
|
139
|
+
args = ["vidsum-local", "mcp"]
|
|
140
|
+
startup_timeout_sec = 120
|
|
141
|
+
tool_timeout_sec = 1800
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The server has two tools:
|
|
145
|
+
|
|
146
|
+
| Tool | Arguments | Returns |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `summarize_video` | `path` (a file, a link or share text), `language` (default `auto`), `focus` (a question to answer), `describe_frames` | the Markdown summary and the folder with the evidence |
|
|
149
|
+
| `transcribe_video` | `path` (a file, a link or share text), `language` hint, `format` (`md`, `srt`, `vtt`, `txt`, `json`) | the transcript |
|
|
150
|
+
|
|
151
|
+
Things to ask once it is installed:
|
|
152
|
+
|
|
153
|
+
- "Summarize ~/Movies/keynote.mp4 and list the key quotes with timecodes."
|
|
154
|
+
- "Transcribe https://www.youtube.com/watch?v=jNQXAC9IVRw and give me an SRT file."
|
|
155
|
+
- "Summarize https://commons.wikimedia.org/wiki/File:ScienceCasts-_The_Zero_Gravity_Coffee_Cup.webm. Which points come from what is said, and which from what is shown?"
|
|
156
|
+
- "Here is a Douyin share text: … Break down its first three seconds for a creator."
|
|
157
|
+
|
|
158
|
+
If the models are not downloaded yet, the tools return the one command to run instead of hanging on a 7.6 GB download. While a summary runs the server sends no progress updates, so a client with a short tool timeout will give up before it finishes.
|
|
159
|
+
|
|
160
|
+
**Agent Skill**: [skills/vidsum/SKILL.md](https://github.com/allenwu-blip/vidsum/blob/main/skills/vidsum/SKILL.md) follows the open [Agent Skills](https://agentskills.io) format. Copy the folder into your agent's skills directory, or run `npx skills add allenwu-blip/vidsum`.
|
|
161
|
+
|
|
162
|
+
## What you get
|
|
163
|
+
|
|
164
|
+
From the first 45 seconds of a public-domain NASA clip ("ScienceCasts: The Zero Gravity Coffee Cup"), default `small` profile, the same run as the GIF above. Lines are copied from that output unchanged; each `…` marks lines that were left out.
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
# zero-gravity-coffee-cup.webm
|
|
168
|
+
…
|
|
169
|
+
|
|
170
|
+
## TL;DR
|
|
171
|
+
This is a short educational video from Science@NASA about the unique physics of coffee in zero gravity. It explains that standard Earth rules like "up and down" do not apply in space, where dropped objects float rather than fall. The video introduces Professor Mark Weislegel and his work on a specialized cup designed to keep coffee contained in microgravity.
|
|
172
|
+
|
|
173
|
+
## Key points
|
|
174
|
+
* The video explains that familiar Earth rules, such as gravity causing things to fall or hot air to rise, do not apply in the microgravity environment of space stations. [audio 00:13.30–00:25.40]
|
|
175
|
+
…
|
|
176
|
+
* Physics professor Mark Weislegel of Portland State University is identified as someone who has studied coffee in this environment. [audio 00:39.32–00:44.98]
|
|
177
|
+
…
|
|
178
|
+
|
|
179
|
+
## Timeline
|
|
180
|
+
…
|
|
181
|
+
|
|
182
|
+
## On screen
|
|
183
|
+
|
|
184
|
+
* A glowing, fiery celestial body resembling a star or sun against a black background. [screen 00:00]
|
|
185
|
+
* Title card text reading "SCIENCE@NASA" and "The Zero Gravity Coffee Cup". [screen 00:05.99]
|
|
186
|
+
…
|
|
187
|
+
* An astronaut floating inside a cluttered space station module, holding a plastic bag. [screen 00:23.97]
|
|
188
|
+
* Text "HATCH" visible on a panel behind the astronaut. [OCR 00:23.97]
|
|
189
|
+
…
|
|
190
|
+
* Text "science @ NASA" and "Mark Weislogel" visible in the top right corner during later frames. [OCR 00:41.94]
|
|
191
|
+
…
|
|
192
|
+
|
|
193
|
+
## Key quotes
|
|
194
|
+
|
|
195
|
+
### Spoken (verbatim from transcript.md)
|
|
196
|
+
|
|
197
|
+
Audio: speech detected (may include singing). Speech recognition can be wrong; song lyrics are not treated as narration.
|
|
198
|
+
|
|
199
|
+
- [00:03.66–00:05.68] “The Zero Gravity Coffee Cup”
|
|
200
|
+
- [00:19.44–00:21.76] “There is no up and no down.”
|
|
201
|
+
- [00:39.32–00:44.02] “Physics professor Mark Weislegel of Portland State University has given a lot of thought”
|
|
202
|
+
|
|
203
|
+
### On screen (verbatim from ocr.json; OCR can misread)
|
|
204
|
+
|
|
205
|
+
- [00:05.99] “The Zero Gravity Coffee Cup”
|
|
206
|
+
- [00:41.94] “Mark Weislogel”
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Whisper heard the professor's name as "Weislegel"; the on-screen caption spells it "Weislogel". Both are kept with their timecodes, so you can tell which one to trust. Each run also leaves the full transcript (`.md`, `.srt`, `.vtt`, `.txt`), the frame notes, the OCR and a contact sheet of the sampled frames in `vidsum-output/`.
|
|
210
|
+
|
|
211
|
+
## Models and memory
|
|
212
|
+
|
|
213
|
+
| Profile | Models | Download | Measured peak | 45 s clip, Apple M6 32 GB |
|
|
214
|
+
|---|---|---|---|---|
|
|
215
|
+
| `small` (default) | Whisper large-v3-turbo, Qwen3.5 9B 4-bit for frames and text | 7.6 GB | 7.2 GB | about 2 min (3 runs on 0.4.0: median 116 s, range 111–121 s); `--no-visual` 43 s; transcript only 3.5 s |
|
|
216
|
+
| `large` | Whisper large-v3-turbo, Qwen3.6 35B-A3B 4-bit | 22 GB | 22 GB (frame stage) | not timed on this clip; frames took 5.25 s each on average over 12 earlier videos ([benchmarks](https://github.com/allenwu-blip/vidsum/blob/main/docs/benchmarks.md)) |
|
|
217
|
+
| `cloud` | any OpenAI-compatible API | none | — | depends on the API |
|
|
218
|
+
|
|
219
|
+
Peaks are MLX's own high-water mark on a 32 GB Apple M6, one model loaded at a time. Times are wall-clock on 2026-11-24 with the models already downloaded and no other GPU job running (1-minute load average 3.3 to 4.4); on a quieter machine the day before, 0.3.0 took a median of 96 s on the same clip. A run with a training job sharing the GPU took 315 s, so a busy machine can be three times slower. Longer videos take longer. Details: [benchmarks](https://github.com/allenwu-blip/vidsum/blob/main/docs/benchmarks.md). With a measured peak of 7.2 GB, 16 GB Macs should work but are untested; if you run it on one, please open an issue with the numbers. Weights go to the Hugging Face cache (`~/.cache/huggingface/hub`, move it with `HF_HOME`) and revisions are pinned.
|
|
220
|
+
|
|
221
|
+
## Local or cloud
|
|
222
|
+
|
|
223
|
+
| | vidsum, local profiles | Cloud transcription and LLM APIs |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| Where the video goes | stays on your Mac | uploaded to the provider |
|
|
226
|
+
| Network | the one-time model download, and downloading the links you give it; after setup, weights load from the local cache by path (set `HF_HUB_OFFLINE=1` to be sure) | every run |
|
|
227
|
+
| Cost per video | nothing after the download | billed by the provider per minute or per token |
|
|
228
|
+
| Hardware | Apple Silicon; measured peak 7.2 GB, 16 GB Macs untested | anything |
|
|
229
|
+
|
|
230
|
+
What vidsum runs, sends and fetches:
|
|
231
|
+
|
|
232
|
+
- `uvx` installs vidsum and its Python packages from PyPI. `vidsum setup` downloads the model weights from Hugging Face once.
|
|
233
|
+
- A link is downloaded from the site it points to, by yt-dlp in a child process; for Douyin, a headless Chrome or Chromium loads the public video page. Cookies are read only with `--cookies` or `--cookies-from-browser`. yt-dlp's metadata comes back on standard output, so no file with signed media addresses or request headers is left on disk.
|
|
234
|
+
- With the local profiles, nothing else leaves the Mac: the video, frames, transcript and summary are written to the output folder you choose. There is no telemetry and no vidsum server.
|
|
235
|
+
- With the cloud profile, audio, frames and text are sent to the OpenAI-compatible endpoint you set in `VIDSUM_API_BASE`.
|
|
236
|
+
|
|
237
|
+
The cloud profile is for machines without Apple Silicon. It is experimental: it has only been tested against a mock server, not a paid provider, and outside macOS there is no OCR and no music detection (both use Apple frameworks).
|
|
238
|
+
|
|
239
|
+
It reads four environment variables. Put your key in place of `...`:
|
|
240
|
+
|
|
241
|
+
- `VIDSUM_API_KEY`: your API key. If it is not set, `OPENAI_API_KEY` is used.
|
|
242
|
+
- `VIDSUM_API_BASE`: any OpenAI-compatible endpoint.
|
|
243
|
+
- `VIDSUM_CLOUD_MODEL`: a chat model that accepts images. `gpt-6-luna` is the default and has not been checked against a live API.
|
|
244
|
+
- `VIDSUM_CLOUD_ASR_MODEL`: a speech model that returns segment timestamps. `whisper-1` is the default.
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
export VIDSUM_API_KEY=...
|
|
248
|
+
export VIDSUM_API_BASE=https://api.openai.com/v1
|
|
249
|
+
export VIDSUM_CLOUD_MODEL=gpt-6-luna
|
|
250
|
+
export VIDSUM_CLOUD_ASR_MODEL=whisper-1
|
|
251
|
+
uvx vidsum-local --profile cloud talk.mp4
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
In cloud mode the audio and the sampled frames are sent to that API.
|
|
255
|
+
|
|
256
|
+
## Options
|
|
257
|
+
|
|
258
|
+
The examples use `uvx vidsum-local`. Run `uv tool install vidsum-local` if you want the shorter `vidsum` command on your PATH; uvx alone does not add it.
|
|
259
|
+
|
|
260
|
+
Options can go before or after the file name, for example:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
uvx vidsum-local talk.mp4 --language zh --focus "what about pricing?"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
- `--language auto|en|zh|ja|...`: language of the summary. `auto` follows the speech.
|
|
267
|
+
- `--focus "what about pricing?"`: make the summary answer one question.
|
|
268
|
+
- `--no-visual`: skip the frames. Faster; transcript and OCR only.
|
|
269
|
+
- `--profile small|large|cloud`: which models to use (see the table above).
|
|
270
|
+
- `--template general|creator`: `creator` covers the hook, structure, shots and takeaways, for short-video makers.
|
|
271
|
+
- `--visual-frames 8-12`: how many key frames the vision model looks at.
|
|
272
|
+
- `--manifest batch.json`: many videos at once, as `[{"id": "a1", "input": "a.mp4", "label": "...", "focus": "..."}]`. An `input` can be a file or a link.
|
|
273
|
+
- `--cookies-from-browser BROWSER[:PROFILE]`, `--cookies FILE`: for links that need a signed-in session (see [Links and share text](#links-and-share-text)).
|
|
274
|
+
- `--fetch-command CMD`: your own downloader instead of the built-in one. vidsum runs `CMD <input> <item_dir>`; it must leave `meta.json` and `video.mp4` there.
|
|
275
|
+
|
|
276
|
+
## How it works
|
|
277
|
+
|
|
278
|
+
1. A link is downloaded first: yt-dlp for most sites, a headless browser for Douyin. FFmpeg finds scene changes and samples up to 24 frames, keeping the first and last; it also builds a contact sheet.
|
|
279
|
+
2. macOS Vision reads on-screen text (OCR). Apple's sound classifier flags music and singing so lyrics are not mistaken for narration. Both are macOS only.
|
|
280
|
+
3. Whisper large-v3-turbo transcribes the speech with timestamps.
|
|
281
|
+
4. A vision model describes 8 to 12 of the frames, each compared with the one before, and then the contact sheet.
|
|
282
|
+
5. A text model writes the summary from that evidence. The quotes section is copied from the transcript and OCR by code, so the model cannot rewrite what was said.
|
|
283
|
+
|
|
284
|
+
Only one model is in memory at a time, and each runs in its own process.
|
|
285
|
+
|
|
286
|
+
## Limits
|
|
287
|
+
|
|
288
|
+
- Frames are samples. Camera moves, editing pace and "this looks AI-generated" are guesses, and the summary says so.
|
|
289
|
+
- Whisper can hear words in music. vidsum flags music-only and singing tracks, but check quotes that matter.
|
|
290
|
+
- The vision model can misread small text or misdescribe a frame. The frames and OCR are kept next to the summary so you can check.
|
|
291
|
+
- Long videos still get 8 to 12 frames. For a one-hour talk the transcript carries most of the summary.
|
|
292
|
+
- A link download stops at 4 GB. A live stream is skipped when the site marks it live or the server sends audio or video without a size. An ordinary file sent without a size is refused the same way; download it first (for example with `curl -L -o clip.mp4 '<url>'`) and pass the path.
|
|
293
|
+
- The MCP server runs one job at a time. Cancelling a call in your client does not stop a summary that is already running; the next call waits for it.
|
|
294
|
+
|
|
295
|
+
## Development
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
git clone https://github.com/allenwu-blip/vidsum && cd vidsum
|
|
299
|
+
uv venv && uv pip install -e .
|
|
300
|
+
.venv/bin/python -m unittest discover -s tests
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
MIT licensed. Third-party licenses: [THIRD_PARTY.md](https://github.com/allenwu-blip/vidsum/blob/main/THIRD_PARTY.md).
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## 中文说明
|
|
308
|
+
|
|
309
|
+
**在本机总结任何视频:不花 API 的钱,视频不上传。**
|
|
310
|
+
|
|
311
|
+
给它一个视频文件,或者一个视频链接(YouTube、B 站、抖音、小红书、TikTok、Instagram、X、微博、Vimeo,以及 yt-dlp 支持的其他网站),整段分享文字直接粘进去也行。它出带时间码的转写、SRT/VTT 字幕、关键帧在拍什么、画面上的字,再写一份摘要。要点后面标时间码出处(`[声音 01:23]`、`[画面 00:40]`、`[字幕/OCR 00:12]`),原话那节由代码从转写里逐字摘。链接先下载到本机,再在 Apple Silicon 的 Mac 上用 MLX 跑开源模型(Whisper 和千问),视频不上传到任何地方。没有 Mac 可以用 cloud 档接 OpenAI 兼容接口,不过它只对模拟服务器测过,离开 macOS 也没有 OCR。
|
|
312
|
+
|
|
313
|
+
能在终端里用,也能当 MCP server 或 Agent Skill 给 AI 用。MCP 只在 Claude Code 里测过,Claude Desktop、Cursor、Codex 的配置写了但没测。
|
|
314
|
+
|
|
315
|
+
下面四条命令:第一条只在第一次跑,下 7.6 GB 模型;第二条出中文摘要;第三条总结一个 B 站链接(换成你的);第四条只出字幕。链接要加引号,zsh 会把网址里的 `?` 和 `&` 当成特殊字符。
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
uvx vidsum-local setup
|
|
319
|
+
uvx vidsum-local 视频.mp4 --language zh
|
|
320
|
+
uvx vidsum-local "https://www.bilibili.com/video/BV1xxxxxxxxx" --language zh
|
|
321
|
+
uvx vidsum-local transcribe 视频.mp4 --format srt
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
抖音要加 browser 扩展:它用无头 Chrome 打开公开的视频页,读页面自己拿到的视频信息,不登录,也不存任何东西。整段分享文字可以直接粘:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
uvx --from "vidsum-local[browser]" vidsum-local "7.94 复制打开抖音,看看【某某的作品】… https://v.douyin.com/xxxxxxx/ 复制此链接…" --language zh
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
- Claude Code 里装插件:`/plugin marketplace add allenwu-blip/vidsum`,再 `/plugin install vidsum@vidsum`。插件自带 browser 扩展,抖音也能下。单独加 MCP server 要下抖音的话,用 `claude mcp add vidsum -- uvx --from "vidsum-local[browser]" vidsum-local mcp`。
|
|
331
|
+
- `--language` 不写就跟着视频里说的话走,中文视频出中文摘要。
|
|
332
|
+
- `--template creator` 是给做短视频的人拆片子用的:开头三秒、结构、拍法剪法、能学的点。
|
|
333
|
+
- 默认的 small 档(9B 模型)实测峰值 7.2 GB,16 GB 的 Mac 还没试过。45 秒的片子在 M6 32 GB 上、没有别的 GPU 活时,整条约 2 分钟,只出字幕约 3.5 秒。32 GB 以上可以 `--profile large`(35B),看图更细。
|
|
334
|
+
- 11-24 每个平台实测下载了一条公开视频(美国网络):YouTube、B 站、TikTok、X、微博不用 cookies;小红书 App 分享出来的链接带 xsec_token,不用 cookies,去掉 token 的链接要 cookies;抖音分享文字和短链都能下,要 browser 扩展;Vimeo 要登录的页面会改走公开播放器,有 DRM 的下不了。快手不支持,yt-dlp 没有快手的解析器。
|
|
335
|
+
- 要登录才能看的视频,用自己浏览器里的登录状态:`--cookies-from-browser chrome`(也可以是 firefox、safari、edge),或者 `--cookies cookies.txt`,两个只选一个。cookies 文件交给 yt-dlp 的是临时副本,原文件不会被改。MCP server 在环境变量里设 `VIDSUM_COOKIES_FROM_BROWSER` 或 `VIDSUM_COOKIES`(写完整路径),也是只设一个。
|
|
336
|
+
- 请负责任地使用:只处理你有权使用的视频,遵守各平台的用户协议。vidsum 一条链接只下一个视频,给你自己分析用:播放列表和频道链接只取第一个,直播不下;不绕过 DRM;不加 cookies 选项,就不读浏览器的 cookies。
|
|
337
|
+
- 单个下载最多 4 GB。网站标成直播的、服务器不报大小的音视频流都不下;不报大小的普通文件也会被拒,先自己下到本地再传路径。在 Claude 这类客户端里取消一次调用,正在跑的那条不会停,下一次调用要等它跑完。
|
|
338
|
+
- 会连网的地方:uvx 从 PyPI 装包;`setup` 从 Hugging Face 下模型;链接从它所在的网站下(抖音用无头浏览器打开公开页面);cloud 档把音频、画面和文字发到你设的接口。别的都留在本机,没有统计上报。
|
|
339
|
+
- 模型选型和实测记录(英文):[docs/benchmarks.md](https://github.com/allenwu-blip/vidsum/blob/main/docs/benchmarks.md)。
|