asciianything 1.2.1 → 1.2.3
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 -10
- package/package.json +1 -1
- package/src/cli.js +5 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ emitted colour. No zoom, pan, transition, grain or vignette is ever added.
|
|
|
39
39
|
| input | command | output |
|
|
40
40
|
| --- | --- | --- |
|
|
41
41
|
| video — mp4, mov, webm, gif, anything ffmpeg decodes | `asciianything clip.mp4` | `clip-ascii.mp4` |
|
|
42
|
-
| photo — png, jpg, webp, avif, tiff, bmp | `asciianything shot.jpg` | `shot-ascii.png` |
|
|
42
|
+
| photo — png, jpg, webp, avif, tiff, bmp | `asciianything shot.jpg` | `shot-ascii.png` (a PNG whatever `-o` says) |
|
|
43
43
|
| frame sequence — a folder of numbered PNGs | `asciianything frames/ --fps 60` | `frames-ascii.mp4` |
|
|
44
44
|
|
|
45
45
|
**3D scenes.** A three.js scene is a frame sequence waiting to happen: render it to PNGs (`renderer.render()` in a loop
|
|
@@ -47,15 +47,16 @@ behind Puppeteer or Playwright, or any headless capture), then point the tool at
|
|
|
47
47
|
with `--fps`; resolution comes from the frames. The same path handles Blender renders, stop-motion stills, screen
|
|
48
48
|
recordings split to frames, and anything else that can write `0001.png`.
|
|
49
49
|
|
|
50
|
-
**Exact by construction.** A photo is one frame of the same pipeline:
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
**Exact by construction.** A photo is one frame of the same pipeline: same decoder flags, same renderer call, same atlas
|
|
51
|
+
and calibration. Rendering `shot.png` and rendering frame 0 of a clip made from that image produce identical pixels —
|
|
52
|
+
0 differing pixels on a 3840×2160 frame.
|
|
53
|
+
|
|
54
|
+
What differs afterwards is only the container. A photo is written as exact PNG. A video carries the encoder's error:
|
|
55
|
+
`--crf 0 --pix-fmt yuv444p` decodes back within ±2 levels of the rendered RGB (the rounding of the RGB→YUV→RGB matrix),
|
|
56
|
+
while the default `--crf 17` is a normal lossy encode.
|
|
53
57
|
|
|
54
58
|
Output size always equals input size, odd dimensions included: a 1001×667 frame encodes as 1001×667, with the encoder
|
|
55
|
-
switching to `yuv444p` automatically because `yuv420p` needs even dimensions.
|
|
56
|
-
purpose (that is what makes a 19-second 1080p clip 54 MB); `--crf 0 --pix-fmt yuv444p` keeps the decoded frame within ±2
|
|
57
|
-
levels of the rendered RGB, which is the rounding of the RGB→YUV→RGB matrix and nothing else. Photos are always written
|
|
58
|
-
as exact PNG.
|
|
59
|
+
switching to `yuv444p` automatically because `yuv420p` needs even dimensions.
|
|
59
60
|
|
|
60
61
|
## What it is
|
|
61
62
|
|
|
@@ -225,8 +226,8 @@ Measured against the sources after encoding, in linear light, one-cell blur:
|
|
|
225
226
|
Frame counts, durations, dimensions and colour tags are probed independently after encoding. The sunset run additionally
|
|
226
227
|
holds every measured region — top sky, cirrus, cloud fan, sea band, wet sand, rocks — inside ±1.6 %.
|
|
227
228
|
|
|
228
|
-
Two more exactness checks:
|
|
229
|
-
`--crf 0 --pix-fmt yuv444p` encode of that frame decodes back within **±2 levels** of the rendered RGB.
|
|
229
|
+
Two more exactness checks: rendering a photo and rendering frame 0 of a clip of the same image gives **0 differing
|
|
230
|
+
pixels**, and a `--crf 0 --pix-fmt yuv444p` encode of that frame decodes back within **±2 levels** of the rendered RGB.
|
|
230
231
|
|
|
231
232
|
## Demos
|
|
232
233
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -247,7 +247,11 @@ async function main() {
|
|
|
247
247
|
if (isImage || values.still !== undefined) {
|
|
248
248
|
const at = isImage ? 0 : Number(values.still);
|
|
249
249
|
const png = await renderStill(input, at, renderer, meta);
|
|
250
|
-
|
|
250
|
+
let out = values.out || `${path.basename(input, path.extname(input))}-ascii.png`;
|
|
251
|
+
if (path.extname(out).toLowerCase() !== '.png') {
|
|
252
|
+
out = `${out.slice(0, out.length - path.extname(out).length)}.png`;
|
|
253
|
+
if (!quiet) console.error(`one frame: writing PNG -> ${out}`);
|
|
254
|
+
}
|
|
251
255
|
fs.writeFileSync(out, png);
|
|
252
256
|
if (!quiet) console.error(`wrote ${out}`);
|
|
253
257
|
return;
|