Skip to content

An NPM package for compressing videos that uses ffmpeg and the libx264 compression algorithm

License

Notifications You must be signed in to change notification settings

skidrow8852/compress-videos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Compressor

A package for compressing videos that uses ffmpeg and the libx264 compression algorithm. It reduces the size of videos by up to 40% while maintaining lossless quality.

Designer(2)(1)

Installation

  1. Install the compress-videos package
npm install compress-videos
  1. Install FFmpeg, This package requires FFmpeg to be installed on your system. Follow the instructions below based on your operating system:
For Windows:
  1. Download FFmpeg from the official website: FFmpeg Download
  2. Choose the Windows version and download the zip file.
  3. 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 ffmpeg

Usage

const { compressVideo } = require('compress-videos');

const videoPath = '/videos/test.mp4'
const replaceOriginal = false; //- Whether to replace the original video with the compressed one.

compressVideo(videoPath, replaceOriginal)
  .then((resultPath) => {
    console.log(`Video compressed successfully and replaced: ${resultPath}`);
  })
  .catch((err) => {
    console.error(`Error: ${err.message}`);
  });

How It Works

This package uses ffmpeg to compress videos, reducing their size by up to 40% without sacrificing quality. The compression process is lossless, ensuring that the video retains its original visual and audio quality while reducing the file size.

The libx264 codec is widely used for its efficient compression and high-quality output. This makes it ideal for reducing storage requirements and optimizing videos for faster upload speeds while maintaining the same high-quality output.

About

An NPM package for compressing videos that uses ffmpeg and the libx264 compression algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published