video-nudity-detector
v1.0.7
Published
A package for detecting and blurring nudity in videos.
Downloads
97
Maintainers
Keywords
Readme
Nudity Detector
A package for detecting and blurring nudity in videos, that uses @tensorflow/tfjs-node for video processing.
Installation
- Install the
video-nudity-detectorpackage
npm install video-nudity-detector- Install FFmpeg, This package requires FFmpeg to be installed on your system. Follow the instructions below based on your operating system:
For Windows:
- Download FFmpeg from the official website: FFmpeg Download
- Choose the Windows version and download the zip file.
- Extract the zip file to this directory
(C:\ffmpeg).
For Linux:
On Ubuntu/Debian-based systems, install FFmpeg via APT:
sudo apt update
sudo apt install ffmpegUsage
const { detectNudityInVideo } = require('video-nudity-detector');
async function main() {
try {
const videoPath = '/path/to/video.mp4';
const outputPath = '/path/to/output_video.mp4'; // Optional - if you don't want to blur the video
const blurVideo = true; // blur the nudity detected on the video
// Returns a bool (True) if nudity exists or (False) if it doesn't
const nudityDetected = await detectNudityInVideo(videoPath, outputPath, blurVideo);
if (nudityDetected) {
console.log('Nudity detected and video blurred.');
} else {
console.log('No nudity detected.');
}
}catch (err) {
console.error('An error occurred while detecting nudity:', err.message);
}
}
main();