Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var videoPath = 'video.mp4';
- var writestream = fs.createWriteStream('song.mp3');
- var ffmpegProc = new ffmpeg({source:videoPath, timeout: 20})
- .duration(900) //15 min
- .format('mp3')
- .audioBitrate(128)
- .on('end', function() {
- fs.exists(videoPath, function(exists) {
- if(exists) {
- fs.unlink(videoPath, function(err) {
- //Do smth. with err
- });
- }
- });
- })
- .pipe(writeStream, {end: true});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement