short-video-studio 0.2.3__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.
Files changed (34) hide show
  1. short_video_studio-0.2.3/LICENSE +21 -0
  2. short_video_studio-0.2.3/PKG-INFO +179 -0
  3. short_video_studio-0.2.3/README.md +160 -0
  4. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/__init__.py +2 -0
  5. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/burn_cards.py +119 -0
  6. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/cli.py +100 -0
  7. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/make_cover.py +117 -0
  8. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/preflight.py +64 -0
  9. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/probe_source.py +82 -0
  10. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/rep_counter.py +159 -0
  11. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/safe_zone_check.py +104 -0
  12. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/sharpest_frames.py +115 -0
  13. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/stats_log.py +133 -0
  14. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/svs_common.py +204 -0
  15. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/svs_text.py +130 -0
  16. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/scripts/to_sdr.py +172 -0
  17. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/templates/CREATOR.md +35 -0
  18. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/templates/LEARNINGS.md +23 -0
  19. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/templates/STOCK.md +17 -0
  20. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/templates/cards.example.json +20 -0
  21. short_video_studio-0.2.3/plugins/short-video-studio/skills/short-video-studio/templates/copy.md +41 -0
  22. short_video_studio-0.2.3/plugins/short-video-studio-tr/skills/kisa-video-studyosu/templates/CREATOR.md +35 -0
  23. short_video_studio-0.2.3/plugins/short-video-studio-tr/skills/kisa-video-studyosu/templates/LEARNINGS.md +23 -0
  24. short_video_studio-0.2.3/plugins/short-video-studio-tr/skills/kisa-video-studyosu/templates/STOCK.md +17 -0
  25. short_video_studio-0.2.3/plugins/short-video-studio-tr/skills/kisa-video-studyosu/templates/cards.example.json +20 -0
  26. short_video_studio-0.2.3/plugins/short-video-studio-tr/skills/kisa-video-studyosu/templates/copy.md +41 -0
  27. short_video_studio-0.2.3/pyproject.toml +40 -0
  28. short_video_studio-0.2.3/setup.cfg +4 -0
  29. short_video_studio-0.2.3/short_video_studio.egg-info/PKG-INFO +179 -0
  30. short_video_studio-0.2.3/short_video_studio.egg-info/SOURCES.txt +32 -0
  31. short_video_studio-0.2.3/short_video_studio.egg-info/dependency_links.txt +1 -0
  32. short_video_studio-0.2.3/short_video_studio.egg-info/entry_points.txt +2 -0
  33. short_video_studio-0.2.3/short_video_studio.egg-info/requires.txt +2 -0
  34. short_video_studio-0.2.3/short_video_studio.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ilteriskeskin and short-video-studio 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,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: short-video-studio
3
+ Version: 0.2.3
4
+ Summary: Tools for producing Reels, Shorts and TikToks from real footage: HDR to SDR, sharpest frames, safe zones, text cards, covers, rep counter, stats log.
5
+ Author: ilteriskeskin
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ilteriskeskin/short-video-studio
8
+ Project-URL: Issues, https://github.com/ilteriskeskin/short-video-studio/issues
9
+ Keywords: reels,shorts,tiktok,ffmpeg,video,claude,content-creation
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Multimedia :: Video
12
+ Classifier: Environment :: Console
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: numpy>=1.21
17
+ Requires-Dist: Pillow>=9.2
18
+ Dynamic: license-file
19
+
20
+ # Short Video Studio
21
+
22
+ <p align="center"><img src="https://raw.githubusercontent.com/ilteriskeskin/short-video-studio/main/docs/demo.gif" width="300" alt="Demo: iPhone HDR fix, sharpest cover frame, safe zones and text cards on real footage"></p>
23
+
24
+ **A Claude skill that works like a short-form video producer, not a caption generator.**
25
+ It plans, briefs, edits and reviews Instagram Reels, YouTube Shorts and TikTok videos
26
+ *on your real footage*, and it keeps a rulebook that learns from your corrections.
27
+
28
+ [Türkçe README](README.tr.md)
29
+
30
+ Most "social media" skills write scripts and stop there. This one was distilled from
31
+ ~6 months of real production on [@joryu.art](https://www.instagram.com/joryu.art/)
32
+ (martial arts, Turkish-language, ~230K monthly views) and ships the tools that production actually needed:
33
+
34
+ | Problem | Tool |
35
+ |---|---|
36
+ | iPhone HDR clips look washed out or blown out after editing | `to_sdr.py`: HLG/PQ → SDR BT.709, full resolution |
37
+ | Blurry cover / teaser frames from action footage | `sharpest_frames.py`: ranks frames by sharpness, exports the best |
38
+ | Text hidden under the app UI or cut off on the profile grid | `safe_zone_check.py`: draws UI zones and the 3:4 profile crop |
39
+ | On-screen counters with the wrong number | `rep_counter.py`: draft count from audio/motion + counter overlay |
40
+ | Text cards with missing Turkish/Japanese glyphs | `burn_cards.py`: timed cards, accent words, CJK-safe |
41
+ | Covers that don't say what the video is | `make_cover.py`: 1080x1920 cover / teaser, text kept inside the 3:4 crop |
42
+ | "Lots of views, no followers" | `stats_log.py`: skip rate, watch ratio, visit→follow vs your own baseline |
43
+
44
+ And the knowledge: which openings worked (with numbers), pacing and length rules,
45
+ platform-specific copy, cover and teaser rules, how to read stats, and honesty rules
46
+ that protect a creator's credibility. See
47
+ [the case study](plugins/short-video-studio/skills/short-video-studio/references/case-study.md).
48
+
49
+ ## How it works
50
+
51
+ ```
52
+ plan → shoot brief → ingest (probe, HDR fix) → OPENING FIRST → edit (cards, speed, counter)
53
+ → cover + teaser → platform copy → you publish → read stats → write the lesson
54
+ ```
55
+
56
+ The skill keeps a few plain files in your content folder:
57
+
58
+ - `CREATOR.md`: your voice, niche, schedule, boundaries (people who must never appear, etc.)
59
+ - `LEARNINGS.md`: numbered rules learned from your corrections; read before every task
60
+ - `STOCK.md`: every video's status and the calendar
61
+ - `stats.csv`: checkpoint stats per video
62
+
63
+ You stay in control: **Claude never publishes, schedules, buys or deletes your raw footage.**
64
+
65
+ ## Install
66
+
67
+ ### Claude Code (recommended: the tools need ffmpeg and file access)
68
+
69
+ ```bash
70
+ /plugin install short-video-studio --marketplace ilteriskeskin/short-video-studio # English
71
+ /plugin install short-video-studio-tr --marketplace ilteriskeskin/short-video-studio # Türkçe
72
+ ```
73
+ On older Claude Code versions: `/plugin marketplace add ilteriskeskin/short-video-studio`, then
74
+ `/plugin install short-video-studio@short-video-studio`.
75
+ Install one edition, not both (they would both trigger).
76
+
77
+ Or copy a skill folder manually:
78
+ ```bash
79
+ cp -r plugins/short-video-studio/skills/short-video-studio ~/.claude/skills/
80
+ ```
81
+
82
+ ### Claude.ai / Claude Desktop
83
+ Download `short-video-studio.zip` (or `kisa-video-studyosu.zip`) from Releases and upload
84
+ it under **Settings → Capabilities → Skills** (code execution must be on). The writing,
85
+ planning and stats parts work everywhere; video tools need an environment with ffmpeg
86
+ and access to your files, so Claude Code or Cowork on your own computer is the best fit.
87
+
88
+ ### Requirements for the tools
89
+ - ffmpeg + ffprobe (`brew install ffmpeg` / `apt install ffmpeg` / `winget install ffmpeg`)
90
+ - Python 3.9+ with `numpy` and `Pillow` (`python3 -m pip install numpy Pillow`)
91
+ - Check everything: `python3 scripts/preflight.py`
92
+
93
+ ## Commands
94
+
95
+ After installing the plugin, these slash commands are available in Claude Code:
96
+
97
+ | Command | Does |
98
+ |---|---|
99
+ | `/short-video-studio:setup` | Creates `CREATOR.md`, `LEARNINGS.md`, `STOCK.md` in your content folder, checks tools, asks a few questions |
100
+ | `/short-video-studio:new-video <clip or idea>` | Full pipeline, stops for you to pick the opening |
101
+ | `/short-video-studio:cover <video>` | Sharpest frame → cover (and teaser) |
102
+ | `/short-video-studio:stats <video> <numbers or screenshots>` | Logs stats and diagnoses against your own baseline |
103
+ | `/short-video-studio:lesson <correction>` | Turns your correction into a permanent rule |
104
+ | `/short-video-studio:review <video>` | Pre-publish check: format, colour, cards, safe zones, numbers |
105
+
106
+ ## Automation (hooks)
107
+
108
+ - **Session start:** when you open Claude Code in a content folder, `CREATOR.md` and
109
+ `LEARNINGS.md` are loaded automatically, so your rules are never forgotten. Silent in
110
+ any other folder.
111
+ - **After rendering:** when cards or a cover are rendered, a safe-zone preview is drawn
112
+ automatically and Claude is told to check it before showing you the result.
113
+
114
+ ## Use the tools without Claude: `svs`
115
+
116
+ The same tools ship as a normal command-line program:
117
+
118
+ ```bash
119
+ pipx install git+https://github.com/ilteriskeskin/short-video-studio
120
+ svs init my-content --lang en # workspace files
121
+ svs preflight
122
+ svs probe clip.MOV
123
+ svs to-sdr clip.MOV clip_sdr.mp4
124
+ svs sharpest clip_sdr.mp4 --top 6
125
+ svs cards clip_sdr.mp4 cards.json final.mp4
126
+ svs cover still.jpg cover.jpg --lines "A SWORD HAS ONE EDGE" "THE STAFF HAS *TWO*"
127
+ svs count final.mp4 --counter-start 205 --counter-out counter.json
128
+ svs stats add --video 07 --hours 6 --views 1379 --avg-watch 8 --length 52 --skip-rate 37.7
129
+ ```
130
+ ## Try it
131
+
132
+ > "Here is this morning's training clip (`stock/07_kicks/IMG_1234.MOV`). What should the
133
+ > opening be? Then make the cover."
134
+
135
+ > "Yesterday's reel: 1,343 views, 6 s average on 19.5 s, 49% skip rate, 16 profile
136
+ > visits, 1 follow. What went wrong?"
137
+
138
+ > "Count the strikes in this clip, my total before today was 205, and add a counter."
139
+
140
+ ## Repository layout
141
+
142
+ ```
143
+ .claude-plugin/marketplace.json two plugins: English and Turkish editions
144
+ plugins/short-video-studio/ English plugin (commands/, hooks/, skills/)
145
+ skills/short-video-studio/
146
+ SKILL.md the workflow and hard rules
147
+ references/ hooks, editing, ffmpeg, covers, copy, planning, stats, honesty, case study
148
+ scripts/ the tools (source of truth)
149
+ templates/ CREATOR, LEARNINGS, STOCK, copy, cards example
150
+ niches/ domain packs (martial-arts is the reference pack)
151
+ evals/ trigger and behaviour checks
152
+ plugins/short-video-studio-tr/ Turkish plugin (same structure, kisa-video-studyosu)
153
+ tools/ selftest, script sync, zip builder
154
+ pyproject.toml the `svs` CLI package (built from the English skill's scripts/)
155
+ ```
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ tools/selftest.sh # runs every script on synthetic footage
161
+ tools/sync_scripts.sh # copy scripts and hooks from the English plugin to the Turkish one
162
+ tools/build_zips.sh # dist/*.zip for claude.ai upload
163
+ claude plugin validate . # validate the marketplace and plugins
164
+ ```
165
+
166
+ ## Contributing
167
+
168
+ Niche packs are the easiest and most valuable contribution: what works and fails for
169
+ fitness, cooking, dance, climbing, crafts... See [CONTRIBUTING.md](CONTRIBUTING.md).
170
+
171
+ ## Author
172
+
173
+ Built by **[@joryu.art](https://www.instagram.com/joryu.art/)**, an aikido and jo creator who
174
+ produces Reels, Shorts and TikToks with this exact workflow. The numbers in the case study
175
+ come from that account, so you can see the videos they describe.
176
+
177
+ ## License
178
+
179
+ MIT
@@ -0,0 +1,160 @@
1
+ # Short Video Studio
2
+
3
+ <p align="center"><img src="https://raw.githubusercontent.com/ilteriskeskin/short-video-studio/main/docs/demo.gif" width="300" alt="Demo: iPhone HDR fix, sharpest cover frame, safe zones and text cards on real footage"></p>
4
+
5
+ **A Claude skill that works like a short-form video producer, not a caption generator.**
6
+ It plans, briefs, edits and reviews Instagram Reels, YouTube Shorts and TikTok videos
7
+ *on your real footage*, and it keeps a rulebook that learns from your corrections.
8
+
9
+ [Türkçe README](README.tr.md)
10
+
11
+ Most "social media" skills write scripts and stop there. This one was distilled from
12
+ ~6 months of real production on [@joryu.art](https://www.instagram.com/joryu.art/)
13
+ (martial arts, Turkish-language, ~230K monthly views) and ships the tools that production actually needed:
14
+
15
+ | Problem | Tool |
16
+ |---|---|
17
+ | iPhone HDR clips look washed out or blown out after editing | `to_sdr.py`: HLG/PQ → SDR BT.709, full resolution |
18
+ | Blurry cover / teaser frames from action footage | `sharpest_frames.py`: ranks frames by sharpness, exports the best |
19
+ | Text hidden under the app UI or cut off on the profile grid | `safe_zone_check.py`: draws UI zones and the 3:4 profile crop |
20
+ | On-screen counters with the wrong number | `rep_counter.py`: draft count from audio/motion + counter overlay |
21
+ | Text cards with missing Turkish/Japanese glyphs | `burn_cards.py`: timed cards, accent words, CJK-safe |
22
+ | Covers that don't say what the video is | `make_cover.py`: 1080x1920 cover / teaser, text kept inside the 3:4 crop |
23
+ | "Lots of views, no followers" | `stats_log.py`: skip rate, watch ratio, visit→follow vs your own baseline |
24
+
25
+ And the knowledge: which openings worked (with numbers), pacing and length rules,
26
+ platform-specific copy, cover and teaser rules, how to read stats, and honesty rules
27
+ that protect a creator's credibility. See
28
+ [the case study](plugins/short-video-studio/skills/short-video-studio/references/case-study.md).
29
+
30
+ ## How it works
31
+
32
+ ```
33
+ plan → shoot brief → ingest (probe, HDR fix) → OPENING FIRST → edit (cards, speed, counter)
34
+ → cover + teaser → platform copy → you publish → read stats → write the lesson
35
+ ```
36
+
37
+ The skill keeps a few plain files in your content folder:
38
+
39
+ - `CREATOR.md`: your voice, niche, schedule, boundaries (people who must never appear, etc.)
40
+ - `LEARNINGS.md`: numbered rules learned from your corrections; read before every task
41
+ - `STOCK.md`: every video's status and the calendar
42
+ - `stats.csv`: checkpoint stats per video
43
+
44
+ You stay in control: **Claude never publishes, schedules, buys or deletes your raw footage.**
45
+
46
+ ## Install
47
+
48
+ ### Claude Code (recommended: the tools need ffmpeg and file access)
49
+
50
+ ```bash
51
+ /plugin install short-video-studio --marketplace ilteriskeskin/short-video-studio # English
52
+ /plugin install short-video-studio-tr --marketplace ilteriskeskin/short-video-studio # Türkçe
53
+ ```
54
+ On older Claude Code versions: `/plugin marketplace add ilteriskeskin/short-video-studio`, then
55
+ `/plugin install short-video-studio@short-video-studio`.
56
+ Install one edition, not both (they would both trigger).
57
+
58
+ Or copy a skill folder manually:
59
+ ```bash
60
+ cp -r plugins/short-video-studio/skills/short-video-studio ~/.claude/skills/
61
+ ```
62
+
63
+ ### Claude.ai / Claude Desktop
64
+ Download `short-video-studio.zip` (or `kisa-video-studyosu.zip`) from Releases and upload
65
+ it under **Settings → Capabilities → Skills** (code execution must be on). The writing,
66
+ planning and stats parts work everywhere; video tools need an environment with ffmpeg
67
+ and access to your files, so Claude Code or Cowork on your own computer is the best fit.
68
+
69
+ ### Requirements for the tools
70
+ - ffmpeg + ffprobe (`brew install ffmpeg` / `apt install ffmpeg` / `winget install ffmpeg`)
71
+ - Python 3.9+ with `numpy` and `Pillow` (`python3 -m pip install numpy Pillow`)
72
+ - Check everything: `python3 scripts/preflight.py`
73
+
74
+ ## Commands
75
+
76
+ After installing the plugin, these slash commands are available in Claude Code:
77
+
78
+ | Command | Does |
79
+ |---|---|
80
+ | `/short-video-studio:setup` | Creates `CREATOR.md`, `LEARNINGS.md`, `STOCK.md` in your content folder, checks tools, asks a few questions |
81
+ | `/short-video-studio:new-video <clip or idea>` | Full pipeline, stops for you to pick the opening |
82
+ | `/short-video-studio:cover <video>` | Sharpest frame → cover (and teaser) |
83
+ | `/short-video-studio:stats <video> <numbers or screenshots>` | Logs stats and diagnoses against your own baseline |
84
+ | `/short-video-studio:lesson <correction>` | Turns your correction into a permanent rule |
85
+ | `/short-video-studio:review <video>` | Pre-publish check: format, colour, cards, safe zones, numbers |
86
+
87
+ ## Automation (hooks)
88
+
89
+ - **Session start:** when you open Claude Code in a content folder, `CREATOR.md` and
90
+ `LEARNINGS.md` are loaded automatically, so your rules are never forgotten. Silent in
91
+ any other folder.
92
+ - **After rendering:** when cards or a cover are rendered, a safe-zone preview is drawn
93
+ automatically and Claude is told to check it before showing you the result.
94
+
95
+ ## Use the tools without Claude: `svs`
96
+
97
+ The same tools ship as a normal command-line program:
98
+
99
+ ```bash
100
+ pipx install git+https://github.com/ilteriskeskin/short-video-studio
101
+ svs init my-content --lang en # workspace files
102
+ svs preflight
103
+ svs probe clip.MOV
104
+ svs to-sdr clip.MOV clip_sdr.mp4
105
+ svs sharpest clip_sdr.mp4 --top 6
106
+ svs cards clip_sdr.mp4 cards.json final.mp4
107
+ svs cover still.jpg cover.jpg --lines "A SWORD HAS ONE EDGE" "THE STAFF HAS *TWO*"
108
+ svs count final.mp4 --counter-start 205 --counter-out counter.json
109
+ svs stats add --video 07 --hours 6 --views 1379 --avg-watch 8 --length 52 --skip-rate 37.7
110
+ ```
111
+ ## Try it
112
+
113
+ > "Here is this morning's training clip (`stock/07_kicks/IMG_1234.MOV`). What should the
114
+ > opening be? Then make the cover."
115
+
116
+ > "Yesterday's reel: 1,343 views, 6 s average on 19.5 s, 49% skip rate, 16 profile
117
+ > visits, 1 follow. What went wrong?"
118
+
119
+ > "Count the strikes in this clip, my total before today was 205, and add a counter."
120
+
121
+ ## Repository layout
122
+
123
+ ```
124
+ .claude-plugin/marketplace.json two plugins: English and Turkish editions
125
+ plugins/short-video-studio/ English plugin (commands/, hooks/, skills/)
126
+ skills/short-video-studio/
127
+ SKILL.md the workflow and hard rules
128
+ references/ hooks, editing, ffmpeg, covers, copy, planning, stats, honesty, case study
129
+ scripts/ the tools (source of truth)
130
+ templates/ CREATOR, LEARNINGS, STOCK, copy, cards example
131
+ niches/ domain packs (martial-arts is the reference pack)
132
+ evals/ trigger and behaviour checks
133
+ plugins/short-video-studio-tr/ Turkish plugin (same structure, kisa-video-studyosu)
134
+ tools/ selftest, script sync, zip builder
135
+ pyproject.toml the `svs` CLI package (built from the English skill's scripts/)
136
+ ```
137
+
138
+ ## Development
139
+
140
+ ```bash
141
+ tools/selftest.sh # runs every script on synthetic footage
142
+ tools/sync_scripts.sh # copy scripts and hooks from the English plugin to the Turkish one
143
+ tools/build_zips.sh # dist/*.zip for claude.ai upload
144
+ claude plugin validate . # validate the marketplace and plugins
145
+ ```
146
+
147
+ ## Contributing
148
+
149
+ Niche packs are the easiest and most valuable contribution: what works and fails for
150
+ fitness, cooking, dance, climbing, crafts... See [CONTRIBUTING.md](CONTRIBUTING.md).
151
+
152
+ ## Author
153
+
154
+ Built by **[@joryu.art](https://www.instagram.com/joryu.art/)**, an aikido and jo creator who
155
+ produces Reels, Shorts and TikToks with this exact workflow. The numbers in the case study
156
+ come from that account, so you can see the videos they describe.
157
+
158
+ ## License
159
+
160
+ MIT
@@ -0,0 +1,2 @@
1
+ """short-video-studio tools (also usable as the `svs` command)."""
2
+ __version__ = "0.2.3"
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env python3
2
+ """Burn timed text cards (hook, facts, counter, end card) onto a vertical video.
3
+
4
+ Cards are rendered with Pillow (works with any ffmpeg build, handles Turkish
5
+ and CJK glyphs) and overlaid with ffmpeg. Audio is copied untouched.
6
+
7
+ cards.json:
8
+ {
9
+ "style": {"size": 0.062, "y": 0.17, "color": "#FFFFFF", "accent": "#C9341F",
10
+ "align": "center", "shadow": true, "stroke": 0, "box": null,
11
+ "upper": true, "lang": "en"},
12
+ "cards": [
13
+ {"start": 0.0, "end": 2.6, "lines": ["WAR RECORDS SAY", "SAMURAI WERE WOUNDED", "BY *ARROWS*, NOT SWORDS."]},
14
+ {"start": 10.7, "end": 14.1, "lines": ["NEXT: SPEAR OR BOW?"], "y": 0.5, "size": 0.07}
15
+ ]
16
+ }
17
+ size = font size as a fraction of video width (auto-shrinks to fit 86% width)
18
+ y = vertical centre of the block as a fraction of height (keep 0.12-0.75)
19
+ *word* = accent colour; "upper": true uppercases (Turkish-aware when lang = "tr")
20
+
21
+ Usage: python3 burn_cards.py IN.mp4 cards.json OUT.mp4 [--font F] [--cjk-font F] [--crf 17] [--allow-hdr]
22
+ """
23
+ import argparse
24
+ import json
25
+ import os
26
+ import shutil
27
+ import subprocess
28
+ import tempfile
29
+
30
+ try:
31
+ from .svs_common import die, display_size, duration, has_audio, hdr_kind, need, need_pillow, probe, tr_upper, video_stream
32
+ except ImportError:
33
+ from svs_common import die, display_size, duration, has_audio, hdr_kind, need, need_pillow, probe, tr_upper, video_stream
34
+ try:
35
+ from .svs_text import draw_block, fit_size
36
+ except ImportError:
37
+ from svs_text import draw_block, fit_size
38
+
39
+ Image, _, _ = need_pillow()
40
+
41
+
42
+ def main():
43
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
44
+ ap.add_argument("src")
45
+ ap.add_argument("cards")
46
+ ap.add_argument("dst")
47
+ ap.add_argument("--font", default=None)
48
+ ap.add_argument("--cjk-font", default=None)
49
+ ap.add_argument("--crf", type=int, default=17)
50
+ ap.add_argument("--allow-hdr", action="store_true")
51
+ ap.add_argument("--keep-png", action="store_true", help="keep rendered card PNGs for review")
52
+ a = ap.parse_args()
53
+
54
+ need("ffmpeg", "ffprobe")
55
+ info = probe(a.src)
56
+ vs = video_stream(info)
57
+ if hdr_kind(vs) and not a.allow_hdr:
58
+ die("source is HDR; convert it with to_sdr.py first (or pass --allow-hdr if you know why)")
59
+ W, H = display_size(vs)
60
+
61
+ with open(a.cards, encoding="utf-8") as fh:
62
+ spec = json.load(fh)
63
+ base = {"size": 0.062, "y": 0.17, "color": "#FFFFFF", "accent": "#C9341F", "align": "center",
64
+ "shadow": True, "stroke": 0, "box": None, "upper": True, "lang": "en"}
65
+ base.update(spec.get("style", {}))
66
+ cards = spec.get("cards", [])
67
+ if not cards:
68
+ die("no cards in JSON")
69
+
70
+ tmpdir = tempfile.mkdtemp(prefix="svs_cards_")
71
+ pngs = []
72
+ for i, c in enumerate(cards):
73
+ st = dict(base, **{k: v for k, v in c.items() if k not in ("start", "end", "lines")})
74
+ lines = c["lines"]
75
+ if st["upper"]:
76
+ lines = [tr_upper(ln) if st["lang"] == "tr" else ln.upper() for ln in lines]
77
+ if not (0.10 <= st["y"] <= 0.78):
78
+ print(f"WARNING card {i}: y={st['y']} is inside a platform UI zone")
79
+ img = Image.new("RGBA", (W, H), (0, 0, 0, 0))
80
+ fonts = fit_size(img, lines, int(W * st["size"]), latin=a.font, cjk=a.cjk_font)
81
+ draw_block(img, lines, st["y"], fonts, st["color"], st["accent"], st["align"],
82
+ st["shadow"], st["stroke"], box=st["box"])
83
+ p = os.path.join(tmpdir, f"card_{i:03d}.png")
84
+ img.save(p)
85
+ pngs.append((p, float(c["start"]), float(c["end"])))
86
+
87
+ # Each card PNG is looped for the whole video and placed on the timeline with enable=.
88
+ # A single-frame PNG input (no -loop) is NOT reliable: on some sources every card that
89
+ # doesn't start at 0 s silently never appears.
90
+ total = duration(info)
91
+ cmd = ["ffmpeg", "-y", "-hide_banner", "-loglevel", "error", "-stats", "-i", a.src]
92
+ for p, _, _ in pngs:
93
+ cmd += ["-loop", "1", "-t", f"{total:.3f}", "-i", p]
94
+ chain, last = [], "0:v"
95
+ for i, (_, s, e) in enumerate(pngs, 1):
96
+ out = f"v{i}"
97
+ chain.append(f"[{last}][{i}:v]overlay=0:0:eof_action=pass:enable='between(t,{s:.3f},{e:.3f})'[{out}]")
98
+ last = out
99
+ chain.append(f"[{last}]format=yuv420p,setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709:range=tv[vout]")
100
+ script = os.path.join(tmpdir, "filter.txt")
101
+ with open(script, "w") as fh:
102
+ fh.write(";\n".join(chain))
103
+ cmd += ["-filter_complex_script", script, "-map", "[vout]"]
104
+ if has_audio(info):
105
+ cmd += ["-map", "0:a:0", "-c:a", "copy"]
106
+ cmd += ["-c:v", "libx264", "-preset", "slow", "-crf", str(a.crf),
107
+ "-color_primaries", "bt709", "-color_trc", "bt709", "-colorspace", "bt709",
108
+ "-movflags", "+faststart", a.dst]
109
+ subprocess.run(cmd, check=True)
110
+
111
+ if a.keep_png:
112
+ print(f"Card PNGs kept in {tmpdir}")
113
+ else:
114
+ shutil.rmtree(tmpdir, ignore_errors=True)
115
+ print(f"OK -> {a.dst} ({len(pngs)} cards). Review frame by frame: no clipped words, no text on faces.")
116
+
117
+
118
+ if __name__ == "__main__":
119
+ main()
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env python3
2
+ """svs: the short-video-studio tools as one command, usable with or without Claude.
3
+
4
+ svs init [DIR] [--lang en|tr] create CREATOR.md, LEARNINGS.md, STOCK.md, stock/ in a content folder
5
+ svs preflight check ffmpeg, numpy, Pillow, fonts, free disk
6
+ svs probe CLIP... size, fps, colour, HDR, what to do next
7
+ svs to-sdr IN OUT HDR (iPhone HLG / PQ) -> SDR BT.709
8
+ svs sharpest CLIP export the sharpest frames (cover/teaser candidates)
9
+ svs safe-zone IMAGE_OR_CLIP draw platform UI zones / 3:4 profile crop
10
+ svs count CLIP draft rep/strike count, optional counter cards
11
+ svs cards IN cards.json OUT burn timed text cards
12
+ svs cover STILL OUT --lines ... make a 1080x1920 cover or teaser
13
+ svs stats add|report ... log and compare video stats
14
+
15
+ Run `svs <command> --help` for options.
16
+ """
17
+ import importlib
18
+ import shutil
19
+ import sys
20
+ from pathlib import Path
21
+
22
+ try:
23
+ from . import __version__
24
+ except ImportError:
25
+ __version__ = "0.2.3"
26
+
27
+ COMMANDS = {
28
+ "preflight": "preflight",
29
+ "probe": "probe_source",
30
+ "to-sdr": "to_sdr",
31
+ "sharpest": "sharpest_frames",
32
+ "safe-zone": "safe_zone_check",
33
+ "count": "rep_counter",
34
+ "cards": "burn_cards",
35
+ "cover": "make_cover",
36
+ "stats": "stats_log",
37
+ }
38
+
39
+
40
+ def _module(name: str):
41
+ if __package__:
42
+ return importlib.import_module(f".{name}", __package__)
43
+ sys.path.insert(0, str(Path(__file__).resolve().parent))
44
+ return importlib.import_module(name)
45
+
46
+
47
+ def _templates(lang: str) -> Path:
48
+ here = Path(__file__).resolve().parent
49
+ packaged = here / f"templates_{lang}" # installed with pip/pipx
50
+ if (packaged / "CREATOR.md").exists():
51
+ return packaged
52
+ return here.parent / "templates" # running from inside the skill folder
53
+
54
+
55
+ def cmd_init(argv):
56
+ import argparse
57
+ ap = argparse.ArgumentParser(prog="svs init", description="Create the workspace files in a content folder.")
58
+ ap.add_argument("dir", nargs="?", default=".")
59
+ ap.add_argument("--lang", choices=["en", "tr"], default="en")
60
+ a = ap.parse_args(argv)
61
+ src = _templates(a.lang)
62
+ dst = Path(a.dir)
63
+ (dst / "stock").mkdir(parents=True, exist_ok=True)
64
+ for name in ("CREATOR.md", "LEARNINGS.md", "STOCK.md"):
65
+ target = dst / name
66
+ if target.exists():
67
+ print(f" kept {target} (already exists)")
68
+ else:
69
+ shutil.copy(src / name, target)
70
+ print(f" created {target}")
71
+ for name in ("copy.md", "cards.example.json"):
72
+ target = dst / "stock" / f"_{name}"
73
+ if not target.exists():
74
+ shutil.copy(src / name, target)
75
+ print(f" created {target}")
76
+ print("Next: fill CREATOR.md, then run `svs preflight`.")
77
+
78
+
79
+ def main(argv=None):
80
+ argv = list(sys.argv[1:] if argv is None else argv)
81
+ if not argv or argv[0] in ("-h", "--help", "help"):
82
+ print(__doc__)
83
+ return 0
84
+ if argv[0] in ("-V", "--version"):
85
+ print(f"svs {__version__}")
86
+ return 0
87
+ cmd, rest = argv[0], argv[1:]
88
+ if cmd == "init":
89
+ cmd_init(rest)
90
+ return 0
91
+ if cmd not in COMMANDS:
92
+ print(f"unknown command: {cmd}\n{__doc__}", file=sys.stderr)
93
+ return 2
94
+ mod = _module(COMMANDS[cmd])
95
+ sys.argv = [f"svs {cmd}"] + rest
96
+ return mod.main() or 0
97
+
98
+
99
+ if __name__ == "__main__":
100
+ sys.exit(main())