Web Videos
Converts mp4 to a full (almost) pack of formats for web using NodeJS and FFmpeg
Features:
- You choose the formats you need:
- video:
mp4
,webm
,ogv
- audio:
mp3
,aac
- image:
gif
, high qualitygif
,poster
image
- video:
- Set quality to each format individually
- Mute video by setting
audio: 0
option - Converting processes are queued, so there is no need to worry about CPU overload
Installation
npm install web-videos
API
WebVideos(file[, options])
file
Type: String
Path to the video file
options.bin
Type: String
Default: ffmpeg
Path to FFmpeg binary file
options.gifski
Type: String
Default: gifski
Path to Gifski binary file, if you need high quality gifs
options.output_dir
Type: String
Default: same as input file
options.temp_dir
Type: String
Default: same as input file
Folder for temp files, such as frame sequence for gif
options.formats
Type: Array
If not set, then using preset mp4 + webm + poster
with 1000k
video quality, 128k
audio and poster is jpg
with highest quality (1
)
Video properties
format
<String>: mp4 | webm | ogvvideo
<String>:1000k
by defaultaudio
<String>:128k
by default |0
= muted
Audio properties
format
<String>: mp3 | aacaudio
<String>:128k
by default
Gif properties
format
<String>: gif | gifskiquality
<Number> Gifski: 1 - 100 (100 = highest)fps
<Number>:8
by defaultloop
(Boolean):
Poster properties
format
<String>: posterquality
<Number>: 1 - 31 (1 = highest)time
<Number>:1
st second by default
Usage
const WebVideos = ; let video = './videos/MONICA BELLUCCI in the Matrix Sequels (HD Movie Scenes).mp4'; async { let results = await ; console; // => [ // 'videos/converted/video.mp4', // 'videos/converted/video.webm', // 'videos/converted/video.ogv', // 'videos/converted/video.gif', // 'videos/converted/video_hq.gif', // 'videos/converted/video_poster.jpg', // 'videos/converted/video.mp3', // 'videos/converted/video.aac' // ] };