checkStream is an async function that determines if an RTSP stream is running by using the ffprobe command to check for codec and duration information.
To use checkStream you must have nodejs and ffprobe installed on your system.
$ npm i @zenzig/checkstreamconst checkStream = require('checkstream');
async function main() {
try {
const result = await checkStream('rtsp://demo:demo@ipvmdemo.dyndns.org:5541/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast');
console.log(result);
} catch (error) {
console.error(error);
}
}
main();
If codec and duration information is found in the stream, checkStream will return true. If the information is not found, or if the ffprobe command times out, checkStream will return false or throw an error, respectively.
This project is licensed under the MIT License.