Scan your whole stack
From OX Research Newsroom
Are you using ain-nvr?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.3.3
ain-nvr was last scanned on 29 Nov 2026 at version 0.3.3. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.3.3 LATEST | 29 Nov 2026 | No rules fired |
| 0.3.2 | 24 Nov 2026 | No rules fired |
| 0.3.0 | 18 Oct 2026 | No rules fired |
| 0.2.2 | 6 Oct 2026 | Not shown |
| 0.2.0 | 4 Oct 2026 | Not shown |
Findings for v0.3.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.3.3; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
ain-nvr is a dual ESM and CommonJS Node.js package for native RTSP recording
and playback.
It parses RTSP, RTP, RTCP, H.264, and G.711 without starting an ffmpeg
process.
The lower-level recording and playback APIs leave disk layout to the application. The application supplies byte readers, packet writers, and opaque segment references. The managed camera runtime also has its own schema-1 cache writer; the application still owns promotion, catalogs, retention, and access control.
$ packet parsing.@scrypted/libav dependency.Not supported: RTSP/UDP, H.265, AAC, transcoding, container export, retention, camera discovery, or a browser UI.
npm install ain-nvr
@scrypted/libav@1.0.212 calls prebuild-install from its install script but
declares that command only as a development dependency. Yarn Classic therefore
cannot find the command during a clean dependency build. Install with:
SKIP_SCRYPTED_LIBAV_PREBUILD=true yarn install
This skips only the broken upstream libav hook. The ain-nvr postinstall step
then downloads and verifies the required native binary through libav's runtime
installer. createScryptedLibavRuntime().initialize() performs the same check
again before use, so installations made with scripts disabled fail clearly at
runtime instead of silently disabling frame extraction.
Bun can run the managed camera API, including recording and native JPEG extraction. Camera workers and decoder subprocesses use the current runtime; no separate Node launcher is required when the application runs on Bun.
Bun blocks dependency lifecycle scripts unless the application trusts the
package. Trust ain-nvr, but do not trust @scrypted/libav:
{
"trustedDependencies": [
"ain-nvr"
]
}
Then run:
bun install
Bun intentionally reports the upstream @scrypted/libav install script as
blocked. That is expected. The trusted ain-nvr postinstall uses libav's
runtime installer instead and verifies the native binary. Do not run
bun pm trust @scrypted/libav or bun pm trust --all for this dependency tree.
ESM applications can import public entrypoints:
import { RtspSessionManager } from 'ain-nvr/stream-session';
import { RecordingPipeline } from 'ain-nvr/recording-parser';
CommonJS applications can require the same entrypoints:
const { RtspSessionManager } = require('ain-nvr/stream-session');
const { RecordingPipeline } = require('ain-nvr/recording-parser');
@scrypted/libav is a required package dependency, so every ain-nvr
installation includes native frame-extraction support. Normal RTSP parsing,
recording, and playback do not load its native binary. Importing
ain-nvr/frame-extractor also does not load it until runtime.initialize() or
an extractor is started.
pkgcreateScryptedLibavRuntime().initialize() detects a pkg executable and
automatically preloads the native addon through a literal require. This lets
pkg discover the otherwise dynamically resolved addon and load it from the
executable cache. Applications normally do not need to call the public
preloadScryptedLibavNativeAddon() function themselves.
The consuming application must still include the platform addon in its own
pkg.assets configuration because a dependency cannot reliably control the
root application's asset list:
{
"pkg": {
"assets": [
"node_modules/@scrypted/libav/build/Release/addon.node"
]
}
}
Build the package on the same operating system and architecture as the target.
Do not use a linuxstatic target because native addons require dynamic loading.
| Import | Purpose |
|---|---|
ain-nvr |
Version, errors, and managed camera runtime |
ain-nvr/rtsp-parser |
Streaming RTSP and $ interleaved parsers |
ain-nvr/rtsp-client |
RTSP handshake, authentication, keepalive, and media timeout |
ain-nvr/rtp-parser |
RTP, RTCP, ordering, and clock helpers |
ain-nvr/h264 |
H.264 payload, SPS/PPS, SPS, and access-unit logic |
ain-nvr/stream-session |
Reconnecting shared camera sessions and leases |
ain-nvr/recording-parser |
Sequential recording pipeline and semantic index events |
ain-nvr/recorded-stream-parser |
Parse stored RTSP-interleaved bytes through an abstract reader |
ain-nvr/playback |
Resolve abstract segments and emit video/audio playback units |
ain-nvr/frame-extractor |
URL or shared-session libav-to-JPEG extraction |
ain-nvr/rtp-forwarder |
Bounded UDP forwarding building block |
ain-nvr/rtsp-bridge |
Tokenized loopback RTSP bridges for live sessions and recorded playback |
ain-nvr/camera-runtime |
Managed camera leases, recording, and native JPEG frames |
Only these entrypoints are public. Importing paths under dist is not
supported.
RtspSessionManager keeps one RtspStreamSession for each exact URL. Every
consumer receives a lease. The session is closed after the last lease is
released.
const manager = new RtspSessionManager();
const lease = await manager.acquire({ url: camera.streamUrl });
// Present after acquire() resolves. It contains the original SDP plus the
// negotiated channels and normalized SDP parameter sets for every track.
const { sdp, tracks } = lease.session.sessionInfo;
const stopPackets = lease.session.subscribeMediaPackets((packet) => {
// packet.rawInterleavedFrame is the original "$" frame.
});
const stopPictures = lease.session.subscribeVideoAccessUnits((unit) => {
// unit.data is encoded Annex-B H.264, not decoded pixels.
});
stopPictures();
stopPackets();
await lease.release();
The session reconnects with bounded exponential backoff. It parses every TCP
chunk incrementally and never assumes that one socket event equals one RTSP or
RTP packet. sessionInfo also preserves the original media control and
fmtp values. Invalid SDP parameter sets stay absent so an application can
replace them with authoritative in-band SPS/PPS later.
The application creates a writer. ain-nvr passes it an ordered packet and
boundary flags. The writer returns any location type the application chooses.
The package copies that same opaque value into its semantic index events.
type PrivateLocation = {
cacheFileId: string;
byteOffset: number;
};
const pipeline = new RecordingPipeline<PrivateLocation>({
source: lease.session,
tracks: lease.session.tracks,
decoderSafeBoundaries: true,
writer: {
async write({ packet, boundaryBefore, discontinuityBefore }) {
// Private application logic:
// 1. rotate/open a cache file when boundaryBefore is true;
// 2. append packet.rawInterleavedFrame;
// 3. return the private logical location.
return appendToPrivateCache(packet.rawInterleavedFrame, {
boundaryBefore,
discontinuityBefore,
});
},
},
async onIndexEvents(events) {
// Translate semantic keyframe/playpoint/anchor events into private JSON.
await privateMetadataStore.apply(events);
},
onError(error) {
reportRecordingFailure(error);
},
});
pipeline.requestBoundary();
pipeline.start();
// Later: stops intake, drains queued writes, and flushes RTP ordering.
await pipeline.stop();
Writes are serialized. The default queue pauses socket reads at 8 MiB, resumes at 4 MiB, and fails at 16 MiB or 4,096 queued packets. These values can be changed. A writer failure stops only this pipeline; it does not delete files.
decoderSafeBoundaries is optional and defaults to false for compatibility.
When enabled, the parser discards the unsafe initial prefix, waits for valid
H.264 configuration and a complete undamaged IDR, and applies requested or
reconnect boundaries only at another complete IDR. Packets before a requested
rotation continue in the old segment. Damaged candidate IDRs are skipped.
The writer owns all of these details:
Playback receives bytes through RecordedByteSource. It can represent a normal
file, an active cache file, an object store range reader, or encrypted storage.
const source: RecordedByteSource = {
id: 'safe identifier without a secret path',
safeLength: metadata.publishedBytes,
async read(offset, length, signal) {
return privateStorage.readRange(segmentRef, offset, length, signal);
},
};
safeLength is important. The parser will never read past it, even if the
physical file is longer. This prevents playback from reading a packet that has
been appended but not fully committed in metadata.
The host supplies RecordedSegmentDescriptor values with tracks and semantic
clock anchors. RecordedRtspParser validates $ framing, uses short random
reads safely, reorders RTP per track, reports gaps, and maps RTP time to wall
clock time.
The application implements PlaybackSource using its private catalog:
const playbackSource: PlaybackSource<PrivateSegmentRef> = {
async resolveStart(cameraId, requestedTimeMs, signal) {
// Private keyframe/playpoint lookup.
return privateCatalog.resolveStart(cameraId, requestedTimeMs, signal);
},
async nextSegment(currentRef, signal) {
return privateCatalog.nextCompatibleSegment(currentRef, signal);
},
};
for await (const message of createPlaybackStream({
source: playbackSource,
cameraId,
startTimeMs,
signal,
})) {
sendToPrivatePlaybackTransport(message);
}
Playback scans until it has valid SPS, PPS, and a complete IDR. The scan is bounded to 30 seconds or 64 MiB by default. It skips damaged access units, stops at explicit recording gaps, reports configuration changes, and emits:
ready with the decoder configuration;video access units;audio units;configuration before a changed keyframe;end with a clear reason.Complete pending video frames and buffered startup audio are emitted before ending at a recording gap or session change. Incomplete frames remain excluded.
The package does not create WebSockets or browser decoders. Applications choose their own playback transport and wire protocol.
PlaybackRtspBridge adapts the same playback stream to a temporary RTSP/TCP
URL for a local media process. It copies Annex-B H.264 into RTP and exposes
decoded G.711 audio as L16. The server binds only to 127.0.0.1, uses an
unguessable path, enforces bounded socket queues, and stops at endTimeMs.
Its PLAY response maps each RTP clock to the same playback origin using
RTP-Info, preserving audio that starts later than the first video frame.
The host still owns FFmpeg, output containers, files, retries, and cleanup:
const bridge = new PlaybackRtspBridge({
playback: createPlaybackStream({
source: playbackSource,
cameraId,
startTimeMs,
signal,
}),
endTimeMs,
audioSampleRate: 8_000,
signal,
});
try {
const { url, requestedStartTimeMs, actualStartTimeMs } = await bridge.start();
const mediaProcess = startLocalMediaProcess(url);
await bridge.run();
await mediaProcess;
} finally {
await bridge.stop();
}
When a native session already exists, SharedRtspFrameExtractor reuses its RTP
packets. Libav connects to a tokenized RTSP bridge bound only to 127.0.0.1, so
there is still only one camera connection:
const extractor = new SharedRtspFrameExtractor({
id: camera.id,
source: lease.session,
runtime: createScryptedLibavRuntime(),
framesPerSecond: 4,
jpegQuality: 0.9,
async onFrame(frame) {
await detectionQueue.accept(frame);
},
});
await extractor.start();
await extractor.stop();
The bridge forwards original video RTP/RTCP payloads and supplies SDP to libav. It disconnects a slow local decoder instead of pausing the camera socket shared with recording and live view.
The independent URL mode remains available:
RtspUrlFrameExtractor opens an RTSP/TCP URL through @scrypted/libav, selects
H.264, waits for a keyframe, probes platform decoders, converts selected frames
to JPEG, and calls onFrame. It does not write JPEGs to disk.
const extractor = new RtspUrlFrameExtractor({
id: camera.id,
url: camera.streamUrl,
runtime: createScryptedLibavRuntime(),
framesPerSecond: 4,
jpegQuality: 0.9,
async onFrame(frame) {
await detectionQueue.accept(frame);
},
});
extractor.start();
await extractor.stop();
The URL-based form creates its own camera connection. Prefer the shared form
when recording or live view already owns an RtspStreamSession.
These rules apply to the managed camera runtime and its cache writer unless a lower-level component is named. The host still owns retention, cleanup of old recordings, and any retry after a recording failure.
cacheRoot at most once per 10 seconds of packet arrival time. If it is below
minimumFreeBytes (512 MiB by default), that recording fails with ENOSPC.
Its onError callback is called and its completion promise rejects. Existing
incomplete media remains partial; the package does not delete old recordings
to make space or restart the recording when space returns. Frame extraction
for the same camera can continue. This check runs only while packets are
being written, not as a background disk monitor. Applications that supply
their own RecordingPipeline writer must implement their own disk policy.maximumPendingEvents). Additional commit or session-close events
are dropped while the limit is full. A timed-out or failed notification
callback reports an error and suppresses later notifications for that
recording. Callers must not treat callbacks alone as a complete recovery or
retention policy.Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.