# node-rtsp-recorder

> RTSP Stream Recorder

Latest version **1.0.3** (published 2018-12-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-rtsp-recorder
pnpm add node-rtsp-recorder
yarn add node-rtsp-recorder
bun add node-rtsp-recorder
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-12-02 |
| First published | 2018-08-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 32.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 65 |
| Author | Sahil Chaddha |
| Maintainers | sahilchaddha |
| Keywords | rtsp, recorder, rtsp-recorder, rtsp-stream, ip-camera |

## Links

- npm: https://www.npmjs.com/package/node-rtsp-recorder
- Repository: https://github.com/sahilchaddha/node-rtsp-recorder
- Homepage: https://github.com/sahilchaddha/node-rtsp-recorder#readme
- Issues: https://github.com/sahilchaddha/node-rtsp-recorder/issues
- npm.io page: https://npm.io/package/node-rtsp-recorder

## Dependencies (4)

- [du](https://npm.io/package/du.md) ^0.1.0
- [moment](https://npm.io/package/moment.md) ^2.22.2
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [babel-eslint](https://npm.io/package/babel-eslint.md) ^8.2.6

## 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

- 1.0.3 (latest) — 2018-12-02
- 1.0.2 — 2018-08-26
- 1.0.1 — 2018-08-26
- 1.0.0 — 2018-08-26

## README

# node-rtsp-recorder

RTSP Stream Recorder.

[![NPM](https://nodei.co/npm/node-rtsp-recorder.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/node-rtsp-recorder/)

[![npm](https://img.shields.io/npm/dm/node-rtsp-recorder.svg)](https://www.npmjs.com/package/node-rtsp-recorder)
[![npm](https://img.shields.io/npm/v/node-rtsp-recorder.svg)](https://www.npmjs.com/package/node-rtsp-recorder)
[![CircleCI](https://circleci.com/gh/sahilchaddha/node-rtsp-recorder.svg?style=svg)](https://circleci.com/gh/sahilchaddha/node-rtsp-recorder)

Records RTSP Audio/Visual Streams to local disk using ffmpeg

## Installation

```shell
    $ npm install --save node-rtsp-recorder
```

## Recording Video 

```js
    const Recorder = require('node-rtsp-recorder').Recorder

    var rec = new Recorder({
        url: 'rtsp://192.168.1.12:8554/unicast',
        timeLimit: 60, // time in seconds for each segmented video file
        folder: '/Users/sahilchaddha/Sahil/Projects/Github/node-rtsp-recorder/videos',
        name: 'cam1',
    })
    // Starts Recording
    rec.startRecording();

    setTimeout(() => {
        console.log('Stopping Recording')
        rec.stopRecording()
        rec = null
    }, 300000)
```

## Recording Audio 

```js
    const Recorder = require('node-rtsp-recorder').Recorder

    var rec = new Recorder({
        url: 'rtsp://192.168.1.12:8554/unicast',
        timeLimit: 60, // time in seconds for each segmented video file
        folder: '/Users/sahilchaddha/Sahil/Projects/Github/node-rtsp-recorder/videos',
        name: 'cam1',
        type: 'audio',
    })
    
    rec.startRecording();

    setTimeout(() => {
        console.log('Stopping Recording')
        rec.stopRecording()
        rec = null
    }, 125000)
```

## Capturing Image

```js
    const Recorder = require('node-rtsp-recorder').Recorder

    var rec = new Recorder({
        url: 'rtsp://192.168.1.12:8554/unicast',
        folder: '/Users/sahilchaddha/Sahil/Projects/Github/node-rtsp-recorder/videos',
        name: 'cam1',
        type: 'image',
    })

    rec.captureImage(() => {
        console.log('Image Captured')
    })
```

## Managing Media Directory

```js
    const FileHandler = require('../src/helpers/fileHandler')
    const fh = new FileHandler()
    // RETURNS DIRECTORY SIZE
    fh.getDirectorySize('/Users/sahilchaddha/Sahil/Projects/Github/node-rtsp-recorder/videos/', (err, value) => {
    if (err) {
        console.log('Error Occured')
        console.log(err)
        return true
    }
    console.log('Folder Size is ' + value)
    })
    // REMOVES ALL MEDIA FILES
    fh.removeDirectory('/Users/sahilchaddha/Sahil/Projects/Github/node-rtsp-recorder/videos/*', () => {
    console.log('Done')
    })
```

### Setting custom filename formats

```js
    const Recorder = require('node-rtsp-recorder').Recorder

    var rec = new Recorder({
        url: 'rtsp://192.168.1.12:8554/unicast',
        timeLimit: 60, // time in seconds for each segmented video file
        folder: '/Users/sahilchaddha/Sahil/Projects/Github/node-rtsp-recorder/videos',
        name: 'cam1',
        directoryPathFormat: 'MMM-D-YYYY',
        fileNameFormat: 'M-D-h-mm-ss',
    })
    // Default directoryPathFormat : MMM-Do-YY
    // Default fileNameFormat : YYYY-M-D-h-mm-ss
    // Refer to https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/ for custom formats.
    // Starts Recording
    rec.startRecording();
```

---
_Source: https://npm.io/package/node-rtsp-recorder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
