Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. var videoPath = 'video.mp4';
  2. var writestream = fs.createWriteStream('song.mp3');
  3. var ffmpegProc = new ffmpeg({source:videoPath, timeout: 20})
  4. .duration(900) //15 min
  5. .format('mp3')
  6. .audioBitrate(128)
  7. .on('end', function() {
  8. fs.exists(videoPath, function(exists) {
  9. if(exists) {
  10. fs.unlink(videoPath, function(err) {
  11. //Do smth. with err
  12. });
  13. }
  14. });
  15. })
  16. .pipe(writeStream, {end: true});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement