@makemidas/cli 0.11.1 → 0.12.1
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.
- package/README.md +11 -8
- package/dist/api.js +3 -1
- package/dist/args.js +11 -1
- package/dist/captions.js +24 -20
- package/dist/cli.js +4 -2
- package/dist/config.js +1 -1
- package/dist/cut.js +1 -1
- package/dist/words.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ makemidas film new "a 15-second social video for our mugs" --style social --max-
|
|
|
36
36
|
| `music "<prompt>"` | Generate a song or track (`--lyrics`, `--title`, `--instrumental`, `--duration`) |
|
|
37
37
|
| `sfx "<prompt>"` | Generate a sound effect (`--loop`, `--bpm`; the model sets the length) |
|
|
38
38
|
| `speech "<text>"` (alias `voiceover`) | Turn text into a voiceover (`--voice`; `--delivery` on Gemini TTS, `--speed`/`--stability` on ElevenLabs) |
|
|
39
|
-
| `transcribe <file\|url\|fileId>` | Upload audio or video, transcribe it and save the transcript (`--format txt\|srt\|vtt\|json`, `--title`);
|
|
39
|
+
| `transcribe <file\|url\|fileId>` | Upload audio or video, transcribe it and save the transcript (`--format txt\|srt\|vtt\|json`, `--title`); the JSON also times every word (`words: [{ word, start, end, speaker? }]`) |
|
|
40
40
|
| `remove-bg <image>` | Remove the background; saves a transparent WebP |
|
|
41
41
|
| `upscale <image> [--scale 1\|2\|4\|8]` | Upscale an image (1 sharpens at the same size; default 2) |
|
|
42
42
|
| `upscale-video <video> [--resolution 1080P\|2K\|4K]` | Upscale an MP4 or MOV clip of up to 60 s (default 2K) |
|
|
@@ -61,7 +61,7 @@ makemidas film new "a 15-second social video for our mugs" --style social --max-
|
|
|
61
61
|
| `models [image\|video\|audio\|transcription\|edit] [--for <use>]` | Model ids, options and credit prices; `--for draft\|final\|edit\|text\|references\|first-last\|sound` lists the image and video models good for that job |
|
|
62
62
|
| `models <id>` | One model: options, defaults, voices, prices and an example request |
|
|
63
63
|
| `estimate <command> "<prompt>"\|<file>` | Price a request without charging; `<command>` is `image`, `video`, `music`, `sfx`, `speech`, `transcribe`, `remove-bg`, `upscale`, `upscale-video` or `avatar`, with that command's options |
|
|
64
|
-
| `captions <video> --transcript <t.json> [--max-words n] [--no-render]` | Word-by-word captions burned into a video on your computer (HyperFrames and FFmpeg), the spoken word lit; free ([below](#captions-and-cuts-on-your-computer)) |
|
|
64
|
+
| `captions <video> --transcript <t.json> [--max-words n] [--position auto\|bottom\|middle\|top] [--no-render]` | Word-by-word captions burned into a video on your computer (HyperFrames and FFmpeg), the spoken word lit; free ([below](#captions-and-cuts-on-your-computer)) |
|
|
65
65
|
| `cut <video\|audio> --transcript <t.json> --list \| --remove 3,12-18 \| --fillers \| --gaps <s>` | Cut a recording on its words with FFmpeg and write the cut's transcript; free |
|
|
66
66
|
| `frames <video\|url> [--count 1-16] [--width 120-1920]` | Stills evenly spread over a clip and one contact sheet (`<name>-frames/sheet.jpg`), made on your computer with FFmpeg; free, nothing is sent |
|
|
67
67
|
| `feedback "<message>" [--kind bug\|quality\|feature\|praise\|other] [--generation <id>]` | Send feedback to the MakeMidas team (`quality`: a result clearly short of the request) |
|
|
@@ -126,13 +126,13 @@ command again.
|
|
|
126
126
|
## Captions and cuts on your computer
|
|
127
127
|
|
|
128
128
|
`captions` and `cut` work on a local file with its transcript, and send
|
|
129
|
-
nothing to MakeMidas. The transcript is the JSON `transcribe` saves
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
nothing to MakeMidas. The transcript is the JSON `transcribe` saves
|
|
130
|
+
(`--format json`), where every word has its own time with either model. A
|
|
131
|
+
Whisper transcript made before 2026-12-05 has sentence times only, so its
|
|
132
|
+
word times are estimated; transcribe it again for exact ones.
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
makemidas transcribe talk.mp4
|
|
135
|
+
makemidas transcribe talk.mp4 --format json # talk.json (paid)
|
|
136
136
|
makemidas cut talk.mp4 --transcript talk.json --list # numbered words
|
|
137
137
|
makemidas cut talk.mp4 --transcript talk.json --remove 41-58 --fillers --gaps 0.4
|
|
138
138
|
makemidas captions talk-cut.mp4 --transcript talk-cut.json
|
|
@@ -145,7 +145,10 @@ makemidas captions talk-cut.mp4 --transcript talk-cut.json
|
|
|
145
145
|
- `captions` makes `<name>-captions/`, a HyperFrames project of the captions
|
|
146
146
|
layer, renders it and lays it over the video into `<name>-captions.mp4`; the
|
|
147
147
|
picture and sound are otherwise untouched. A few words show at a time and
|
|
148
|
-
the spoken one lights up gold; `--max-words` sets how many.
|
|
148
|
+
the spoken one lights up gold; `--max-words` sets how many. `--position`
|
|
149
|
+
places them: `auto` (default: on tall video clear of the buttons TikTok,
|
|
150
|
+
Reels and Shorts draw, on wide video near the bottom), `bottom`, `middle`
|
|
151
|
+
or `top`, for when they cover the product or a face. Edit the look in
|
|
149
152
|
the project's `index.html` and run `npm run render` there to make it again.
|
|
150
153
|
Needs Node.js 22+ and FFmpeg; the first render downloads a headless Chrome,
|
|
151
154
|
and rendering takes a few seconds per second of video.
|
package/dist/api.js
CHANGED
|
@@ -417,7 +417,9 @@ export class Api {
|
|
|
417
417
|
form.append('file', new Blob([bytes], { type }), opts.name ?? basename(source));
|
|
418
418
|
const saved = await this.json('/assets', { method: 'POST', form });
|
|
419
419
|
if (opts.tags?.length) {
|
|
420
|
-
|
|
420
|
+
// PATCH answers { asset }, not the asset itself.
|
|
421
|
+
const patched = await this.json(`/assets/${encodeURIComponent(saved.asset.id)}`, { method: 'PATCH', json: { tags: opts.tags } });
|
|
422
|
+
saved.asset = patched.asset;
|
|
421
423
|
}
|
|
422
424
|
return saved;
|
|
423
425
|
}
|
package/dist/args.js
CHANGED
|
@@ -87,6 +87,7 @@ export function parse(argv) {
|
|
|
87
87
|
fillers: { type: 'boolean', default: false },
|
|
88
88
|
gaps: { type: 'string' },
|
|
89
89
|
'max-words': { type: 'string' },
|
|
90
|
+
position: { type: 'string' },
|
|
90
91
|
'no-render': { type: 'boolean', default: false },
|
|
91
92
|
subtitles: { type: 'string' },
|
|
92
93
|
'title-card': { type: 'string' },
|
|
@@ -288,10 +289,19 @@ export function sourceArg(rest, command, what) {
|
|
|
288
289
|
}
|
|
289
290
|
return rest[0];
|
|
290
291
|
}
|
|
292
|
+
/** `--position` for captions: auto (default), bottom, middle or top. */
|
|
293
|
+
export function captionPosition(value) {
|
|
294
|
+
if (value === undefined)
|
|
295
|
+
return 'auto';
|
|
296
|
+
if (value === 'auto' || value === 'bottom' || value === 'middle' || value === 'top') {
|
|
297
|
+
return value;
|
|
298
|
+
}
|
|
299
|
+
throw usageError('--position must be auto, bottom, middle or top.');
|
|
300
|
+
}
|
|
291
301
|
/** `--transcript` for captions and cut: the JSON transcribe saves. */
|
|
292
302
|
export function transcriptArg(value, command) {
|
|
293
303
|
if (!value) {
|
|
294
|
-
throw usageError(`\`${command}\` needs the recording's transcript: \`makemidas transcribe <file>
|
|
304
|
+
throw usageError(`\`${command}\` needs the recording's transcript: \`makemidas transcribe <file> --format json\` (every word timed), then --transcript <file>.json.`);
|
|
295
305
|
}
|
|
296
306
|
return value;
|
|
297
307
|
}
|
package/dist/captions.js
CHANGED
|
@@ -32,29 +32,33 @@ export function captionFit(width, height, maxWords) {
|
|
|
32
32
|
const tall = width < height;
|
|
33
33
|
return { maxWords: maxWords ?? (tall ? 3 : 5), maxEms: tall ? 8 : 14 };
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
35
|
+
export const CAPTION_POSITIONS = ['auto', 'bottom', 'middle', 'top'];
|
|
36
|
+
/**
|
|
37
|
+
* Where captions sit. `auto`: on a tall video, clear of the buttons TikTok,
|
|
38
|
+
* Reels and Shorts draw (30% up); on a wide one, near the bottom. `bottom`
|
|
39
|
+
* hugs the bottom edge, `middle` centres them, `top` puts them near the
|
|
40
|
+
* top: for when `auto` covers what the video shows.
|
|
41
|
+
*/
|
|
42
|
+
export function captionBox(width, height, position = 'auto') {
|
|
43
|
+
const tall = width < height;
|
|
45
44
|
const square = width === height;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
const size = Math.round(tall ? width * 0.08 : Math.min(width, height) * (square ? 0.07 : 0.06));
|
|
46
|
+
const left = Math.round(width * (tall ? 0.111 : 0.08));
|
|
47
|
+
const boxWidth = Math.round(width * (tall ? 0.778 : 0.84));
|
|
48
|
+
const at = (edge, share) => `${edge}: ${Math.round(height * share)}px; align-items: ${edge === 'top' ? 'flex-start' : 'flex-end'};`;
|
|
49
|
+
const place = {
|
|
50
|
+
auto: at('bottom', tall ? 0.3 : square ? 0.14 : 0.09),
|
|
51
|
+
bottom: at('bottom', tall ? 0.12 : 0.06),
|
|
52
|
+
middle: 'top: 0; bottom: 0; align-items: center;',
|
|
53
|
+
top: at('top', tall ? 0.14 : 0.08),
|
|
51
54
|
};
|
|
55
|
+
return { left, width: boxWidth, size, place: place[position] };
|
|
52
56
|
}
|
|
53
57
|
/** The captions page: transparent, one block per caption group. Pure. */
|
|
54
|
-
export function captionsHtml(groups, size, seconds) {
|
|
58
|
+
export function captionsHtml(groups, size, seconds, position = 'auto') {
|
|
55
59
|
const { width: W, height: H } = size;
|
|
56
60
|
const total = r(seconds);
|
|
57
|
-
const box = captionBox(W, H);
|
|
61
|
+
const box = captionBox(W, H, position);
|
|
58
62
|
const blocks = [];
|
|
59
63
|
const tweens = [];
|
|
60
64
|
groups.forEach((group, g) => {
|
|
@@ -91,7 +95,7 @@ export function captionsHtml(groups, size, seconds) {
|
|
|
91
95
|
html, body { width: ${W}px; height: ${H}px; overflow: hidden; background: transparent; }
|
|
92
96
|
#root { position: relative; width: ${W}px; height: ${H}px; }
|
|
93
97
|
/* Captions: edit the size, colours and place here, then npm run render. */
|
|
94
|
-
.cap { position: absolute; left: ${box.left}px; width: ${box.width}px;
|
|
98
|
+
.cap { position: absolute; left: ${box.left}px; width: ${box.width}px; ${box.place} display: flex; justify-content: center; }
|
|
95
99
|
.cap-in { text-align: center; font-family: 'Inter', sans-serif; font-weight: 900; font-size: ${box.size}px; line-height: 1.12; letter-spacing: -0.01em; color: ${CAPTION_COLORS.ink}; -webkit-text-stroke: ${Math.round(box.size * 0.15)}px #000; paint-order: stroke fill; text-shadow: 0 ${Math.round(box.size * 0.07)}px ${Math.round(box.size * 0.2)}px rgba(0, 0, 0, 0.55); }
|
|
96
100
|
.w { display: inline-block; transform-origin: 50% 70%; margin: 0 0.1em; }
|
|
97
101
|
.w.cjk { margin: 0 0.02em; }
|
|
@@ -149,7 +153,7 @@ export async function captions(g, source, opts) {
|
|
|
149
153
|
throw new CliError(`${source} has no picture to put captions on.`, EXIT.USAGE, 'bad_file');
|
|
150
154
|
}
|
|
151
155
|
if (t.estimated) {
|
|
152
|
-
log('This transcript has no word timings, so each word is timed by guessing within its sentence. For captions that follow the voice exactly, transcribe
|
|
156
|
+
log('This transcript has no word timings (an older Whisper transcript), so each word is timed by guessing within its sentence. For captions that follow the voice exactly, transcribe it again, which times every word: `makemidas transcribe <file> --format json`.');
|
|
153
157
|
}
|
|
154
158
|
const size = pageSize(media.video.width, media.video.height);
|
|
155
159
|
const groups = captionGroups(t.words, captionFit(media.video.width, media.video.height, opts.maxWords));
|
|
@@ -169,7 +173,7 @@ export async function captions(g, source, opts) {
|
|
|
169
173
|
const renderLayer = `${hf} render --format mov --fps ${media.video.fps} -o renders/captions.mov`;
|
|
170
174
|
const burn = `ffmpeg -v error -y ${overlayArgs(input, 'renders/captions.mov', media.video, output, media.audio).map(sh).join(' ')}`;
|
|
171
175
|
const files = {
|
|
172
|
-
'index.html': captionsHtml(groups, size, media.seconds),
|
|
176
|
+
'index.html': captionsHtml(groups, size, media.seconds, opts.position),
|
|
173
177
|
'words.json': `${JSON.stringify({ estimated: t.estimated, groups }, null, 2)}\n`,
|
|
174
178
|
'package.json': `${JSON.stringify({
|
|
175
179
|
name: `${name}-captions`,
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Api, KINDS, MODEL_USES, } from "./api.js";
|
|
3
|
-
import { audioInput, compareModels, compareOptions, editInput, filmSeconds, filmSettings, feedbackKind, generationInput, intOption, numberOption, parse, renderBrand, renderOptions, sourceArg, templateValues, transcriptArg, transcriptionInput, usageError, } from "./args.js";
|
|
3
|
+
import { audioInput, captionPosition, compareModels, compareOptions, editInput, filmSeconds, filmSettings, feedbackKind, generationInput, intOption, numberOption, parse, renderBrand, renderOptions, sourceArg, templateValues, transcriptArg, transcriptionInput, usageError, } from "./args.js";
|
|
4
4
|
import * as commands from "./commands.js";
|
|
5
5
|
import { captions } from "./captions.js";
|
|
6
6
|
import { cut } from "./cut.js";
|
|
@@ -66,6 +66,7 @@ Usage:
|
|
|
66
66
|
makemidas captions <video> --transcript <t.json>
|
|
67
67
|
Burn word-by-word captions in, made here with
|
|
68
68
|
HyperFrames and FFmpeg; free (--max-words,
|
|
69
|
+
--position auto|bottom|middle|top,
|
|
69
70
|
--no-render keeps the project only)
|
|
70
71
|
makemidas cut <video|audio> --transcript <t.json>
|
|
71
72
|
Cut on words, here with FFmpeg; free:
|
|
@@ -155,7 +156,7 @@ Audio options:
|
|
|
155
156
|
Transcribe and edit options:
|
|
156
157
|
-m, --model <id> transcribe: default openai/whisper-large-v2
|
|
157
158
|
--format <f> transcribe: txt (default), srt, vtt or json (json
|
|
158
|
-
times every word
|
|
159
|
+
times every word)
|
|
159
160
|
--scale <n> upscale: 1 (sharpen), 2 (default), 4 or 8
|
|
160
161
|
-r, --resolution <r> upscale-video: 1080P, 2K (default) or 4K
|
|
161
162
|
|
|
@@ -380,6 +381,7 @@ async function main(argv) {
|
|
|
380
381
|
return captions(g, sourceArg(rest, 'captions', 'video file'), {
|
|
381
382
|
transcript: transcriptArg(v.transcript, 'captions'),
|
|
382
383
|
maxWords: intOption(v['max-words'], 'max-words', 1, 8),
|
|
384
|
+
position: captionPosition(v.position),
|
|
383
385
|
render: !v['no-render'],
|
|
384
386
|
out: v.out,
|
|
385
387
|
force: v.force,
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
export const VERSION = '0.
|
|
4
|
+
export const VERSION = '0.12.1';
|
|
5
5
|
export const USER_AGENT = `makemidas-cli/${VERSION}`;
|
|
6
6
|
export const DEFAULT_BASE_URL = 'https://makemidas.com';
|
|
7
7
|
export function resolveBaseUrl(flag) {
|
package/dist/cut.js
CHANGED
|
@@ -125,4 +125,4 @@ export async function cut(g, source, opts) {
|
|
|
125
125
|
print(file);
|
|
126
126
|
log(`Transcript of the cut: ${json} (use it with \`makemidas captions\`).`);
|
|
127
127
|
}
|
|
128
|
-
const ESTIMATED = 'This transcript has no word timings, so they are estimated from its segments and a cut may land mid-word. For exact cuts, transcribe
|
|
128
|
+
const ESTIMATED = 'This transcript has no word timings (an older Whisper transcript), so they are estimated from its segments and a cut may land mid-word. For exact cuts, transcribe it again, which times every word: `makemidas transcribe <file> --format json`.';
|
package/dist/words.js
CHANGED
|
@@ -15,11 +15,11 @@ export async function readTranscript(path) {
|
|
|
15
15
|
parsed = JSON.parse(await readFile(path, 'utf8'));
|
|
16
16
|
}
|
|
17
17
|
catch {
|
|
18
|
-
throw new CliError(`Can't read ${path} as a transcript: make one with \`makemidas transcribe <file>
|
|
18
|
+
throw new CliError(`Can't read ${path} as a transcript: make one with \`makemidas transcribe <file> --format json\`.`, EXIT.USAGE, 'bad_transcript');
|
|
19
19
|
}
|
|
20
20
|
const t = parsed;
|
|
21
21
|
if (!t || !Array.isArray(t.segments)) {
|
|
22
|
-
throw new CliError(`${path} is not a MakeMidas transcript (no segments): make one with \`makemidas transcribe <file>
|
|
22
|
+
throw new CliError(`${path} is not a MakeMidas transcript (no segments): make one with \`makemidas transcribe <file> --format json\`.`, EXIT.USAGE, 'bad_transcript');
|
|
23
23
|
}
|
|
24
24
|
return t;
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makemidas/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "AI image, video and audio generation CLI for AI agents (Claude Code, Cursor, Codex) and people: Nano Banana, GPT Image, Seedream, Seedance, Kling, Veo, Suno and more, plus talking avatars, HTML templates and short films, through MakeMidas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-image-generator",
|