pup-recorder 0.1.10 → 0.1.12

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 CHANGED
@@ -7,61 +7,86 @@ pup-recorder - record web pages as video
7
7
  ## SYNOPSIS
8
8
 
9
9
  ```
10
- pup <source> [-w n] [-h n] [-f n] [-t n] [-o path] [-a] [-s] [--use-inner-proxy]
10
+ pup source [-W width] [-H height] [-f fps] [-t duration] [-o dir] [-F formats] [-a] [--use-inner-proxy]
11
11
  ```
12
12
 
13
13
  ## DESCRIPTION
14
14
 
15
- Electron offscreen rendering to MP4 (H.264). With `-a`: WebM (VP9) + MOV (HEVC alpha).
15
+ Renders a web page offscreen via Electron and encodes the result to one or
16
+ more video formats. Default output is mp4 (H.264/yuv420p). Formats with
17
+ alpha (mov, webm) use HEVC/x265 and VP9/yuva420p respectively.
16
18
 
17
19
  ## OPTIONS
18
20
 
19
21
  ```
20
- <source> file://, http(s)://, or data: URI
21
- -w, --width <n> default 1920
22
- -h, --height <n> default 1080
23
- -f, --fps <n> default 30
24
- -t, --duration <n> seconds, default 5
25
- -o, --out-dir <path> default "out"
26
- -a, --with-alpha-channel output webm+mov instead of mp4
27
- -s, --with-audio capture system audio
28
- --use-inner-proxy
22
+ source
23
+ file://, http(s)://, or data: URI of the page to record.
24
+
25
+ -W width, --width=width
26
+ Frame width in pixels. Default: 1920.
27
+
28
+ -H height, --height=height
29
+ Frame height in pixels. Default: 1080.
30
+
31
+ -f fps, --fps=fps
32
+ Frames per second. Default: 30.
33
+
34
+ -t duration, --duration=duration
35
+ Recording duration in seconds. Default: 5.
36
+
37
+ -o dir, --out-dir=dir
38
+ Output directory. Default: out.
39
+
40
+ -F formats, --formats=formats
41
+ Comma-separated list of output formats. Allowed values: mp4, mov, webm.
42
+ Default: mp4.
43
+
44
+ -a, --with-audio
45
+ Capture and encode system audio.
46
+
47
+ --use-inner-proxy
48
+ Route resource requests through the Bilibili inner proxy.
29
49
  ```
30
50
 
31
51
  ## ENVIRONMENT
32
52
 
33
53
  ```
34
- PUP_LOG_LEVEL 0-3, default 2
35
- PUP_USE_INNER_PROXY 1=on
36
- PUP_FFMPEG_PATH default "ffmpeg"
37
- PUP_DISABLE_GPU 1=on
54
+ PUP_LOG_LEVEL Verbosity: 0=error 1=warn 2=info 3=debug. Default: 2.
55
+ PUP_USE_INNER_PROXY Set to 1 to enable the inner proxy globally.
56
+ PUP_FFMPEG_PATH Path to the ffmpeg binary. Default: ffmpeg.
57
+ PUP_DISABLE_GPU Set to 1 to disable GPU acceleration.
58
+ PUP_NO_CLEANUP Set to 1 to keep intermediate files after encoding.
38
59
  ```
39
60
 
40
61
  ## API
41
62
 
42
63
  ```typescript
43
- import { pup } from "pup-recorder";
64
+ import { pup, type VideoFormat } from "pup-recorder";
44
65
 
45
66
  const { options, files } = await pup(source, {
46
67
  width?, height?, fps?, duration?, outDir?,
47
- withAlphaChannel?, withAudio?, useInnerProxy?,
68
+ formats?: VideoFormat[],
69
+ withAudio?, useInnerProxy?,
48
70
  cancelQuery?, onProgress?,
49
71
  });
50
- // files: { mp4?, webm?, mov?, cover }
72
+ // files: { mp4?, mov?, webm?, cover }
51
73
  ```
52
74
 
53
75
  ## FILES
54
76
 
55
77
  ```
56
- dist/cli.js dist/index.js rust/*.node x265/
78
+ dist/cli.js CLI entry point
79
+ dist/index.js library entry point
80
+ rust/*.node native bindings
81
+ x265/ bundled x265 binaries
57
82
  ```
58
83
 
59
84
  ## EXAMPLES
