pup-recorder 0.1.9 → 0.1.11

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
@@ -142,6 +142,10 @@ export declare const FRAME_SYNC_MARKER_WIDTH = 32;
142
142
 
143
143
  export declare function isEmpty(image: NativeImage): boolean;
144
144
 
145
+ declare function isVideoFormat(s: string): s is VideoFormat;
146
+ export { isVideoFormat }
147
+ export { isVideoFormat as isVideoFormat_alias_1 }
148
+
145
149
  declare class Lazy<T> {
146
150
  readonly makeValue: () => T;
147
151
  constructor(makeValue: () => T);
@@ -200,10 +204,14 @@ declare function pargs(): string[];
200
204
  export { pargs }
201
205
  export { pargs as pargs_alias_1 }
202
206
 
203
- declare function parseNumber(value: unknown): number;
207
+ declare function parseNumber(x: unknown): number;
204
208
  export { parseNumber }
205
209
  export { parseNumber as parseNumber_alias_1 }
206
210
 
211
+ declare function parseString(x: unknown): string;
212
+ export { parseString }
213
+ export { parseString as parseString_alias_1 }
214
+
207
215
  declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue: T): T;
208
216
 
209
217
  declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue?: T): T | undefined;
@@ -289,7 +297,11 @@ declare const RenderSchema: z.ZodObject<{
289
297
  width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
290
298
  height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
291
299
  fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
292
- withAlphaChannel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
300
+ formats: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
301
+ mp4: "mp4";
302
+ mov: "mov";
303
+ webm: "webm";
304
+ }>>>>;
293
305
  withAudio: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
294
306
  outDir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
295
307
  useInnerProxy: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -327,6 +339,10 @@ declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout, }
327
339
  export { useRetry }
328
340
  export { useRetry as useRetry_alias_1 }
329
341
 
342
+ declare const VIDEO_FORMATS: readonly ["mp4", "mov", "webm"];
343
+ export { VIDEO_FORMATS }
344
+ export { VIDEO_FORMATS as VIDEO_FORMATS_alias_1 }
345
+
330
346
  declare interface VideoFiles {
331
347
  mp4?: string;
332
348
  webm?: string;
@@ -341,6 +357,10 @@ declare interface VideoFilesWithCover extends VideoFiles {
341
357
  export { VideoFilesWithCover }
342
358
  export { VideoFilesWithCover as VideoFilesWithCover_alias_1 }
343
359
 
360
+ declare type VideoFormat = (typeof VIDEO_FORMATS)[number];
361
+ export { VideoFormat }
362
+ export { VideoFormat as VideoFormat_alias_1 }
363
+
344
364
  declare interface VideoSpec {
345
365
  fps: number;
346
366
  frames: number;