launch-film 0.3.0 → 0.3.2
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/LICENSE +1 -0
- package/README.md +20 -3
- package/THIRD_PARTY.md +1 -1
- package/bin/launch-film.js +76 -6
- package/package.json +1 -1
- package/skills/launch-film/SKILL.md +13 -11
- package/src/address.js +893 -0
- package/src/brand.js +43 -9
- package/src/chrome.js +327 -19
- package/src/confine.js +12 -4
- package/src/dial.js +157 -0
- package/src/film.js +8 -4
- package/src/fonts.js +11 -5
- package/src/out.js +1 -1
- package/src/proxy.js +416 -0
- package/src/stills.js +2 -2
- package/src/store.js +43 -19
- package/src/web.js +169 -0
- package/src/words.js +67 -15
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<img src=".github/assets/icon.svg" alt="" width="72" height="72">
|
|
2
|
+
|
|
1
3
|
# launch-film
|
|
2
4
|
|
|
3
5
|
A 20 to 40 second launch film made from a product's own website or App Store page: its real logo, colors, fonts and screens, set in motion with music and sound effects.
|
|
@@ -20,8 +22,8 @@ Read the story behind it on my blog: [launch-film: A Launch Film From Your Websi
|
|
|
20
22
|
- ffmpeg and ffprobe 4.4 or newer, Ubuntu 22.04's 4.4.2 included. To render a film ffmpeg needs libx264, the only H.264 encoder launch-film uses, which Ubuntu's ffmpeg has; `plan`, `check`, `frames` and `stills` need none. The filters it uses are ffmpeg's own, and so is the AAC encoder. `brew install ffmpeg` and `winget install ffmpeg` give a new enough one, and so does `sudo apt install ffmpeg` on Ubuntu 22.04, Debian 12 or newer. Set `LAUNCH_FILM_FFMPEG` and `LAUNCH_FILM_FFPROBE` to use another build, each as a path or a name on your PATH, and set both: launch-film does not look for ffprobe next to the ffmpeg you name.
|
|
21
23
|
- Google Chrome or Chromium, which draws the film frame by frame and the stills, and reads the site's words for a plan when the page's HTML does not hold them; `check` and `frames` start none. Chrome runs in its sandbox unless launch-film runs as root, where the sandbox does not start: on Linux, Google Chrome's own package sets the sandbox up, and a container has to let it start, as Docker does with `--security-opt seccomp=unconfined`. It has been tested with Google Chrome only: 155 on Ubuntu 26.04, 157 on Ubuntu 22.04 and the one GitHub's ubuntu-latest runner comes with. No test has run with Chromium. launch-film looks for both on your PATH and where macOS installs them; on Windows it looks only where Chrome installs itself. Set `LAUNCH_FILM_CHROME` or `CHROME_PATH` to use another build, as a path. easybrandkit, which reads the brand, takes only `CHROME_PATH`.
|
|
22
24
|
- A font on the machine for letters outside the Latin alphabet and for most Vietnamese letters with tone marks, as launch-film fetches only the faces Google Fonts makes for the other Latin letters. A letter no font has is drawn as a box, as Japanese is on a server with no Japanese font; `fonts-noto-cjk` gives Debian and Ubuntu one.
|
|
23
|
-
- [easybrandkit](https://github.com/MakersMCP/easybrandkit), which reads the brand when you plan from a site's address: install it with `npm install -g easybrandkit`, or launch-film runs it with `npx -y easybrandkit@0.4.
|
|
24
|
-
- Linux, where it is tested: on GitHub's ubuntu-latest runner
|
|
25
|
+
- [easybrandkit](https://github.com/MakersMCP/easybrandkit), which reads the brand when you plan from a site's address: install it with `npm install -g easybrandkit`, or launch-film runs it with `npx -y easybrandkit@0.4.3`. This release was tested with easybrandkit 0.4.3, and runs one on your PATH before it tries npx, whatever its release. Set `LAUNCH_FILM_EASYBRANDKIT` to use a copy of your own. Where easybrandkit could not read an App Store listing itself, launch-film reads the listing from the App Store and hands easybrandkit the site it names with `--named-by`, which easybrandkit takes from 0.4.3 on: with an older one, the film of that App Store page is made from the listing alone.
|
|
26
|
+
- Linux, where it is tested: on GitHub's ubuntu-latest runner, on every push and before every release. This release's tests have also passed on Ubuntu 22.04 with its ffmpeg 4.4.2, in a container as root and without Chrome, so the tests that need Chrome or a user other than root were skipped there, and it has run on Ubuntu 26.04 with ffmpeg 8.0 and on Ubuntu 22.04 with Chrome. It is written for macOS and Windows as well, but this release has not been run on either.
|
|
25
27
|
- Room on the disk for the files of a run and those of the run before it, as the earlier files stay until the new ones are in place, and, while a render sets the film's sound, for one more copy of the new film, as the best of its encodes is kept beside the next until that one is measured. A 30 second film takes 8 to 25 MB, by its look, and its frames, stills and check 3 to 10 MB more; until the render ends, its work files take 30 to 90 MB in the temp folder. Each Chrome that renders the film or draws the stills keeps a profile of about 3 MB there. The ones that read the site for a plan, easybrandkit's and the one that reads the words, also keep what the site loads, and easybrandkit's keeps what Chrome downloads for its own features as well: up to 50 MB on a small test site.
|
|
26
28
|
- Network access for a plan, which reads the site unless you give it both `--brand` and `--words`, and for npx to fetch easybrandkit when it is not installed. A render and stills fetch the film's typefaces from Google Fonts and keep them in `~/.cache/launch-film/fonts`; offline they use the ones kept there, and the system's own for the rest. `check` and `frames` need no network. Installing it needs the network, and `npx launch-film@latest` asks npm for the newest version each time it runs. No account and no API key.
|
|
27
29
|
|
|
@@ -106,7 +108,9 @@ Where launch-film runs for others, who give it their film.json or brand.json, se
|
|
|
106
108
|
|
|
107
109
|
A page in Chrome can try to hand an address that no page shows to a program of the machine: Chrome hands a `mailto:`, `news:` or `snews:` address to the system without asking, so a site that goes to one as it loads would open your mail program. On Linux every Chrome launch-film starts, and the one easybrandkit starts for a plan, finds stand-ins first on its PATH, in a temp folder of the run's own, for xdg-open, xdg-email, x-www-browser, www-browser and sensible-browser, the programs Chrome hands such an address to there, and for xdg-settings, which Chrome asks first which program takes it. They start nothing. A temp folder on a disk mounted noexec cannot run them, and one whose path holds a `:` cannot put them first on PATH, which reads the `:` as the end of a folder, so in either a render, stills, the one-go command and a plan that may start a Chrome, as any plan not given both `--brand` and `--words` may, stop before any work: set `TMPDIR` to another folder. They stop the same way where the temp folder's path takes more than 66 bytes, too long for the socket Chrome makes in a folder there: that is 66 characters of ASCII, and fewer where it has other letters, as each of them takes two bytes or more. On a Linux desktop Chrome first hands such an address to the desktop's portal over the session bus, and the portal opens the program set for it, so there every Chrome launch-film starts, and easybrandkit's, is also given a session bus that leads nowhere, a socket in its own temp folder that is never made, and no display: no X display, and as its Wayland display another path there that is never made, since a Wayland display left unset is looked for where the desktop's is. On macOS and Windows Chrome hands such an address to the system, which opens the program set for it, and launch-film has found nothing that keeps it from that: no switch of Chrome's, no preference of its profile and no call of the DevTools protocol stops these three kinds of address. No test of this has run on macOS or Windows. On Linux a plan says in a note which such addresses the pages it read asked for, easybrandkit's and its own, the first five of them and how many more times one was asked for. On macOS and Windows its note covers only a page that launch-film's own Chrome read, which it reads only when the page's HTML lacks its words, and not the pages easybrandkit read.
|
|
108
110
|
|
|
109
|
-
A page can also make Chrome save a file, of any size, into the Downloads folder of the user it runs as, where nothing removes it. Every Chrome launch-film starts refuses downloads, and so does the Chrome of easybrandkit 0.4.
|
|
111
|
+
A page can also make Chrome save a file, of any size, into the Downloads folder of the user it runs as, where nothing removes it. Every Chrome launch-film starts refuses downloads, and so does the Chrome of easybrandkit 0.4.3, which this release runs to read the site for a plan. The Chrome of easybrandkit 0.4.0, which one on your PATH or named by `LAUNCH_FILM_EASYBRANDKIT` can still be, does not: on Linux launch-film gives it a Downloads folder in the run's own temp folder, which goes with the run, and on macOS and Windows a site it reads can save a file into your Downloads folder.
|
|
112
|
+
|
|
113
|
+
Every request launch-film makes itself, for the page a plan reads the words of, an App Store listing's lookup with its icon and screenshots and the faces Google Fonts gives, and every request of the Chrome that reads the page's words, is held to the rule easybrandkit and easyscreenshotkit hold their own requests to. The address you give `launch-film <url>`, `plan` or `stills`, whose host has to be an IPv4 address or a name with a dot (`localhost` and `[::1]` are refused before any work: give `http://127.0.0.1:<port>/`, or for a server that listens on `::1` alone, as one started on localhost can, a name under localhost such as `http://dev.localhost:<port>/`), is opened on any port, and so is any page on its scheme, host and port, so a site under development at `http://127.0.0.1:3000/` is read, though what its page takes from another port, as scripts or data, is not, and the plan's notes name it: serve the site whole from one port, as a build of its assets, and plan again. A page whose content all comes from another port shows easybrandkit nothing, and the plan stops with its `still shows no content after 30 s`: serve the site whole from one port, and plan again. Any other address is opened only on port 80 or 443, and only where every address its name is found at is on the public internet: not this machine, a private, shared or link-local network or another range kept off the public internet, and not an address this machine holds or one on the IPv6 network of one. That holds for each hop of a redirect, a page's own move, the page a kit given with `--brand` names when it is not the address you give, the site an App Store listing names, the listing's pictures and Google's faces. A name whose answers mix is opened nowhere, the address you give included (see Limits). Each name is looked up once a run, and a request goes only to an address that lookup found. launch-film uses no proxy that the environment or the system names, such as `HTTPS_PROXY`, for its own requests or its Chrome's. The Chrome that reads the page's words sends every request through a proxy of launch-film's own on 127.0.0.1, which holds it to the same rule whatever asks for it: a page, a frame, a picture, a script, the data a page fetches, a WebSocket or a service worker. That Chrome looks no name up itself, and its WebRTC sends no UDP, which would go around a proxy. A Chrome that sends a request or UDP past that proxy, as a Chrome policy or a program that starts it with switches of its own can make it do, is not used, and the plan goes on with the words of the page's HTML. The plan's notes name the first three addresses that Chrome was refused while it read the page, as in `While launch-film read http://127.0.0.1:3000/, the browser asked for http://127.0.0.1:5173/src/app.js, which is on port 5173, not 80 or 443: it was not reached.`, and how many more there were, and pass on such notes of a kit easybrandkit made. Where a page leads to an address the rule refuses, by a redirect or a move of its own, that address is not opened, and the plan says where the page led and why, as in `could not be read (it led to http://127.0.0.1:9222/json/list, which is on port 9222, not 80 or 443)`. The site an App Store listing names, which a plan reads when easybrandkit could not read the listing itself, is judged so before easybrandkit reads it, and is handed to easybrandkit with `--named-by`, which easybrandkit takes from 0.4.3 on, so that it holds that site to its rule for a page it chose; one the rule refuses leaves the film to the listing alone. `MAKERSMCP_REFUSE_ADDRESSES`, a comma list of IP addresses and CIDR ranges such as `185.137.215.163,10.0.0.0/8`, names more addresses to refuse, the address you give included, and launch-film hands it on to the easybrandkit it runs, which refuses them as well from 0.4.3 on. A value that does not parse stops a plan, the one-go command, stills or a render before any work, in words that name it, and so does a system that does not let launch-film read this machine's network interfaces, as a Linux service whose RestrictAddressFamilies leaves out AF_NETLINK.
|
|
110
114
|
|
|
111
115
|
A run leaves this behind:
|
|
112
116
|
|
|
@@ -239,8 +243,21 @@ Words between asterisks are set in the brand's accent color. A bar is one bar of
|
|
|
239
243
|
- A brand typeface that Google Fonts does not have is replaced by the look's own, and the render says which. launch-film asks Google for it again a day later.
|
|
240
244
|
- Letters outside the Latin alphabet, such as Cyrillic or Japanese, and most Vietnamese letters with tone marks are drawn in the machine's own fonts, not in the film's typefaces, and no note says so.
|
|
241
245
|
- easybrandkit needs a site that opens in a headless browser. A bot check or a login wall gets no kit, and a social profile is not a brand's site.
|
|
246
|
+
- A name whose answers mix, some on the public internet and some not, or one of this machine's, or one on one of its networks, is opened nowhere, the address you give included, and is refused in words that quote it in the form "on a host whose name answers with an address on the public internet, <address>, and with one ...": have the machine answer that name with the address you mean alone, as a line in its hosts file does.
|
|
247
|
+
- launch-film cannot tell an address that leads into your machine or your network from outside, as your network's public IPv4 address, which a router can turn back inside, from any other address on the public internet, nor the rest of your own network where it is at public addresses outside the networks of this machine's interfaces. On such a machine or network, name those addresses and ranges in `MAKERSMCP_REFUSE_ADDRESSES`, which then refuses them as the address you give too. On a server whose provider puts other customers' servers in the IPv6 network of its interface, their sites are refused as being on a network of this machine.
|
|
248
|
+
- On a network that reaches the web only through a proxy, a plan reads no page, as neither launch-film nor its Chrome uses one.
|
|
249
|
+
- Behind a proxy in fake-ip mode, which gives every name an address in 198.18.0.0/15, as Clash, Surge or sing-box run with a TUN device do, only the address you give and its own pages are opened: no typeface comes from Google Fonts, and no App Store listing is read by launch-film itself.
|
|
250
|
+
- Only addresses at apps.apple.com and itunes.apple.com are read as App Store pages: give a listing by its apps.apple.com address.
|
|
251
|
+
- An address whose host, path or query holds play.google.com/store/apps is read as a Google Play listing: give the site's own address without it.
|
|
252
|
+
- An address written with no scheme is read as https://, so give a site under development as `http://127.0.0.1:<port>/`.
|
|
253
|
+
- A site under development whose page is filled by scripts from another port, as Vite's dev server beside a Laravel, Rails or Django app, shows nothing to easybrandkit, and the plan stops with easybrandkit's `still shows no content after 30 s`: serve the site whole from one port, as a build of its assets, and plan again.
|
|
254
|
+
- A site that answers launch-film's own reading of the page with a bot check gives `words.json` that check's words: give the page's words with `--words`.
|
|
255
|
+
- A site whose server drops many attempts to connect can hold a plan for about a minute and a half while the Chrome that reads the page's words waits on it, and its note then says Chrome did not answer, which there means the site, not the machine. The plan goes on with the words of the page's HTML, and stops where that could not be fetched either: give the page's words with `--words`.
|
|
256
|
+
- A page that keeps easybrandkit busy past its own time stops a plan with easybrandkit's words to give it more time with `--timeout`, which a plan does not take: run `npx -y easybrandkit@0.4.3 <url> --timeout 240 --out <kit>`, then plan with `--brand <kit>`.
|
|
257
|
+
- A Chrome policy set by an administrator that gives WebRTC a handling of its own for some sites (WebRtcIPHandlingUrl) holds for those sites, and launch-film's check of its Chrome does not tell it.
|
|
242
258
|
- A 30 second film takes one to three minutes to render on a laptop. On a machine too busy for Chrome, a clip can fail with "Chrome did not answer ... within 60 s" or "the page did not load within 30 s": render again once it is less busy, or with `--jobs 1`. On one short of memory, two clips at once can run Chrome out of it, and a clip fails with "Chrome's page crashed", "Chrome could not capture frame ...", "Chrome was stopped by SIGKILL" or "ffmpeg was stopped by SIGKILL", each followed by "most often because the system ran out of memory": render again with `--jobs 1`, which needs less. A `LAUNCH_FILM_CHROME` that names something that cannot be run, such as the folder Google Chrome.app, stops the render before it starts, with that reason.
|
|
243
259
|
- The music is simple by design. To use your own track, give its path as `music` in film.json and render again. The cuts still fall on the bars of the look's own tempo (launch 112 BPM, aurora 96, gridline 120, pop 124, journal 90), so a track's beats meet every cut when a bar of the look holds a whole number of the track's beats, with its hit on a cut such as the logo close: four at the look's own tempo, two at half of it, eight at twice it, or five for a 120 BPM track in aurora. So read the track's tempo with `npx musicfit@latest track.mp3 --analyze` before you plan the film, and fit the track once the film is rendered.
|
|
260
|
+
- ffmpeg 9.0.2 reads a WAV that starts with an ID3v2 tag as having no sound, so a render refuses such a track as one that "has no sound ffmpeg can read": save it again without the tag, or give it as a FLAC, MP3 or M4A file.
|
|
244
261
|
|
|
245
262
|
## License
|
|
246
263
|
|
package/THIRD_PARTY.md
CHANGED
|
@@ -43,7 +43,7 @@ They are embedded in the pages that are rendered, and reach the film only as pix
|
|
|
43
43
|
|
|
44
44
|
### easybrandkit
|
|
45
45
|
|
|
46
|
-
`launch-film <url>` and `launch-film plan <url>` run [easybrandkit](https://github.com/MakersMCP/easybrandkit) (MIT, by the same author) to read the site: an easybrandkit installed on PATH (`npm install -g easybrandkit`), or else `npx -y easybrandkit@0.4.
|
|
46
|
+
`launch-film <url>` and `launch-film plan <url>` run [easybrandkit](https://github.com/MakersMCP/easybrandkit) (MIT, by the same author) to read the site: an easybrandkit installed on PATH (`npm install -g easybrandkit`), or else `npx -y easybrandkit@0.4.3`, and `npx -y github:MakersMCP/easybrandkit#v0.4.3` when npm cannot give it. `LAUNCH_FILM_EASYBRANDKIT` names another command.
|
|
47
47
|
|
|
48
48
|
## Used from your machine, not shipped
|
|
49
49
|
|
package/bin/launch-film.js
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
// launch-film: a launch film from a website or an App Store page.
|
|
4
4
|
|
|
5
|
+
// launch-film looks names up with the system's lookup (src/address.js), on
|
|
6
|
+
// libuv's threads, at most half of them at once, and the proxy of the
|
|
7
|
+
// Chrome that reads a page looks up the name of every request it makes. A
|
|
8
|
+
// name whose DNS gives no answer holds a thread for as long as the system
|
|
9
|
+
// waits, 10 s with glibc's own settings: with the 4 threads Node starts
|
|
10
|
+
// with, two such names on a page held up every name asked after them, and
|
|
11
|
+
// the requests for those were refused as names that could not be looked
|
|
12
|
+
// up. 32 threads look up 16 names at once, as easybrandkit's do. Set before
|
|
13
|
+
// any of them starts; a number the caller set is kept.
|
|
14
|
+
if (!process.env.UV_THREADPOOL_SIZE) process.env.UV_THREADPOOL_SIZE = "32";
|
|
15
|
+
|
|
5
16
|
const fs = require("fs");
|
|
6
17
|
const path = require("path");
|
|
7
18
|
const { listen, within, heldBackIn, shown, said, aftermath, noticed, stopping, exit, reason, save, copyPlain } = require("../src/out");
|
|
@@ -79,6 +90,20 @@ brand.json, kit or film: each may then name only files in its own folder,
|
|
|
79
90
|
none of them a list of other files for ffmpeg to open, such as an HLS
|
|
80
91
|
playlist, a kit may hold no link out of it, and check and frames refuse a
|
|
81
92
|
film that is such a list.
|
|
93
|
+
The address given, whose host has to be an IPv4 address or a name with a
|
|
94
|
+
dot (localhost and [::1] are refused before any work: give 127.0.0.1, or
|
|
95
|
+
for a server that listens on ::1 alone a name under localhost such as
|
|
96
|
+
dev.localhost), is opened on any port, and so are the pages on its scheme,
|
|
97
|
+
host and port. Every other address launch-film or the Chrome that reads a
|
|
98
|
+
page opens, a redirect, a page's move, a kit's page, a listing's pictures
|
|
99
|
+
and the typefaces, is opened only on port 80 or 443 of the public
|
|
100
|
+
internet, never at an address of this machine or on one of its networks,
|
|
101
|
+
and through no proxy the environment names. A name whose answers mix is
|
|
102
|
+
opened nowhere, refused "on a host whose name answers with an address on
|
|
103
|
+
the public internet, <address>, and with one ...": have the machine answer
|
|
104
|
+
that name with the address meant alone, as a line in its hosts file does.
|
|
105
|
+
MAKERSMCP_REFUSE_ADDRESSES, a comma list of IP addresses and ranges such
|
|
106
|
+
as 10.0.0.0/8, names more addresses to refuse, the address given included.
|
|
82
107
|
Everything renders on this machine with Chrome and ffmpeg. No account or key.
|
|
83
108
|
`;
|
|
84
109
|
|
|
@@ -242,6 +267,23 @@ function normaliseUrl(raw) {
|
|
|
242
267
|
}
|
|
243
268
|
}
|
|
244
269
|
|
|
270
|
+
// What to give for an address at localhost or [::1], which a run refuses
|
|
271
|
+
// before any work, as it does every host without a dot: 127.0.0.1, or for a
|
|
272
|
+
// server that listens on ::1 alone, as one started on localhost can, a name
|
|
273
|
+
// under localhost. "" for any other address.
|
|
274
|
+
function loopbackHint(raw) {
|
|
275
|
+
const s = String(raw || "").trim();
|
|
276
|
+
let u;
|
|
277
|
+
try {
|
|
278
|
+
u = new URL(/^https?:\/\//i.test(s) ? s : `http://${s}`);
|
|
279
|
+
} catch {
|
|
280
|
+
return "";
|
|
281
|
+
}
|
|
282
|
+
if (u.hostname !== "localhost" && u.hostname !== "[::1]") return "";
|
|
283
|
+
const at = (host) => `${u.protocol}//${host}${u.port ? `:${u.port}` : ""}/`;
|
|
284
|
+
return `: localhost and [::1] are refused before any work, so give ${at("127.0.0.1")}, or for a server that listens on ::1 alone a name under localhost, such as ${at("dev.localhost")}`;
|
|
285
|
+
}
|
|
286
|
+
|
|
245
287
|
// The film's folder: --out, else launch-film-<site> here.
|
|
246
288
|
function folderFor(url, flags) {
|
|
247
289
|
const host = new URL(url).hostname.replace(/^www\./, "");
|
|
@@ -325,6 +367,14 @@ async function makePlan(url, flags, run, inputs) {
|
|
|
325
367
|
copy(path.dirname(inputs.brandFile));
|
|
326
368
|
brandFile = path.join(local, path.basename(inputs.brandFile));
|
|
327
369
|
} else {
|
|
370
|
+
// The address given is judged by the run's rule before easybrandkit
|
|
371
|
+
// opens it, as the maker's site a listing names is (store.js): an
|
|
372
|
+
// easybrandkit older than 0.4.3, as one on PATH or given can be, refuses
|
|
373
|
+
// neither an address MAKERSMCP_REFUSE_ADDRESSES names nor a name whose
|
|
374
|
+
// answers mix. A name that could not be looked up is left to
|
|
375
|
+
// easybrandkit, which says so in its own words.
|
|
376
|
+
const barred = await require("../src/web").run().judge(url);
|
|
377
|
+
if (barred && barred !== require("../src/address").UNRESOLVED) throw new Error(`the page ${url} could not be read (it ${barred}): check the address and the network, or give a kit you already have with --brand and the page's words with --words`);
|
|
328
378
|
// easybrandkit makes its kit again where an earlier one is, keeping the
|
|
329
379
|
// files that are not a kit's: it works on a copy of the folder's own,
|
|
330
380
|
// which with LAUNCH_FILM_CONFINE set may not be a link out of the folder,
|
|
@@ -351,7 +401,7 @@ async function makePlan(url, flags, run, inputs) {
|
|
|
351
401
|
if (!appStoreId(url)) throw err;
|
|
352
402
|
say(`easybrandkit could not read the listing (${shown(err.message.split(". ")[0])}); reading it from the App Store instead.\n`);
|
|
353
403
|
fs.rmSync(local, { recursive: true, force: true });
|
|
354
|
-
const made = await storeBrand(url, local, { runEasybrandkit: (u, d, o) => runEasybrandkit(u, d, { ...o, command: flags.easybrandkit }), log: say });
|
|
404
|
+
const made = await storeBrand(url, local, { runEasybrandkit: (u, d, o) => runEasybrandkit(u, d, { ...o, command: flags.easybrandkit }), log: say, guard: require("../src/web").run() });
|
|
355
405
|
brandFile = made.brandFile;
|
|
356
406
|
}
|
|
357
407
|
} else {
|
|
@@ -363,6 +413,8 @@ async function makePlan(url, flags, run, inputs) {
|
|
|
363
413
|
// A kit made from an App Store page carries the listing's description.
|
|
364
414
|
if (!storeWords && brand.app && brand.stores[0]) storeWords = require("../src/store").wordsFromListing({ name: brand.name, description: brand.stores[0].description });
|
|
365
415
|
let words;
|
|
416
|
+
// What the Chrome that reads the page's words was refused (words.js).
|
|
417
|
+
const unreached = [];
|
|
366
418
|
if (flags.words) words = inputs.words;
|
|
367
419
|
else if (storeWords) words = storeWords;
|
|
368
420
|
else {
|
|
@@ -373,7 +425,7 @@ async function makePlan(url, flags, run, inputs) {
|
|
|
373
425
|
throw new Error(`${path.basename(brandFile)} gives the site's address as "${confine.said(brand.url, 120)}", which is not an http or https address: give a kit made from the site, or the page's words with --words`);
|
|
374
426
|
}
|
|
375
427
|
say(`Reading the words on the page...\n`);
|
|
376
|
-
words = await readWords(brand.url || url, { log: say });
|
|
428
|
+
words = await readWords(brand.url || url, { log: say, guard: require("../src/web").run(), notes: unreached });
|
|
377
429
|
}
|
|
378
430
|
save(run.out("words.json"), JSON.stringify(words, null, 2) + "\n");
|
|
379
431
|
const seconds = Math.min(40, Math.max(20, Number(flags.seconds) || 30));
|
|
@@ -392,7 +444,7 @@ async function makePlan(url, flags, run, inputs) {
|
|
|
392
444
|
const tried = list.map((a) => `The page tried to open ${a.length > 120 ? `${a.slice(0, 120)}...` : a}, which is not a web address: ` +
|
|
393
445
|
`${linux ? "it was not opened." : "Chrome hands such an address to the system, which may have opened a program for it."}`);
|
|
394
446
|
if (more) tried.push(`The page tried to open such an address ${more} more time${more > 1 ? "s" : ""}: ${linux ? "none was opened." : "Chrome hands each to the system, which may have opened a program for it."}`);
|
|
395
|
-
for (const note of [...brand.notes, ...tried]) say(`note: ${note}\n`);
|
|
447
|
+
for (const note of [...brand.notes, ...brand.unreached, ...unreached, ...tried]) say(`note: ${note}\n`);
|
|
396
448
|
say(`Planned ${film.clips.length} clips in the ${film.look} look: ${where(filmFile)}\n`);
|
|
397
449
|
return { filmFile, film };
|
|
398
450
|
}
|
|
@@ -513,7 +565,17 @@ async function main() {
|
|
|
513
565
|
// its own for the page's words, as it may unless it is given both --brand
|
|
514
566
|
// and --words, tries the stand-ins that Chrome gets first (chrome.js): on
|
|
515
567
|
// a temp folder where they cannot run, it stops here, not as it starts one.
|
|
568
|
+
//
|
|
569
|
+
// A command that opens addresses, those that read a site and those that
|
|
570
|
+
// fetch the film's typefaces, reads MAKERSMCP_REFUSE_ADDRESSES and this
|
|
571
|
+
// machine's network interfaces first (web.js): a value that does not
|
|
572
|
+
// parse, or interfaces the system does not let it read, stop it here, as
|
|
573
|
+
// no address could be judged.
|
|
516
574
|
const ready = (address = null) => {
|
|
575
|
+
if (["<url>", "plan", "render", "stills", "stills <film.json>"].includes(takes)) {
|
|
576
|
+
const unfit = require("../src/web").unready();
|
|
577
|
+
if (unfit) throw new Error(unfit);
|
|
578
|
+
}
|
|
517
579
|
const program = require("../src/programs").unstartable(programsOf(takes, address));
|
|
518
580
|
if (program) throw new Error(program);
|
|
519
581
|
if (address && !(flags.brand && flags.words)) require("../src/chrome").standIns();
|
|
@@ -552,9 +614,12 @@ async function main() {
|
|
|
552
614
|
r = await makeStills(filmFile, { targets: flags.for, log: say });
|
|
553
615
|
} else {
|
|
554
616
|
const url = normaliseUrl(rest[0]);
|
|
555
|
-
if (!url) return fail(`"${rest[0]}" is not an address or a film.json`);
|
|
617
|
+
if (!url) return fail(`"${rest[0]}" is not an address or a film.json${loopbackHint(rest[0])}`);
|
|
556
618
|
const inputs = planArgs(flags, url, [...PLANNED, "stills", ...stillsMade(flags.for).map((name) => path.join("stills", name))]);
|
|
557
619
|
ready(url);
|
|
620
|
+
// The address given is the run's own: its scheme, host and port are
|
|
621
|
+
// opened as given, and every other address held to the rule (web.js).
|
|
622
|
+
require("../src/web").setRun(url);
|
|
558
623
|
// The plan and the stills are one run: both go in, or neither.
|
|
559
624
|
r = await within(folderFor(url, flags), async (run) => {
|
|
560
625
|
const { filmFile, film } = await makePlan(url, flags, run, inputs);
|
|
@@ -566,16 +631,21 @@ async function main() {
|
|
|
566
631
|
});
|
|
567
632
|
}
|
|
568
633
|
for (const note of r.notes) say(`note: ${shown(note)}\n`);
|
|
569
|
-
say(`Made ${r.files.length} stills: ${where(path.join(r.dir, "STILLS.md"))}\n`);
|
|
634
|
+
say(`Made ${r.files.length} ${r.files.length === 1 ? "still" : "stills"}: ${where(path.join(r.dir, "STILLS.md"))}\n`);
|
|
570
635
|
return;
|
|
571
636
|
}
|
|
572
637
|
const isPlan = command === "plan";
|
|
573
638
|
const url = normaliseUrl(isPlan ? rest[0] : command);
|
|
574
|
-
if (!url)
|
|
639
|
+
if (!url) {
|
|
640
|
+
const hint = loopbackHint(isPlan ? rest[0] : command);
|
|
641
|
+
if (isPlan) return fail(`give the site's address, e.g. launch-film plan example.com${hint}`);
|
|
642
|
+
return fail(hint ? `"${command}" is not a command or an address${hint}` : `"${command}" is not a command or an address. Run launch-film --help.`);
|
|
643
|
+
}
|
|
575
644
|
const { framesMade } = require("../src/frames");
|
|
576
645
|
const made = isPlan ? [] : ["film.mp4", "film.timeline.json", "frames", ...framesMade().map((name) => path.join("frames", name))];
|
|
577
646
|
const inputs = planArgs(flags, url, [...PLANNED, ...made]);
|
|
578
647
|
ready(url);
|
|
648
|
+
require("../src/web").setRun(url);
|
|
579
649
|
// The plan, the film and its frames are one run: all go in, or none.
|
|
580
650
|
await within(folderFor(url, flags), async (run) => {
|
|
581
651
|
const { filmFile, film } = await makePlan(url, flags, run, inputs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "launch-film",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "A launch film from a website or an App Store page: its real logo, colors, fonts and screens, rendered locally with Chrome and ffmpeg.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Emin Budak",
|
|
@@ -10,7 +10,7 @@ A launch film made from the product itself: its logo cut from its own page, its
|
|
|
10
10
|
The tool is the `launch-film` npm package. It needs Node 22 or newer, Chrome or Chromium, and ffmpeg and ffprobe 4.4 or newer. Check them first:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npx -y launch-film@0.3.
|
|
13
|
+
npx -y launch-film@0.3.2 doctor
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
If ffmpeg or ffprobe is missing, cannot be started or is older than 4.4, tell the user how to install ffmpeg, which comes with ffprobe (`brew install ffmpeg` on a Mac, `sudo apt install ffmpeg` on Ubuntu 22.04, Debian 12 or newer), and stop. doctor also starts Chrome once: if it finds no Chrome, or says that Chrome could not start its sandbox or did not start, tell the user what it says and stop. Each program's line says what is wrong with it. A command that cannot start ffmpeg, ffprobe or Chrome stops before any work with a message that starts `launch-film needs ffmpeg` (or ffprobe, or Chrome) and names the setting or the PATH entry that gave it, what is wrong with it and how to point to one that works. A message that starts `launch-film could not run its stand-ins` or `launch-film cannot put its stand-ins` (the temp folder cannot hold the programs that keep a page from starting one of the machine's, or the machine was too busy to run them), `launch-film cannot start Chrome from the temp folder` (the temp folder's path is too long for Chrome), or `launch-film could not start` says what to do as well. Pass any of these on to the user and stop.
|
|
@@ -18,7 +18,7 @@ If ffmpeg or ffprobe is missing, cannot be started or is older than 4.4, tell th
|
|
|
18
18
|
## 1. Get the brand and a first plan
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npx -y launch-film@0.3.
|
|
21
|
+
npx -y launch-film@0.3.2 plan <url> --out film/<name>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Give the product's website, or its App Store or Google Play listing (then the listing's icon, screenshots and rating are used, with the colors, fonts and logo of the site it names). Not a social profile: easybrandkit refuses those.
|
|
@@ -33,12 +33,14 @@ Then read, in this order:
|
|
|
33
33
|
|
|
34
34
|
If the brand looks wrong (a cookie wall, a login page, no logo), tell the user what you got and ask for the logo file or the right page. A note that the page tried to open an address that is not a web address, such as mailto:, means the site asked the browser to start a program: on Linux none was started, and on a Mac or Windows the note says a program may have opened, so tell the user. Do not go on with a wrong brand. If the site answered easybrandkit with a bot check, there is no kit: ask the user for the logo file and the main colors instead of guessing.
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
launch-film opens the address given on any port when its host is an IPv4 address or a name with a dot, and the pages on its scheme, host and port; `localhost` and `[::1]` are refused before any work, so give `http://127.0.0.1:<port>/`, or for a server that listens on `::1` alone, as one started on localhost can, a name under localhost such as `http://dev.localhost:<port>/`. Every other address it or the Chrome that reads the page opens, a redirect, a page's move, the page a kit given with `--brand` names, the site an App Store listing names, the listing's pictures and the typefaces, it opens only on port 80 or 443 of the public internet, never at an address of the user's machine or on one of its networks. If a plan says the page could not be read because it is on another port, is not on the public internet, is at an address of the machine or one `MAKERSMCP_REFUSE_ADDRESSES` refuses, that page was not opened: when it is the page a kit names, tell the user that address and why it was not opened, and plan again with it as the address only once the user says it is their own site, never for one `MAKERSMCP_REFUSE_ADDRESSES` refuses, which is refused as the address too; or give the page's words with `--words`. Where the page refused is the address given itself, as one `MAKERSMCP_REFUSE_ADDRESSES` names or one at a name whose answers mix, the plan stops before easybrandkit starts: only a kit made elsewhere with `--brand` together with the page's words with `--words` plans then, as either alone is refused the same way. A refusal that says an address is "on a host whose name answers with an address on the public internet, <address>, and with one ..." means that name leads both to the public internet and elsewhere: tell the user to have the machine answer that name with the address they mean alone, as a line in its hosts file does. A last line that says `MAKERSMCP_REFUSE_ADDRESSES holds` means that setting does not parse: tell the user, who sets it. A note `While launch-film read <page>, the browser asked for <address>, which <reason>: it was not reached.`, or the same from easybrandkit, passed on from the kit, names what the page, or the browser by itself, asked for besides at an address launch-film does not open, and the plan was made without it. Only where it names the user's own site under development on another port, as its scripts or data, tell the user, who can serve the site whole from one port and plan again. A page whose content all comes from another port shows easybrandkit nothing, and the plan stops with its `still shows no content after 30 s`: do not plan it again as it is, but tell the user to serve the site whole from one port, as a build of its assets, and then plan again. If no page can be read on a network that reaches the web only through a proxy (`HTTPS_PROXY` or the like), that is why: launch-film and its Chrome use no proxy, so plan where the web is reached directly, or give a kit made elsewhere with `--brand` and the page's words with `--words`. A site whose server drops many attempts to connect can hold a plan for about a minute and a half, and its note then says Chrome did not answer, which there means the site, not the machine: the plan goes on with the page's HTML, and where that could not be fetched either, give the page's words with `--words`. When easybrandkit says to give it more time with `--timeout`, which a plan does not take, run `npx -y easybrandkit@0.4.3 <url> --timeout 240 --out <kit>` and then plan with `--brand <kit>`. A line that says Chrome could not read the page because it does not send its requests through launch-film's proxy, or because its WebRTC sends UDP past it, means a Chrome policy or a program that starts Chrome changed how it connects: the plan went on with the page's HTML, so tell the user.
|
|
37
|
+
|
|
38
|
+
The site an App Store listing names is read with easybrandkit 0.4.3 or later, which is also the first to refuse what `MAKERSMCP_REFUSE_ADDRESSES` names: where easybrandkit could not read the listing itself, an older one, on PATH or given with `--easybrandkit`, leaves the film of that App Store page to the listing alone, and the plan says `Unknown option: --named-by`. If launch-film says easybrandkit could not be fetched, npx could not download it (no network, or a registry without it): tell the user they can install it with `npm install -g easybrandkit`, and use `--easybrandkit <path to easybrandkit's skills/easybrandkit/scripts/easybrandkit.js>` when they have a copy.
|
|
37
39
|
|
|
38
40
|
## 2. Pick a look
|
|
39
41
|
|
|
40
42
|
```bash
|
|
41
|
-
npx -y launch-film@0.3.
|
|
43
|
+
npx -y launch-film@0.3.2 looks
|
|
42
44
|
```
|
|
43
45
|
|
|
44
46
|
The plan already picked one from the brand: `launch` (dark stage, depth, one bright accent) for dark sites and developer tools, `aurora` (frosted glass over soft color) for vivid consumer and AI products, `gridline` (Swiss grid on paper) for light B2B sites, `pop` (full color fields, stickers) for consumer apps, `journal` (serif headlines on warm paper) for editorial brands. Change `"look"` in film.json if the user asked for a style or another one fits better.
|
|
@@ -56,7 +58,7 @@ film.json holds `look`, `aspect` (`16:9` or `9:16`), `music` and `clips`, played
|
|
|
56
58
|
| `scroll` | a tall page scrolling in a window | `image` |
|
|
57
59
|
| `logo` | the logo close with the site's address | `logo` (an easybrandkit logo file) or `icon` (an app icon), `site` |
|
|
58
60
|
|
|
59
|
-
A scene object has a `type` and its words. List every type and its fields with `npx -y launch-film@0.3.
|
|
61
|
+
A scene object has a `type` and its words. List every type and its fields with `npx -y launch-film@0.3.2 types`; icon names come from `npx -y launch-film@0.3.2 icons <word>`. The ones a launch film uses most:
|
|
60
62
|
|
|
61
63
|
```json
|
|
62
64
|
{ "type": "opener", "title": "Acme Notes", "text": "Notes that think with you" }
|
|
@@ -79,10 +81,10 @@ Words between asterisks are set in the accent color. Rules for the words:
|
|
|
79
81
|
## 4. Render
|
|
80
82
|
|
|
81
83
|
```bash
|
|
82
|
-
npx -y launch-film@0.3.
|
|
84
|
+
npx -y launch-film@0.3.2 render film/<name>/film.json
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
Clips render two at a time; a 30 second film takes one to three minutes. The film is `film/<name>/film.mp4`. If a clip fails, the message names it: fix film.json and render again. When it says that Chrome did not answer in time or that the page did not load, the machine was too busy: render again with `--jobs 1`. When it says that the system ran out of memory, after "Chrome's page crashed", "Chrome could not capture frame", "Chrome was stopped by SIGKILL" or "ffmpeg was stopped by SIGKILL", render again with `--jobs 1` too, which needs less. When it says that Chrome could not start its sandbox, tell the user what the message says to do, and stop.
|
|
87
|
+
Clips render two at a time; a 30 second film takes one to three minutes. The film is `film/<name>/film.mp4`. If a clip fails, the message names it: fix film.json and render again. When it says that Chrome did not answer in time or that the page did not load, the machine was too busy: render again with `--jobs 1`. When it says that the system ran out of memory, after "Chrome's page crashed", "Chrome could not capture frame", "Chrome was stopped by SIGKILL" or "ffmpeg was stopped by SIGKILL", render again with `--jobs 1` too, which needs less. When it says that Chrome could not start its sandbox, tell the user what the message says to do, and stop. When it says that a WAV track "has no sound ffmpeg can read" and doctor's ffmpeg line says 9.0.2, the WAV may start with an ID3v2 tag, which that ffmpeg reads as no sound: ask the user to save it again without the tag, or to give it as a FLAC, MP3 or M4A file.
|
|
86
88
|
|
|
87
89
|
A run that fails or is stopped changes nothing in the folder: the last good plan, brand, film, frames, stills and check stay. Fix the cause and run it again. An earlier file the user made read-only is not replaced: the run names it and stops. That does not hold inside `brand/`: a plan replaces that folder whole, so a plan given a kit with `--brand` takes read-only files there away with the rest. A frames, stills or check folder that is a link takes the new files in the folder it leads to. An earlier file that is a link is replaced by a plain file, and what it led to is left alone; a new file has the mode a new file gets on that system, not the one the earlier file was given.
|
|
88
90
|
|
|
@@ -91,14 +93,14 @@ A run that fails or is stopped changes nothing in the folder: the last good plan
|
|
|
91
93
|
You can't watch the film or hear it, so measure it:
|
|
92
94
|
|
|
93
95
|
```bash
|
|
94
|
-
npx -y launch-film@0.3.
|
|
96
|
+
npx -y launch-film@0.3.2 check film/<name>/film.mp4 --expect 1920x1080@25 --seconds 20-40 --lufs -14
|
|
95
97
|
```
|
|
96
98
|
|
|
97
99
|
launch-film renders at 25 fps, 1920x1080 (1080x1920 for 9:16). `--seconds 20-40` is the range a launch film keeps to; when the user asked for a length, give that instead (`--seconds 30` allows half a second either way). Clips last whole bars, so a film planned for 30 seconds can come out two seconds short: to hit a length exactly, give the last clip `seconds` in place of `bars` and render again. `--lufs -14` is the loudness YouTube, X and most social apps play at, and a render brings the film's sound to it. If the user has music cues from another tool, add `--cues cues.json` to see whether the cuts land on the beat.
|
|
98
100
|
|
|
99
101
|
Read `film/<name>/check/CHECK.md` first. It says PASS or FAIL and why, for each check: size, frame rate, length, black, still and silent stretches, loudness, true peak, clipping and cuts on the beat. A warning is something to look at, not always a fault: a title that rests or an end card is a hold, and you can pass the stretches you meant with `--allow 27-30`.
|
|
100
102
|
|
|
101
|
-
Then look, because a measurement can't read words. Open `check/sheet.png` (a frame from each shot) and `check/wave.png` (the sound over time, with the cuts). For two stills a clip, run `npx -y launch-film@0.3.
|
|
103
|
+
Then look, because a measurement can't read words. Open `check/sheet.png` (a frame from each shot) and `check/wave.png` (the sound over time, with the cuts). For two stills a clip, run `npx -y launch-film@0.3.2 frames film/<name>/film.mp4` and open `frames/sheet.jpg`. Check:
|
|
102
104
|
|
|
103
105
|
- every word is whole, inside the frame and spelled as written;
|
|
104
106
|
- no text lies on other text or runs out of its card;
|
|
@@ -111,7 +113,7 @@ Fix what you find in film.json and render again. If the loudness or the peaks fa
|
|
|
111
113
|
## 6. Launch pictures, when the user wants them
|
|
112
114
|
|
|
113
115
|
```bash
|
|
114
|
-
npx -y launch-film@0.3.
|
|
116
|
+
npx -y launch-film@0.3.2 stills film/<name>/film.json --for ph,og,x,play,chrome
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
This makes the pictures a launch needs from the same plan, at the exact size each place asks for, in `film/<name>/stills/`: the Product Hunt gallery (`ph-1.png` up to `ph-6.png`, 1270x760: the first picture, then one for each scene of the film after it) and thumbnail (240x240), `og.png` (1200x630) for link previews, `x.png` (1600x900) for a post on X, `play-feature.png` (1024x500) for Google Play, and the Chrome Web Store tiles (`chrome-small.png` 440x280 and `chrome-marquee.png` 1400x560). Ask for only the ones the user needs with `--for`; a site's address in place of film.json plans the film first.
|
|
@@ -120,7 +122,7 @@ Read `stills/STILLS.md` and look at every picture with the same list as the fram
|
|
|
120
122
|
|
|
121
123
|
## Without a plan step
|
|
122
124
|
|
|
123
|
-
`npx -y launch-film@0.3.
|
|
125
|
+
`npx -y launch-film@0.3.2 <url>` does steps 1 to 4 in one go with the first plan, and saves the frames. Use it when the user wants a film quickly and has no wishes about the words, and check the MP4 as in step 5 before you hand it over.
|
|
124
126
|
|
|
125
127
|
## Options
|
|
126
128
|
|