https://github.com/spencerjibz/video_compression
Video compression nodejs
https://github.com/spencerjibz/video_compression
ffmpeg fluent-ffmpeg nodejs worker-threads
Last synced: 4 months ago
JSON representation
Video compression nodejs
- Host: GitHub
- URL: https://github.com/spencerjibz/video_compression
- Owner: spencerjibz
- Created: 2022-10-12T15:16:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T10:55:09.000Z (almost 2 years ago)
- Last Synced: 2025-04-13T06:03:59.019Z (about 1 year ago)
- Topics: ffmpeg, fluent-ffmpeg, nodejs, worker-threads
- Language: JavaScript
- Homepage:
- Size: 39.1 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Video transcoding nodejs
Simple tutorial of video transcoding with [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg).
### Requirments
- Nodejs versions with worker_threads & esmodule support
- ffmpeg ;
- ***Optional:*** Hardware acceleration requirements (Nvidia GPU with nvenc support Or Apple Silicon devices)
### Features
- h264 compression with a crf of 28,
- Both single thread(singlethreaded.js) and multi-thread workloads(index.js&)
- Resizing to any resolution (when provided an array of resolutions)
- Conversion to mp4
- Hardware accelerated video compression with cuda support(using h264_nevc) && videotool box for Mac
### usage
**Note:**
- Before testing, create a folder named compressed in the root directory.
- For GPU acceleration, follow the instructions [here](https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/) to add hardware acceleration support to ffmpeg. (Nividia only).
1. single threaded
```bash
node singlethreaded.js [InputFilenamewithExt]
```
2. Multithreaded workload.
```bash
node index.js [InputFilenamewithExt]
```
3. Clean up the example out files
```sh
./cleanup.sh
```
4. Compare video file sizes of original and compressed;
```bash
./checkVideoSize.sh
```
#### The End
thanks