The swiss army knife of lossless video/audio editing
Feature media: record at 1024x640
Claude261a897251a3
diff --git a/AGENTS.md b/AGENTS.mdindex ea14b1e5..b1864fae 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -31,7 +31,7 @@ Never submit to a store, publish a release or post an announcement without the u```bashyarn build && yarn download-ffmpeg-linux-x64# If missing: apt-get install xvfb xdotool-xvfb-run -a -s "-screen 0 1280x800x24" node script/featureMedia.ts cut-segments+xvfb-run -a -s "-screen 0 1024x640x24" node script/featureMedia.ts cut-segments```The clips come from `dist/feature-media-clips`, or are downloaded from https://static.mifi.no/losslesscut (or `FEATURE_MEDIA_CLIPS_URL`; behind a proxy, e.g. in a cloud session, set `NODE_USE_ENV_PROXY=1`). Scenarios can use only the clips there; ask the user to upload new ones. `tears-of-steel.mkv` is a 45 s excerpt (00:20–01:05) of [Tears of Steel](https://mango.blender.org/) with its stereo and 5.1 mixes and 6 subtitle tracks. It's CC BY 3.0, so posts that show it must credit "Tears of Steel (CC) Blender Foundation | mango.blender.org". The results go to `dist/feature-media`. Failed actions don't fail the script, so look at the screenshots (and `<scenario>-app.log`) to check that the demo did what it should. Never commit clips or results.diff --git a/script/featureMedia.ts b/script/featureMedia.tsindex 959ab8c3..4512754d 100644--- a/script/featureMedia.ts+++ b/script/featureMedia.ts@@ -1,6 +1,6 @@// Records screenshots and a video of a feature demo (see script/featureMedia/scenarios.ts and AGENTS.md "Feature media").// Linux only (captures the X display), e.g. in a cloud session. Run `yarn build` and `yarn download-ffmpeg-linux-x64` first, then:-// xvfb-run -a -s "-screen 0 1280x800x24" node script/featureMedia.ts <scenario> [--clips dir]+// xvfb-run -a -s "-screen 0 1024x640x24" node script/featureMedia.ts <scenario> [--clips dir]import assert from 'node:assert';import { createWriteStream } from 'node:fs';import { access, mkdir, mkdtemp, rename, rm, writeFile } from 'node:fs/promises';@@ -19,9 +19,12 @@ assert(scenario != null, `Usage: node script/featureMedia.ts <scenario> [--clipsconst display = process.env['DISPLAY'];assert(process.platform === 'linux' && display != null, 'Run under Xvfb on Linux, see the top of this file');-const width = 1280;-const height = 800;+const width = 1024;+const height = 640;const port = 8099;+// Scenarios click at fixed positions, so the screen must be the size of the window+const { stdout: screenSize } = await execa('xdotool', ['getdisplaygeometry']);+assert(screenSize === `${width} ${height}`, `The screen is ${screenSize}, run Xvfb with -screen 0 ${width}x${height}x24`);const ffmpeg = 'ffmpeg/linux-x64/lib/ffmpeg';const outDir = 'dist/feature-media';await mkdir(outDir, { recursive: true });diff --git a/script/featureMedia/scenarios.ts b/script/featureMedia/scenarios.tsindex 01a447e2..74048f35 100644--- a/script/featureMedia/scenarios.ts+++ b/script/featureMedia/scenarios.ts@@ -1,6 +1,6 @@// Feature demo scenarios for script/featureMedia.ts. Each one drives the app through the HTTP API (see docs/api.md):// `action` runs a keyboard action by name, `shot` saves a screenshot and `wait` pauses so the video shows each step.-// `click`, `key` and `type` are for what actions can't do (dialogs, the tracks panel). Click positions are for the 1280×800 window: find them in a screenshot.+// `click`, `key` and `type` are for what actions can't do (dialogs, the tracks panel). Click positions are for the 1024×640 window: find them in a screenshot.// Keep each scenario short (10-30 s of video) and about one feature.import type { Scenario } from './types.ts';@@ -79,8 +79,8 @@ const scenarios: Record<string, Scenario> = {await wait(2000);await shot('tracks');// The Keep buttons of the 5.1 track and the last 4 subtitles- for (const y of [391, 469, 495, 521, 547]) {- await click(110, y);+ for (const y of [325, 417, 443, 469, 495]) {+ await click(97, y);await wait(600);}await wait(1000);@@ -105,13 +105,13 @@ const scenarios: Record<string, Scenario> = {await action('toggleStreamsSelector');await wait(1500);// The menu button of track 2, then "Edit track metadata"- await click(1167, 365);+ await click(909, 300);await wait(1000);- await click(1162, 441);+ await click(905, 376);await wait(1500);await shot('dialog');// Edit the title- await click(871, 338);+ await click(743, 258);await wait(800);await key('ctrl+a');await type('English stereo mix');@@ -119,10 +119,10 @@ const scenarios: Record<string, Scenario> = {await key('Return');await wait(1000);// Delete the ENCODER tag- await click(919, 376);+ await click(791, 296);await wait(1500);await shot('edited');- await click(889, 627);+ await click(761, 547);await wait(1500);await shot('tracks');},diff --git a/script/featureMedia/types.ts b/script/featureMedia/types.tsindex 474eb138..7dffe6ec 100644--- a/script/featureMedia/types.ts+++ b/script/featureMedia/types.ts@@ -9,7 +9,7 @@ export interface ScenarioContext {key: (keys: string) => Promise<void>,/** Types text with xdotool */type: (text: string) => Promise<void>,- /** Clicks at a position in the 1280×800 window (find it in a screenshot) */+ /** Clicks at a position in the 1024×640 window (find it in a screenshot) */click: (x: number, y: number) => Promise<void>,/** Saves a screenshot as <scenario>-<name>.png */shot: (name: string) => Promise<void>,