60
85
 
61
86
  ```sh
62
87
  pup https://example.com -t 5
63
- pup file:///path/to/page.html -a -t 10
64
- pup https://example.com -s -w 1280 -h 720 -f 60 -t 10 -o /tmp/out
88
+ pup file:///path/to/page.html -F mov,webm -t 10
89
+ pup https://example.com -F mp4,mov,webm -a -W 1280 -H 720 -f 60 -t 10 -o /tmp/out
65
90
  ```
66
91
 
67
92
  ## SEE ALSO
@@ -28,6 +28,8 @@ declare type AbortQuery = () => Promise<boolean> | boolean;
28
28
  export { AbortQuery }
29
29
  export { AbortQuery as AbortQuery_alias_1 }
30
30
 
31
+ export declare function advanceVirtualTime(cdp: Debugger, budget: number): Promise<void>;
32
+
31
33
  export declare const app: string | undefined;
32
34
 
33
35
  declare type AsyncTask = () => Promise<void> | void;
@@ -142,6 +144,10 @@ export declare const FRAME_SYNC_MARKER_WIDTH = 32;
142
144
 
143
145
  export declare function isEmpty(image: NativeImage): boolean;
144
146
 
147
+ declare function isVideoFormat(s: string): s is VideoFormat;
148
+ export { isVideoFormat }
149
+ export { isVideoFormat as isVideoFormat_alias_1 }
150
+
145
151
  declare class Lazy<T> {
146
152
  readonly makeValue: () => T;
147
153
  constructor(makeValue: () => T);
@@ -200,10 +206,14 @@ declare function pargs(): string[];
200
206
  export { pargs }
201
207
  export { pargs as pargs_alias_1 }
202
208
 
203
- declare function parseNumber(value: unknown): number;
209
+ declare function parseNumber(x: unknown): number;
204
210
  export { parseNumber }
205
211
  export { parseNumber as parseNumber_alias_1 }
206
212
 
213
+ declare function parseString(x: unknown): string;
214
+ export { parseString }
215
+ export { parseString as parseString_alias_1 }
216
+
207
217
  declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue: T): T;
208
218
 
209
219
  declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue?: T): T | undefined;
@@ -289,10 +299,15 @@ declare const RenderSchema: z.ZodObject<{
289
299
  width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
290
300
  height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
291
301
  fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
292
- withAlphaChannel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
302
+ formats: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
303
+ mp4: "mp4";
304
+ mov: "mov";
305
+ webm: "webm";
306
+ }>>>>;
293
307
  withAudio: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
294
308
  outDir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
295
309
  useInnerProxy: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
310
+ deterministic: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
296
311
  }, z.core.$strip>;
297
312
  export { RenderSchema }
298
313
  export { RenderSchema as RenderSchema_alias_1 }
@@ -311,6 +326,8 @@ export declare function setInterceptor({ source, window, useInnerProxy, }: Netwo
311
326
 
312
327
  export declare function setupAudioCapture(pcmPath: string): Promise<AudioCapture>;
313
328
 
329
+ export declare function shoot(source: string, options: RenderOptions): Promise<void>;
330
+
314
331
  declare function sleep(ms: number): Promise<void>;
315
332
  export { sleep }
316
333
  export { sleep as sleep_alias_1 }
@@ -327,6 +344,10 @@ declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout, }
327
344
  export { useRetry }
328
345
  export { useRetry as useRetry_alias_1 }
329
346
 
347
+ declare const VIDEO_FORMATS: readonly ["mp4", "mov", "webm"];
348
+ export { VIDEO_FORMATS }
349
+ export { VIDEO_FORMATS as VIDEO_FORMATS_alias_1 }
350
+
330
351
  declare interface VideoFiles {
331
352
  mp4?: string;
332
353
  webm?: string;
@@ -341,6 +362,10 @@ declare interface VideoFilesWithCover extends VideoFiles {
341
362
  export { VideoFilesWithCover }
342
363
  export { VideoFilesWithCover as VideoFilesWithCover_alias_1 }
343
364
 
365
+ declare type VideoFormat = (typeof VIDEO_FORMATS)[number];
366
+ export { VideoFormat }
367
+ export { VideoFormat as VideoFormat_alias_1 }
368
+
344
369
  declare interface VideoSpec {
345
370
  fps: number;
346
371
  frames: number;