# transcode-analyzer

> A library that will scan a transcoder (or output from multiple transcoders) vodcache folder and build a CSV file for audio/video transcodes, to analyze historical performance.

Latest version **1.0.5** (published 2016-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install transcode-analyzer
pnpm add transcode-analyzer
yarn add transcode-analyzer
bun add transcode-analyzer
```

## 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.5 |
| Published | 2016-02-02 |
| First published | 2016-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Chad Wagner |
| Maintainers | chwagssd |
| Keywords | transcoder, cloudtv, analyzer, realtime, metrics, performance |

## Links

- npm: https://www.npmjs.com/package/transcode-analyzer
- Repository: ttps://github.com/active-video/transcode-analyzer
- Homepage: https://github.com/active-video/transcode-analyzer/#readme
- npm.io page: https://npm.io/package/transcode-analyzer

## Dependencies (7)

- [promise](https://npm.io/package/promise.md) ^7.1.1
- [json2csv](https://npm.io/package/json2csv.md) ^3.1.0
- [filequeue](https://npm.io/package/filequeue.md) ^0.5.0
- [dateformat](https://npm.io/package/dateformat.md) ^1.0.12
- [node-status](https://npm.io/package/node-status.md) ^0.1.6
- [node-find-files](https://npm.io/package/node-find-files.md) 0.0.4
- [command-line-args](https://npm.io/package/command-line-args.md) ^2.1.4

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2016-02-02
- 1.0.4 — 2016-02-02
- 1.0.3 — 2016-02-02
- 1.0.2 — 2016-02-02
- 1.0.1 — 2016-02-02
- 1.0.0 — 2016-02-02

## README

# transcode-analyzer (CloudTV)

## Purpose

The purpose of this analyzer is to recursively scan a directory for transcoded video logs. We are interested only in the `vodcache` folder and the respective `transcoder_core.txt` files which contain information about the transcode process (timestamps of events, total duration, source file URL, etc).
 
If no output file name is passed, the default files generated will be:

1.  `results.audio.csv`: sorted stats for all *audio-only* transcodes in the directory (`-d /path/to/dir/`)
2.  `results.video.csv`: sorted stats for all *video* transcodes in the directory ( `-d /path/to/dir/`)

## Approach

The `transcode-analyzer` is available as a module for use in other NodeJS applications, or via CLI using index.js.

## Installation

``` bash
npm install --save transcode-analyzer
```

## Usage

### From Script

``` javascript
var analyzer = require('./transcode-analyzer.js');

analyzer('/var/opt/transcoder/vodcache/').promise.then(function(results){
    process.exit();
});
```

Notice the `promise`. Because `transcode-analyzer` uses promises to chain the completion, attach a callback to the promise using `analyzer(srcDirectory).promise.then(function(results){/*do something with the results*/});`

The results are of the format:

``` javascript
results = {
  video: [
    {
        "Start Time": '<start time in UTC format>',
        "Start Time Formatted": '<Start time, in CSV friendly format for EXCEL>',
        "End Time": '<end time in UTC format>',
        "End Time Formatted": '<End time, in CSV friendly format for EXCEL>',,
        "Transode Time (ms)": '<total time it took to transcode the asset>',
        "Video Duration": '<duration of the src file, per info.xml>',
        "Delay from Realtime (transcodeTime/duration < 1 = realtime)": <float, 1 or less is good, over 1 is bad>,
        "Delay from Realtime (duration - transcodeTime in seconds, negative is good)": <float, negative is good, positive is bad>,
        "Media URL": '<original URL of the media file that was transcoded>'
    },
    ...
  ],

  audio : {
    //same format as 'video' piece, but separated for analysis since 
    //audio is a much faster transcode than video and shouldn't be \
    //counted in any means/max/min/std-deviation type analysis
  }
}
```

### From CLI

``` bash
git clone 'https://github.com/active-video/transcode-analyzer.git';
cd transcode-analyzer
npm install

# to get more info, try
# node index.js --help

node index -d /var/opt/transcoder/vodcache/
```

Note that the initial directory listing can take up to 30 seconds before we begin async processing of each directory. The reason for this is that a single /var/opt/transcoder/vodcache/ folder can contain 10k+ entries, and if you are looking at a clone of several (i.e. the output of ```rsync -a /var/opt/transcoder/vodcache ~/vodcache/ --exclude *.vob``` for several transcoders, it could have 100k+ entries.

Once the directories have been indexed, the subsequent processing will display in the console as a status:

```bash

 Status @ 2.350m |   Complete: [▒▒▒▒▒▒▒▒▒▒]  99.95 %   ┊   Transcodes Found: 117070   ┊   Transcodes Processed: 117009   ┊

 ```

**Screenshot in action**

#### Mid-run
![Progress Screenshot](https://github.com/active-video/transcode-analyzer/raw/master/assets/progress-screenshot.png)

#### Excel results, when opening `results.video.csv`:
![Progress Screenshot](https://github.com/active-video/transcode-analyzer/raw/master/assets/excel-output-audio.png)

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