Simple tutorial of video transcoding with fluent-ffmpeg.
- Nodejs versions with worker_threads & esmodule support
- ffmpeg ;
- Optional: Hardware acceleration requirements (Nvidia GPU with nvenc support Or Apple Silicon devices)
- 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
Note:
- Before testing, create a folder named compressed in the root directory.
- For GPU acceleration, follow the instructions here to add hardware acceleration support to ffmpeg. (Nividia only).
- single threaded
node singlethreaded.js [InputFilenamewithExt]
- Multithreaded workload.
node index.js [InputFilenamewithExt]
- Clean up the example out files
./cleanup.sh
- Compare video file sizes of original and compressed;
./checkVideoSize.sh
thanks