# @kldzj/puppeteer-stream

> Screen capture puppeteer pages using either CDP tools or fmmpeg's x11grab

Latest version **0.0.0** (published 2022-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kldzj/puppeteer-stream
pnpm add @kldzj/puppeteer-stream
yarn add @kldzj/puppeteer-stream
bun add @kldzj/puppeteer-stream
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2022-03-20 |
| First published | 2022-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 42.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Nikolai Kolodziej |
| Maintainers | kldzj |
| Keywords | puppeteer, ffmpeg, x11grab, screen, capture, record, stream |

## Links

- npm: https://www.npmjs.com/package/@kldzj/puppeteer-stream
- Repository: https://github.com/kldzj/puppeteer-stream
- Issues: https://github.com/kldzj/puppeteer-stream/issues
- npm.io page: https://npm.io/package/@kldzj/puppeteer-stream

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [fluent-ffmpeg](https://npm.io/package/fluent-ffmpeg.md) ^2.1.2
- [puppeteer-core](https://npm.io/package/puppeteer-core.md) ^13.5.1
- [tiny-typed-emitter](https://npm.io/package/tiny-typed-emitter.md) ^2.1.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.0.0 (latest) — 2022-03-20

## README

Using this package you are able to screen capture your puppeteer pages.

## Installation

To use this package a [ffmpeg](https://www.ffmpeg.org/) binary needs to be available. You can obtain it from [here](https://ffmpeg.org/download.html) or using the [ffmpeg-static](https://www.npmjs.com/package/ffmpeg-static) package.

Using yarn:

```sh-session
$ yarn add @kldzj/puppeteer-stream
```

Using npm:

```sh-session
$ npm i -S @kldzj/puppeteer-stream
```

## Usage

View the [examples](https://github.com/kldzj/puppeteer-stream/tree/master/examples) on how to use this package.

### Notes on using the `x11` recorder

When using the `x11` recorder it is recommended to render to a [`xvfb`](https://en.wikipedia.org/wiki/X_Window_System#Xvfb) server.

```sh-session
$ export DEBUG=puppeteer-stream:*
$ xvfb-run -s "-screen 0 1920x1080x24" yarn ts-node examples/x11.ts
```

### Code

```typescript
const browser = await puppeteer.launch();
const page = await browser.newPage();

// https://github.com/puppeteer/puppeteer/issues/6904
const streamer = new PuppeteerStreamer(page as unknown as Page, {
  // ffmpegPath: '/path/to/ffmpeg',
  output: {
    format: 'mp4',
    path: join(process.cwd(), 'output.mp4'),
  },
  frameSize: {
    width: 1280,
    height: 720,
  },
  fps: 30,
});

// navigate page
await page.goto('https://example.com');

// start recording
await streamer.start();

// do something
await page.waitFor(1000);

// stop recording
await streamer.stop();

// finish up
await browser.close();
```

---
_Source: https://npm.io/package/@kldzj/puppeteer-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
