talk-notes 0.1.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.
- talk_notes-0.1.0/.github/workflows/ci.yml +28 -0
- talk_notes-0.1.0/.github/workflows/release.yml +22 -0
- talk_notes-0.1.0/.gitignore +3 -0
- talk_notes-0.1.0/.python-version +1 -0
- talk_notes-0.1.0/AGENTS.md +11 -0
- talk_notes-0.1.0/CLAUDE.md +1 -0
- talk_notes-0.1.0/GLOSSARY.md +31 -0
- talk_notes-0.1.0/LICENSE +21 -0
- talk_notes-0.1.0/PKG-INFO +117 -0
- talk_notes-0.1.0/README.md +84 -0
- talk_notes-0.1.0/pyproject.toml +58 -0
- talk_notes-0.1.0/talk_notes/__init__.py +0 -0
- talk_notes-0.1.0/talk_notes/__main__.py +3 -0
- talk_notes-0.1.0/talk_notes/cli.py +144 -0
- talk_notes-0.1.0/talk_notes/crop.py +187 -0
- talk_notes-0.1.0/talk_notes/llm/__init__.py +44 -0
- talk_notes-0.1.0/talk_notes/llm/base.py +20 -0
- talk_notes-0.1.0/talk_notes/llm/claude_code.py +41 -0
- talk_notes-0.1.0/talk_notes/llm/fake.py +26 -0
- talk_notes-0.1.0/talk_notes/llm/ollama.py +122 -0
- talk_notes-0.1.0/talk_notes/prompts/report.md +81 -0
- talk_notes-0.1.0/talk_notes/render.py +48 -0
- talk_notes-0.1.0/talk_notes/report.py +40 -0
- talk_notes-0.1.0/talk_notes/slides.py +124 -0
- talk_notes-0.1.0/talk_notes/source.py +168 -0
- talk_notes-0.1.0/talk_notes/talk_folder.py +148 -0
- talk_notes-0.1.0/talk_notes/transcribe.py +67 -0
- talk_notes-0.1.0/talk_notes/transcript.py +32 -0
- talk_notes-0.1.0/talk_notes/util.py +39 -0
- talk_notes-0.1.0/tests/conftest.py +45 -0
- talk_notes-0.1.0/tests/test_cli.py +136 -0
- talk_notes-0.1.0/tests/test_crop.py +59 -0
- talk_notes-0.1.0/tests/test_llm.py +217 -0
- talk_notes-0.1.0/tests/test_report.py +42 -0
- talk_notes-0.1.0/tests/test_slides.py +105 -0
- talk_notes-0.1.0/tests/test_source.py +128 -0
- talk_notes-0.1.0/tests/test_talk_folder.py +99 -0
- talk_notes-0.1.0/uv.lock +1823 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v7
|
|
13
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
14
|
+
- run: uv run --locked ruff check talk_notes tests
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
- run: uv sync --locked
|
|
28
|
+
- run: uv run pytest -q
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: pypi
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write # PyPI trusted publishing
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
17
|
+
- name: Check the tag matches the package version
|
|
18
|
+
run: test "${GITHUB_REF_NAME#v}" = "$(uv version --short)"
|
|
19
|
+
- run: uv build
|
|
20
|
+
- name: Smoke-test the wheel
|
|
21
|
+
run: uvx --from dist/*.whl talk-notes --help
|
|
22
|
+
- run: uv publish
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
CLI that turns a talk video into `slides/`, `talk.md` (transcript aligned to slides) and an optional LLM `report.md`. See `README.md` for usage.
|
|
4
|
+
|
|
5
|
+
- Python 3.11+ via uv (CI tests 3.11 to 3.14; local default 3.12 from `.python-version`); run with `uv run talk-notes ...`. Tests: `uv run pytest` (no network or LLM needed). Lint: `uv run ruff check talk_notes tests` (ruff's default rules, version pinned in the dev group). Also verify changes with a real run on a short talk; `--no-slides`, `--transcript captions` or `--no-report` keep it fast.
|
|
6
|
+
- Layout: `cli.py` wires the steps together; `talk_folder.py` (`TalkFolder`: output layout and the manifest `talk-notes.json`, which reruns a step only when its parameters change; a new step must put everything that decides its result, including upstream results, into its params); `source.py` (a talk's metadata, media, captions and links: `UrlSource` via yt-dlp or `LocalFileSource`, raising `SourceError`), `transcript.py` (Whisper or captions), `transcribe.py` (faster-whisper, CUDA lib preload), `slides.py` (frame sampling + phash), `crop.py` (`--crop auto`: vision model box snapped to image edges), `render.py` (`talk.md`), `report.py` (writes `report.md`), `llm/` (LLM backends: see below), `prompts/report.md` (default report instructions; change it by regenerating the reports of a few talks of different types and comparing).
|
|
7
|
+
- `av` is pinned below 16 because faster-whisper 1.2 passes an argument newer PyAV removed. Re-check this when bumping faster-whisper.
|
|
8
|
+
- `out/` holds generated talks and is gitignored.
|
|
9
|
+
- GPU path (`--extra gpu`, `--device cuda`) needs an NVIDIA host; it can't be tested on CPU-only machines.
|
|
10
|
+
- LLM backends live in `llm/`, one module per adapter, behind `ask(prompt, files) -> str` and `LLMError`. Callers pass absolute paths; the adapter decides how to deliver them. To add one (e.g. Codex): write `llm/<name>.py` with a class that has `name` and `ask`, raise `LLMError` for every failure, add one entry to `ADAPTERS` in `llm/__init__.py`, and add tests next to the existing ones in `tests/test_llm.py` (stub CLI on `PATH` or stub HTTP server). Crop and report tests use `FakeLLM`; source tests replace yt-dlp through `UrlSource`'s `ydl_factory`; `tests/test_cli.py` runs the whole pipeline on a generated video.
|
|
11
|
+
- Domain terms are defined in `GLOSSARY.md`; use them in code, docs and reviews.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Glossary
|
|
2
|
+
|
|
3
|
+
Terms used in talk-notes' code, docs and reviews.
|
|
4
|
+
|
|
5
|
+
**Talk**: one recorded presentation, given as a video URL or a local video file.
|
|
6
|
+
|
|
7
|
+
**Source**: where a talk comes from: a URL that yt-dlp can download, or a local file. Provides the talk's metadata, audio, video and (for URLs) captions.
|
|
8
|
+
|
|
9
|
+
**Talk folder**: the output folder of one talk, `out/<title>-<id>/`. Holds `meta.json`, `transcript.json`, `slides.json`, `slides/`, `crop/preview.jpg`, `talk.md`, `report.md` and the manifest.
|
|
10
|
+
|
|
11
|
+
**Manifest**: `talk-notes.json` in a talk folder. Records each step's parameters (and the crop result), so a step is reused until its parameters change.
|
|
12
|
+
|
|
13
|
+
**Step**: one cached stage of the pipeline: transcript, crop, slides or report.
|
|
14
|
+
|
|
15
|
+
**Transcript**: the talk's speech as timed segments, from Whisper or the source's captions.
|
|
16
|
+
|
|
17
|
+
**Slide**: one stretch of the video showing the same picture, saved as one image with its start and end time. Includes screen shares and demos, not only slide decks.
|
|
18
|
+
|
|
19
|
+
**Crop**: the region of the video frame that shows the slides, as ffmpeg `w:h:x:y`. Found automatically by the LLM (`--crop auto`), given by hand, or none (full frame).
|
|
20
|
+
|
|
21
|
+
**Mask**: the part of the slide area that slide detection ignores, normally a speaker camera overlaid on the slides. Found together with the crop.
|
|
22
|
+
|
|
23
|
+
**Report**: `report.md`, written by the LLM from `talk.md` and the slide images, following `prompts/report.md`.
|
|
24
|
+
|
|
25
|
+
**Talk type**: the report's classification of a talk (problem-solving story, argument, tutorial, catalogue, product demo, mixed), which picks the report's outline.
|
|
26
|
+
|
|
27
|
+
**Label**: the tag that starts each point in a report: Problem, Cause, Evidence, Solution, Recommendation, Opinion or Caveat.
|
|
28
|
+
|
|
29
|
+
**LLM backend**: a way to ask an LLM a question about text and image files (`--llm`): Claude Code or Ollama.
|
|
30
|
+
|
|
31
|
+
**Adapter**: the module in `llm/` that implements one LLM backend behind `ask(prompt, files)`. `FakeLLM` is the adapter for tests.
|
talk_notes-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Manuel Carullo
|
|
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,117 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: talk-notes
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turn a recorded tech talk into a transcript aligned with its slides, plus an LLM-written reference report
|
|
5
|
+
Project-URL: Homepage, https://github.com/ManuelCarullo/talk-notes
|
|
6
|
+
Project-URL: Issues, https://github.com/ManuelCarullo/talk-notes/issues
|
|
7
|
+
Author: Manuel Carullo
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: knowledge-base,llm,slides,talks,transcript,whisper
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Multimedia :: Video
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: av<16
|
|
24
|
+
Requires-Dist: faster-whisper>=1.1
|
|
25
|
+
Requires-Dist: imagehash>=4.3
|
|
26
|
+
Requires-Dist: imageio-ffmpeg>=0.5
|
|
27
|
+
Requires-Dist: pillow>=10
|
|
28
|
+
Requires-Dist: yt-dlp[default]>=2025.11
|
|
29
|
+
Provides-Extra: gpu
|
|
30
|
+
Requires-Dist: nvidia-cublas-cu12; extra == 'gpu'
|
|
31
|
+
Requires-Dist: nvidia-cudnn-cu12<10,>=9; extra == 'gpu'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# talk-notes
|
|
35
|
+
|
|
36
|
+
Turns a recorded tech talk into a knowledge-base entry:
|
|
37
|
+
|
|
38
|
+
- `slides/`: one image per slide, detected from the video.
|
|
39
|
+
- `talk.md`: the transcript grouped under each slide, with timestamp links back to the video.
|
|
40
|
+
- `report.md` (optional): a structured reference document written by an LLM from `talk.md` and the slides.
|
|
41
|
+
|
|
42
|
+
Download, transcription and slide detection run locally (yt-dlp, faster-whisper, ffmpeg). The slide crop and the report use an LLM: the Claude Code CLI (default) or a local Ollama model, so the whole pipeline can run offline.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
uv tool install talk-notes # CPU only
|
|
48
|
+
uv tool install "talk-notes[gpu]" # NVIDIA GPU (CUDA 12)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or run it without installing: `uvx talk-notes ...`. `pip install talk-notes` works too. YouTube downloads also need Node or Deno on `PATH`. ffmpeg is taken from `PATH`, or a bundled build is used.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
talk-notes "https://www.youtube.com/watch?v=VIDEO_ID" # report via Claude Code
|
|
57
|
+
talk-notes ~/Videos/talk.mp4 --device cuda --llm ollama # fully local
|
|
58
|
+
talk-notes "https://www.youtube.com/watch?v=VIDEO_ID" --no-report --crop none # no LLM
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The source is a local video or any URL yt-dlp supports. Output goes to `out/<title>-<id>/` in the current directory. Run `talk-notes --help` for all options.
|
|
62
|
+
|
|
63
|
+
Reruns reuse each step (transcript, crop, slides, report) until an option that affects it changes; changing `--slide-threshold`, for example, redoes the slides and the report but not the transcript. `--redo slides,report` or `--redo all` forces steps to run again.
|
|
64
|
+
|
|
65
|
+
### Transcription
|
|
66
|
+
|
|
67
|
+
| Option | Default | Notes |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `--device auto\|cpu\|cuda` | `auto` | `auto` uses CUDA when a GPU is visible |
|
|
70
|
+
| `--whisper-model` | `large-v3-turbo` on CUDA, `small` on CPU | Any faster-whisper model |
|
|
71
|
+
| `--language` | auto-detect | Setting it (e.g. `en`) avoids misdetection |
|
|
72
|
+
| `--transcript captions` | `whisper` | Uses the site's captions (URLs only): much faster, but auto-captions lack punctuation |
|
|
73
|
+
|
|
74
|
+
An 18-minute talk takes about 4.5 minutes end to end with `small` on a 4-core CPU. For accents, poor audio or non-English talks, use `--whisper-model large-v3-turbo` on CPU too.
|
|
75
|
+
|
|
76
|
+
### Slides
|
|
77
|
+
|
|
78
|
+
A frame is sampled every `--slide-interval` seconds and perceptually hashed; a new slide starts where the picture changes by more than `--slide-threshold` bits. Each slide is saved as its last frame, so incremental builds appear complete.
|
|
79
|
+
|
|
80
|
+
- Too many near-duplicates: raise `--min-slide-duration` (8–12 for live coding) or `--slide-threshold`.
|
|
81
|
+
- Missed slides: lower `--slide-threshold`.
|
|
82
|
+
- Add `--keep-media` while tuning, so the video isn't downloaded again.
|
|
83
|
+
|
|
84
|
+
`--crop auto` (default) asks the LLM for the slide area, so a speaker camera or conference banner doesn't trigger new slides. A camera overlaid on full-frame slides is masked during detection but kept in the images. Check `crop/preview.jpg` (crop in red, mask in blue). If it is wrong, pass the box by hand as `--crop w:h:x:y` (ffmpeg syntax, source pixels) or use `--crop none`. If the LLM call fails, the full frame is used.
|
|
85
|
+
|
|
86
|
+
### Report
|
|
87
|
+
|
|
88
|
+
`report.md` classifies the talk (problem-solving story, argument, tutorial, catalogue, product demo or mixed) and follows that type's outline. Each point is labelled **Problem**, **Cause**, **Evidence**, **Solution**, **Recommendation**, **Opinion** or **Caveat**, and anything the model added is marked *(inferred)*. It ends with the slides' code verbatim, **For coding agents** rules (When / Do / Why) and references.
|
|
89
|
+
|
|
90
|
+
`--prompt my-prompt.md` replaces the default instructions ([`talk_notes/prompts/report.md`](https://github.com/ManuelCarullo/talk-notes/blob/main/talk_notes/prompts/report.md)); `{{ISSUES_URL}}` in it expands to this repo's issues page. `--no-report` skips the report.
|
|
91
|
+
|
|
92
|
+
### LLM backends
|
|
93
|
+
|
|
94
|
+
`--llm` picks the backend for `--crop auto` and the report; `--llm-model` overrides its model.
|
|
95
|
+
|
|
96
|
+
- `claude` (default): runs the Claude Code CLI (`claude -p`) read-only in the output folder.
|
|
97
|
+
- `ollama`: uses a local Ollama server (`--ollama-url`, default `http://localhost:11434`; model `qwen3-vl:8b-instruct`). Start it with `OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve` to fit more of the model on the GPU.
|
|
98
|
+
|
|
99
|
+
> [!WARNING]
|
|
100
|
+
> Small local models can get the crop wrong and put made-up claims, quotes and links in the report. Use `ollama` only with a GPU that can run models larger than 8 GB, and check its reports against `talk.md`.
|
|
101
|
+
|
|
102
|
+
## Using the output
|
|
103
|
+
|
|
104
|
+
Copy the talk folder (or `report.md` and `slides/`) into a repo's docs and reference it from `CLAUDE.md` or `AGENTS.md`, e.g. `See docs/talks/<name>/report.md for ...`. For exact quotes, `talk.md` is the source of truth.
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
git clone https://github.com/ManuelCarullo/talk-notes && cd talk-notes
|
|
110
|
+
uv sync # add --extra gpu for CUDA
|
|
111
|
+
uv run talk-notes ...
|
|
112
|
+
uv run pytest && uv run ruff check talk_notes tests
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT, see [LICENSE](https://github.com/ManuelCarullo/talk-notes/blob/main/LICENSE). The license covers talk-notes, not its output: transcripts, slides and reports derive from the talks and remain subject to their copyright and the hosting site's terms. Process only talks you have the right to use, and publish the output only if you are allowed to.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# talk-notes
|
|
2
|
+
|
|
3
|
+
Turns a recorded tech talk into a knowledge-base entry:
|
|
4
|
+
|
|
5
|
+
- `slides/`: one image per slide, detected from the video.
|
|
6
|
+
- `talk.md`: the transcript grouped under each slide, with timestamp links back to the video.
|
|
7
|
+
- `report.md` (optional): a structured reference document written by an LLM from `talk.md` and the slides.
|
|
8
|
+
|
|
9
|
+
Download, transcription and slide detection run locally (yt-dlp, faster-whisper, ffmpeg). The slide crop and the report use an LLM: the Claude Code CLI (default) or a local Ollama model, so the whole pipeline can run offline.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
uv tool install talk-notes # CPU only
|
|
15
|
+
uv tool install "talk-notes[gpu]" # NVIDIA GPU (CUDA 12)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or run it without installing: `uvx talk-notes ...`. `pip install talk-notes` works too. YouTube downloads also need Node or Deno on `PATH`. ffmpeg is taken from `PATH`, or a bundled build is used.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
talk-notes "https://www.youtube.com/watch?v=VIDEO_ID" # report via Claude Code
|
|
24
|
+
talk-notes ~/Videos/talk.mp4 --device cuda --llm ollama # fully local
|
|
25
|
+
talk-notes "https://www.youtube.com/watch?v=VIDEO_ID" --no-report --crop none # no LLM
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The source is a local video or any URL yt-dlp supports. Output goes to `out/<title>-<id>/` in the current directory. Run `talk-notes --help` for all options.
|
|
29
|
+
|
|
30
|
+
Reruns reuse each step (transcript, crop, slides, report) until an option that affects it changes; changing `--slide-threshold`, for example, redoes the slides and the report but not the transcript. `--redo slides,report` or `--redo all` forces steps to run again.
|
|
31
|
+
|
|
32
|
+
### Transcription
|
|
33
|
+
|
|
34
|
+
| Option | Default | Notes |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `--device auto\|cpu\|cuda` | `auto` | `auto` uses CUDA when a GPU is visible |
|
|
37
|
+
| `--whisper-model` | `large-v3-turbo` on CUDA, `small` on CPU | Any faster-whisper model |
|
|
38
|
+
| `--language` | auto-detect | Setting it (e.g. `en`) avoids misdetection |
|
|
39
|
+
| `--transcript captions` | `whisper` | Uses the site's captions (URLs only): much faster, but auto-captions lack punctuation |
|
|
40
|
+
|
|
41
|
+
An 18-minute talk takes about 4.5 minutes end to end with `small` on a 4-core CPU. For accents, poor audio or non-English talks, use `--whisper-model large-v3-turbo` on CPU too.
|
|
42
|
+
|
|
43
|
+
### Slides
|
|
44
|
+
|
|
45
|
+
A frame is sampled every `--slide-interval` seconds and perceptually hashed; a new slide starts where the picture changes by more than `--slide-threshold` bits. Each slide is saved as its last frame, so incremental builds appear complete.
|
|
46
|
+
|
|
47
|
+
- Too many near-duplicates: raise `--min-slide-duration` (8–12 for live coding) or `--slide-threshold`.
|
|
48
|
+
- Missed slides: lower `--slide-threshold`.
|
|
49
|
+
- Add `--keep-media` while tuning, so the video isn't downloaded again.
|
|
50
|
+
|
|
51
|
+
`--crop auto` (default) asks the LLM for the slide area, so a speaker camera or conference banner doesn't trigger new slides. A camera overlaid on full-frame slides is masked during detection but kept in the images. Check `crop/preview.jpg` (crop in red, mask in blue). If it is wrong, pass the box by hand as `--crop w:h:x:y` (ffmpeg syntax, source pixels) or use `--crop none`. If the LLM call fails, the full frame is used.
|
|
52
|
+
|
|
53
|
+
### Report
|
|
54
|
+
|
|
55
|
+
`report.md` classifies the talk (problem-solving story, argument, tutorial, catalogue, product demo or mixed) and follows that type's outline. Each point is labelled **Problem**, **Cause**, **Evidence**, **Solution**, **Recommendation**, **Opinion** or **Caveat**, and anything the model added is marked *(inferred)*. It ends with the slides' code verbatim, **For coding agents** rules (When / Do / Why) and references.
|
|
56
|
+
|
|
57
|
+
`--prompt my-prompt.md` replaces the default instructions ([`talk_notes/prompts/report.md`](https://github.com/ManuelCarullo/talk-notes/blob/main/talk_notes/prompts/report.md)); `{{ISSUES_URL}}` in it expands to this repo's issues page. `--no-report` skips the report.
|
|
58
|
+
|
|
59
|
+
### LLM backends
|
|
60
|
+
|
|
61
|
+
`--llm` picks the backend for `--crop auto` and the report; `--llm-model` overrides its model.
|
|
62
|
+
|
|
63
|
+
- `claude` (default): runs the Claude Code CLI (`claude -p`) read-only in the output folder.
|
|
64
|
+
- `ollama`: uses a local Ollama server (`--ollama-url`, default `http://localhost:11434`; model `qwen3-vl:8b-instruct`). Start it with `OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve` to fit more of the model on the GPU.
|
|
65
|
+
|
|
66
|
+
> [!WARNING]
|
|
67
|
+
> Small local models can get the crop wrong and put made-up claims, quotes and links in the report. Use `ollama` only with a GPU that can run models larger than 8 GB, and check its reports against `talk.md`.
|
|
68
|
+
|
|
69
|
+
## Using the output
|
|
70
|
+
|
|
71
|
+
Copy the talk folder (or `report.md` and `slides/`) into a repo's docs and reference it from `CLAUDE.md` or `AGENTS.md`, e.g. `See docs/talks/<name>/report.md for ...`. For exact quotes, `talk.md` is the source of truth.
|
|
72
|
+
|
|
73
|
+
## Development
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
git clone https://github.com/ManuelCarullo/talk-notes && cd talk-notes
|
|
77
|
+
uv sync # add --extra gpu for CUDA
|
|
78
|
+
uv run talk-notes ...
|
|
79
|
+
uv run pytest && uv run ruff check talk_notes tests
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT, see [LICENSE](https://github.com/ManuelCarullo/talk-notes/blob/main/LICENSE). The license covers talk-notes, not its output: transcripts, slides and reports derive from the talks and remain subject to their copyright and the hosting site's terms. Process only talks you have the right to use, and publish the output only if you are allowed to.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "talk-notes"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Turn a recorded tech talk into a transcript aligned with its slides, plus an LLM-written reference report"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
authors = [{ name = "Manuel Carullo" }]
|
|
10
|
+
keywords = ["talks", "transcript", "slides", "whisper", "llm", "knowledge-base"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Environment :: Console",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Multimedia :: Video",
|
|
22
|
+
"Topic :: Text Processing :: Markup :: Markdown",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"av<16", # faster-whisper 1.2 passes `metadata_errors`, which newer PyAV removed
|
|
26
|
+
"faster-whisper>=1.1",
|
|
27
|
+
"imagehash>=4.3",
|
|
28
|
+
"imageio-ffmpeg>=0.5",
|
|
29
|
+
"pillow>=10",
|
|
30
|
+
"yt-dlp[default]>=2025.11",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/ManuelCarullo/talk-notes"
|
|
35
|
+
Issues = "https://github.com/ManuelCarullo/talk-notes/issues"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
# CUDA 12 runtime libraries for faster-whisper (CTranslate2). Needs an NVIDIA driver on the host.
|
|
39
|
+
gpu = [
|
|
40
|
+
"nvidia-cublas-cu12",
|
|
41
|
+
"nvidia-cudnn-cu12>=9,<10",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=8",
|
|
47
|
+
"ruff==0.17.6",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
talk-notes = "talk_notes.cli:main"
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["hatchling"]
|
|
55
|
+
build-backend = "hatchling.build"
|
|
56
|
+
|
|
57
|
+
[tool.pytest.ini_options]
|
|
58
|
+
testpaths = ["tests"]
|
|
File without changes
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import hashlib
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from talk_notes import report
|
|
6
|
+
from talk_notes.crop import auto_crop
|
|
7
|
+
from talk_notes.llm import ADAPTERS, DEFAULT_OLLAMA_URL, LLMError, make_llm
|
|
8
|
+
from talk_notes.render import render_markdown
|
|
9
|
+
from talk_notes.slides import detect_slides
|
|
10
|
+
from talk_notes.source import SourceError, open_source
|
|
11
|
+
from talk_notes.talk_folder import STEPS, TalkFolder
|
|
12
|
+
from talk_notes.transcript import METHODS, get_transcript, transcript_params
|
|
13
|
+
from talk_notes.util import log
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class _HelpFormatter(argparse.ArgumentDefaultsHelpFormatter):
|
|
17
|
+
"""Show defaults only where there is one worth showing."""
|
|
18
|
+
|
|
19
|
+
def _get_help_string(self, action: argparse.Action) -> str:
|
|
20
|
+
if action.default in (None, False, set()) or action.default is argparse.SUPPRESS:
|
|
21
|
+
return action.help or ""
|
|
22
|
+
return super()._get_help_string(action)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _steps(value: str) -> set[str]:
|
|
26
|
+
steps = {s.strip() for s in value.split(",") if s.strip()}
|
|
27
|
+
if steps == {"all"}:
|
|
28
|
+
return set(STEPS)
|
|
29
|
+
unknown = steps - set(STEPS)
|
|
30
|
+
if unknown:
|
|
31
|
+
raise argparse.ArgumentTypeError(f"unknown step(s): {', '.join(sorted(unknown))}")
|
|
32
|
+
return steps
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
36
|
+
p = argparse.ArgumentParser(
|
|
37
|
+
prog="talk-notes",
|
|
38
|
+
description="Turn a talk (YouTube/yt-dlp URL or local video) into slides + aligned transcript + report.",
|
|
39
|
+
formatter_class=_HelpFormatter,
|
|
40
|
+
)
|
|
41
|
+
p.add_argument("source", help="video URL (anything yt-dlp supports) or local video file")
|
|
42
|
+
p.add_argument("-o", "--out", type=Path, default=Path("out"), help="parent output directory")
|
|
43
|
+
p.add_argument("--name", help="output folder name (default: from the title)")
|
|
44
|
+
p.add_argument("--redo", type=_steps, default=set(), metavar="STEPS",
|
|
45
|
+
help="redo these steps even if their results are still valid: comma-separated from "
|
|
46
|
+
f"{', '.join(STEPS)}, or 'all'. Steps whose options changed are redone automatically")
|
|
47
|
+
p.add_argument("--keep-media", action="store_true", help="keep downloaded video/audio after processing")
|
|
48
|
+
|
|
49
|
+
t = p.add_argument_group("transcript")
|
|
50
|
+
t.add_argument("--transcript", choices=METHODS, default="whisper",
|
|
51
|
+
help="local speech recognition, or the captions the video site already has (fast, lower "
|
|
52
|
+
"quality; URLs only)")
|
|
53
|
+
t.add_argument("--device", choices=["auto", "cpu", "cuda"], default="auto")
|
|
54
|
+
t.add_argument("--whisper-model", help="faster-whisper model (default: large-v3-turbo on cuda, small on cpu)")
|
|
55
|
+
t.add_argument("--compute-type", help="CTranslate2 compute type (default: float16 on cuda, int8 on cpu)")
|
|
56
|
+
t.add_argument("--language", help="spoken language code, e.g. en (default: auto-detect)")
|
|
57
|
+
|
|
58
|
+
s = p.add_argument_group("slides")
|
|
59
|
+
s.add_argument("--no-slides", action="store_true", help="skip slide extraction")
|
|
60
|
+
s.add_argument("--max-height", type=int, default=1080, help="max video resolution to download")
|
|
61
|
+
s.add_argument("--slide-interval", type=float, default=2.0, help="seconds between sampled frames")
|
|
62
|
+
s.add_argument("--slide-threshold", type=int, default=12,
|
|
63
|
+
help="perceptual-hash bit difference that counts as a new slide (lower = more slides)")
|
|
64
|
+
s.add_argument("--min-slide-duration", type=float, default=4.0,
|
|
65
|
+
help="shortest slide in seconds; raise it for live coding to get fewer, fuller slides")
|
|
66
|
+
s.add_argument("--crop", default="auto",
|
|
67
|
+
help="slide area as ffmpeg crop w:h:x:y, 'auto' to have a vision model find it, or 'none' "
|
|
68
|
+
"for the full frame; used for change detection and the saved images, to cut away a "
|
|
69
|
+
"speaker camera or conference banner")
|
|
70
|
+
|
|
71
|
+
m = p.add_argument_group("LLM (used by --crop auto and the report)")
|
|
72
|
+
m.add_argument("--llm", choices=sorted(ADAPTERS), default="claude",
|
|
73
|
+
help="claude runs the Claude Code CLI; ollama is fully local")
|
|
74
|
+
m.add_argument("--llm-model", help="model name for the LLM backend (default: the backend's own default)")
|
|
75
|
+
m.add_argument("--ollama-url", default=DEFAULT_OLLAMA_URL, help="Ollama server used by --llm ollama")
|
|
76
|
+
|
|
77
|
+
r = p.add_argument_group("report")
|
|
78
|
+
r.add_argument("--report", action=argparse.BooleanOptionalAction, default=True,
|
|
79
|
+
help="write report.md with the LLM")
|
|
80
|
+
r.add_argument("--prompt", type=Path, help="Markdown file replacing the report-writing instructions "
|
|
81
|
+
"(default: the bundled prompts/report.md)")
|
|
82
|
+
return p.parse_args(argv)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def main(argv: list[str] | None = None) -> None:
|
|
86
|
+
args = parse_args(argv)
|
|
87
|
+
try:
|
|
88
|
+
run(args)
|
|
89
|
+
except SourceError as e:
|
|
90
|
+
raise SystemExit(f"Error: {e}") from None
|
|
91
|
+
except LLMError as e:
|
|
92
|
+
raise SystemExit(f"Report failed: {e}") from None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _sha256(data: bytes) -> str:
|
|
96
|
+
return hashlib.sha256(data).hexdigest()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def run(args: argparse.Namespace) -> None:
|
|
100
|
+
llm = make_llm(args.llm, args.llm_model, args.ollama_url)
|
|
101
|
+
source = open_source(args.source)
|
|
102
|
+
folder = TalkFolder.for_talk(args.out, source.meta, args.name, args.redo)
|
|
103
|
+
log(f"Output: {folder.root}")
|
|
104
|
+
|
|
105
|
+
params = transcript_params(args.transcript, args.language, args.device, args.whisper_model, args.compute_type)
|
|
106
|
+
segments = folder.cached("transcript", params,
|
|
107
|
+
lambda: get_transcript(source, params, folder.media_dir, args.device))
|
|
108
|
+
|
|
109
|
+
slides = []
|
|
110
|
+
if not args.no_slides:
|
|
111
|
+
if args.crop == "auto":
|
|
112
|
+
result = folder.cached("crop", {"crop": "auto", "llm": llm.name},
|
|
113
|
+
lambda: auto_crop(source.video(folder.media_dir, args.max_height),
|
|
114
|
+
folder.crop_dir, llm))
|
|
115
|
+
crop = result["crop"] if result else None
|
|
116
|
+
mask = result.get("mask") if result else None
|
|
117
|
+
else:
|
|
118
|
+
crop, mask = (None if args.crop == "none" else args.crop), None
|
|
119
|
+
folder.cached("crop", {"crop": args.crop}, lambda: {"crop": crop})
|
|
120
|
+
|
|
121
|
+
def find_slides() -> list[dict]:
|
|
122
|
+
found = detect_slides(source.video(folder.media_dir, args.max_height), folder.slides_dir,
|
|
123
|
+
args.slide_interval, args.slide_threshold, args.min_slide_duration, crop, mask)
|
|
124
|
+
return [{**s, "image": folder.relative(s["image"])} for s in found]
|
|
125
|
+
|
|
126
|
+
params = {"interval": args.slide_interval, "threshold": args.slide_threshold,
|
|
127
|
+
"min_duration": args.min_slide_duration, "max_height": args.max_height, "crop": crop,
|
|
128
|
+
"mask": mask}
|
|
129
|
+
# Slides from before talk-notes.json without a recorded crop were made from the full frame.
|
|
130
|
+
legacy = {**params, "mask": None} if folder.was_adopted("crop") else {**params, "crop": None, "mask": None}
|
|
131
|
+
slides = folder.cached("slides", params, find_slides, legacy_params=legacy)
|
|
132
|
+
|
|
133
|
+
folder.talk_md.write_text(render_markdown(source.meta, slides, segments, source.link))
|
|
134
|
+
folder.finish(args.keep_media)
|
|
135
|
+
|
|
136
|
+
if args.report:
|
|
137
|
+
prompt = report.load_prompt(args.prompt)
|
|
138
|
+
images = [folder.root / s["image"] for s in slides]
|
|
139
|
+
params = {"talk_md": _sha256(folder.talk_md.read_bytes()),
|
|
140
|
+
"slides": _sha256(b"".join(i.read_bytes() for i in images)),
|
|
141
|
+
"prompt": _sha256(prompt.encode()), "llm": llm.name}
|
|
142
|
+
folder.cached("report", params, lambda: report.generate_report(folder.talk_md, images, llm, prompt))
|
|
143
|
+
|
|
144
|
+
log(f"Done: {folder.talk_md}" + (f", {folder.report_md}" if args.report else ""))
|