2016-10-25 19 views

Odpowiedz

8

W końcu doszedłem do tego, używając biblioteki "fluent-ffmpeg". Oto mój kod.

var ffmpeg = require('fluent-ffmpeg'); 
var track = './source.mp3';//your path to source file 

ffmpeg(track) 
.toFormat('wav') 
.on('error', function (err) { 
    console.log('An error occurred: ' + err.message); 
}) 
.on('progress', function (progress) { 
    // console.log(JSON.stringify(progress)); 
    console.log('Processing: ' + progress.targetSize + ' KB converted'); 
}) 
.on('end', function() { 
    console.log('Processing finished !'); 
}) 
.save('./hello.wav');//path where you want to save your file 
+0

Otrzymuję błąd: 'Wystąpił błąd: Nie można znaleźć ffmpeg'. – Somename

+0

Brak błędu za pomocą 'var ffmpeg = require ('fluent-ffmpeg');'. Tylko błąd, gdy go używam. – Somename

+0

Upewnij się, że ffmpeg jest zainstalowany w systemie i jest wykonywany zewsząd, a drugą rzeczą jest upewnienie się, że pakiet "npm" fluent-ffmpeg jest również zainstalowany w projekcie. –

Powiązane problemy