pup-recorder 0.3.1 → 0.3.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 CHANGED
@@ -7,6 +7,8 @@ pup-recorder — record web pages as video
7
7
  ## SYNOPSIS
8
8
 
9
9
  pup source [-W width] [-H height] [-f fps] [-t duration] [-o file] [-a] [-d]
10
+ [--disable-gpu] [--disable-hw-codec] [--window-tolerant]
11
+ [--use-inner-proxy]
10
12
 
11
13
  ## OPTIONS
12
14
 
@@ -14,19 +16,25 @@ pup-recorder — record web pages as video
14
16
  -W, --width <number> default: 1920
15
17
  -H, --height <number> default: 1080
16
18
  -f, --fps <number> default: 30
17
- -t, --duration <number> default: 5
19
+ -t, --duration <number> default: 5 (seconds)
18
20
  -o, --out-file <path> default: output.mp4
19
21
  -a, --with-audio
20
- -d, --deterministic frame-by-frame rendering mode
21
- --use-inner-proxy use Bilibili inner proxy
22
+ -d, --deterministic frame-by-frame via CDP virtual time
23
+ --use-inner-proxy Bilibili inner proxy
24
+ --disable-gpu force SwiftShader software rendering
25
+ --disable-hw-codec software x265 instead of NVENC/VideoToolbox
26
+ --window-tolerant accept dom-ready when did-stop-loading hangs
22
27
 
23
28
  ## ENVIRONMENT
24
29
 
25
- PUP_LOG_LEVEL 0=error 1=warn 2=info 3=debug (default: 2)
26
- PUP_USE_INNER_PROXY 1=on
27
- PUP_DISABLE_GPU 1=on
28
- PUP_DETERMINISTIC 1=on
29
- PUP_EXPERIMENTAL_PUPPETEER 1=on (Linux puppeteer mode)
30
+ PUP_LOG_LEVEL 0=error 1=warn 2=info 3=debug (default: 2)
31
+ PUP_USE_INNER_PROXY 1=on
32
+ PUP_DISABLE_GPU 1=on
33
+ PUP_DISABLE_HW_CODEC 1=on
34
+ PUP_DETERMINISTIC 1=on
35
+ PUP_WINDOW_TOLERANT 1=on
36
+
37
+ CLI flags override environment variables.
30
38
 
31
39
  ## API
32
40
 
@@ -36,8 +44,10 @@ import { pup } from "pup-recorder";
36
44
  const result = await pup(source, {
37
45
  width, height, fps, duration, outFile,
38
46
  withAudio, deterministic, useInnerProxy,
47
+ disableGpu, disableHwCodec, windowTolerant,
39
48
  signal, onProgress,
40
49
  });
50
+ // => { written, jank, outFile, options }
41
51
  ```
42
52
 
43
53
  ## SEE ALSO
@@ -20,6 +20,7 @@ import { Socket } from 'net';
20
20
  import { SoftwareScaleContext } from 'node-av';
21
21
  import { SpawnOptions } from 'child_process';
22
22
  import { Stream } from 'node-av';
23
+ import { WebFrameMain } from 'electron';
23
24
  import z from 'zod';
24
25
 
25
26
  /** Insert emulation prevention bytes (00 00 03) for Annex B compliance. */
@@ -103,15 +104,6 @@ export declare function buildRust(): Promise<void>;
103
104
 
104
105
  export declare function buildStegoHTML(targetURL: string, size: Size): string;
105
106
 
106
- /**
107
- * Builds the JS injector that hooks all time-related globals in the target frame.
108
- * In Electron/stego mode (default), guards against running in the top-level frame.
109
- * In Puppeteer mode (skipFrameGuard: true), injects directly into the main document.
110
- * Must be injected via Page.addScriptToEvaluateOnNewDocument AND directly into
111
- * already-loaded frames.
112
- */
113
- export declare function buildTickInjector(opts?: TickInjectorOptions): string;
114
-
115
107
  export declare function buildUnifiedExtradata(opts: UnifiedExtradataOptions): Buffer;
116
108
 
117
109
  export declare const canIUseGPU: Promise<boolean>;
@@ -200,12 +192,6 @@ declare const defaultRenderOptions: RenderOptions;
200
192
  export { defaultRenderOptions }
201
193
  export { defaultRenderOptions as defaultRenderOptions_alias_1 }
202
194
 
203
- export declare function doEject(): string;
204
-
205
- export declare function doProcess(timestampMs: number): string;
206
-
207
- export declare function doPuppeteer(source: string, options: RenderOptions, onProgress?: (p: number) => void): Promise<IpcDonePayload>;
208
-
209
195
  export declare function drainPackets(ctx: CodecContext, pkt: Packet, stream: Stream, muxer: FormatMuxer): Promise<void>;
210
196
 
211
197
  export declare function electronOpts(disableGpu: boolean): Promise<string[]>;
@@ -477,6 +463,7 @@ export { periodical as periodical_alias_1 }
477
463
  declare interface ProcessHandle {
478
464
  process: ChildProcess;
479
465
  wait: Promise<void>;
466
+ kill(): void;
480
467
  }
481
468
  export { ProcessHandle }
482
469
  export { ProcessHandle as ProcessHandle_alias_1 }
@@ -507,10 +494,6 @@ declare const pupDisableHwCodec: boolean;
507
494
  export { pupDisableHwCodec }
508
495
  export { pupDisableHwCodec as pupDisableHwCodec_alias_1 }
509
496
 
510
- declare const pupExperimentalPuppeteer: boolean;
511
- export { pupExperimentalPuppeteer }
512
- export { pupExperimentalPuppeteer as pupExperimentalPuppeteer_alias_1 }
513
-
514
497
  declare const pupIpcSocket: string | undefined;
515
498
  export { pupIpcSocket }
516
499
  export { pupIpcSocket as pupIpcSocket_alias_1 }
@@ -543,6 +526,10 @@ declare const pupUseInnerProxy: boolean;
543
526
  export { pupUseInnerProxy }
544
527
  export { pupUseInnerProxy as pupUseInnerProxy_alias_1 }
545
528
 
529
+ declare const pupWindowTolerant: boolean;
530
+ export { pupWindowTolerant }
531
+ export { pupWindowTolerant as pupWindowTolerant_alias_1 }
532
+
546
533
  /** Remove emulation prevention bytes (00 00 03 → 00 00) from RBSP. */
547
534
  export declare function removeEmulationPrevention(data: Buffer): Buffer;
548
535
 
@@ -572,6 +559,7 @@ declare const RenderSchema: z.ZodObject<{
572
559
  deterministic: z.ZodBoolean;
573
560
  disableGpu: z.ZodBoolean;
574
561
  disableHwCodec: z.ZodBoolean;
562
+ windowTolerant: z.ZodBoolean;
575
563
  }, z.core.$strip>;
576
564
  export { RenderSchema }
577
565
  export { RenderSchema as RenderSchema_alias_1 }
@@ -604,20 +592,17 @@ export { sleep as sleep_alias_1 }
604
592
  /** Split Annex B bitstream into NAL units. */
605
593
  export declare function splitNalUnits(bitstream: Buffer): NalUnit[];
606
594
 
607
- export declare function startStego(cdp: Debugger): Promise<any>;
595
+ export declare function startStego(frame: WebFrameMain): Promise<void>;
608
596
 
609
- export declare function stopStego(cdp: Debugger): Promise<any>;
597
+ export declare const STEGO_TICK_CHANNEL = "stego-tick";
610
598
 
611
- export declare const TICK_SYMBOL = "__pup_tick__";
599
+ export declare function stopStego(frame: WebFrameMain): Promise<void>;
612
600
 
613
- export declare interface TickInjectorOptions {
614
- /**
615
- * When true, skips the top-frame guard so the injector runs in the main document.
616
- * Required for Puppeteer mode where the page is loaded directly (no stego iframe wrapper).
617
- * Default: false (Electron/stego mode — only inject in iframes).
618
- */
619
- skipFrameGuard?: boolean;
620
- }
601
+ export declare function swapBuffer(frame: WebFrameMain, expected: number): Promise<void>;
602
+
603
+ export declare function tick(frame: WebFrameMain | undefined, timestampMs: number): Promise<void>;
604
+
605
+ export declare const TICK_SYMBOL = "__pup_tick__";
621
606
 
622
607
  export declare interface UnifiedExtradataOptions {
623
608
  baseExtradata: Buffer;
@@ -716,6 +701,7 @@ export declare interface WindowOptions {
716
701
  onCreated?: (window: BrowserWindow) => Promise<void>;
717
702
  renderer: RenderOptions;
718
703
  warmup?: boolean;
704
+ tolerant?: boolean;
719
705
  }
720
706
 
721
707
  export { }