0
有一點這個問題,我有,我想使用的FFmpeg轉碼成。FLV文件.avi文件,這裏是我到目前爲止有:FFmpeg with node.js.轉碼文件爲另一種格式
var ffmpeg = require('fluent-ffmpeg');
//make sure you set the correct path to your video file
var proc = new ffmpeg({ source: 'C:/Users/Jay/Documents/movie/drop.avi', nolog: true })
//Set the path to where FFmpeg is installed
.setFfmpegPath("C:\Users\Jay\Documents\FFMPEG")
//set the size
.withSize('50%')
// set fps
.withFps(24)
// set output format to force
.toFormat('flv')
// setup event handlers
.on('end', function() {
console.log('file has been converted successfully');
})
.on('error', function(err) {
console.log('an error happened: ' + err.message);
})
// save to file <-- the new file I want -->
.saveToFile('C:/Users/Jay/Documents/movie/drop.flv');
這似乎很簡單,我可以通過FFmpeg的命令行做到這一點,但我想獲得它的Node.js應用程序內的工作,這裏是它返回的錯誤:
C:\Users\Jay\workspace\FFMPEGtest\test.js:17
.withSize('50%')
^
TypeError: Cannot call method 'withSize' of undefined
at Object.<anonymous> (C:\Users\Jay\workspace\FFMPEGtest\test.js:17:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
它拋出對於每個內置的FFmpeg函數(.toFormat,.withFPS等)都有同樣的錯誤
如果任何人有一個解決的辦法,我會非常感激
感謝您的答覆,這似乎並沒有改變任何東西,雖然很不幸,它拋出完全相同的錯誤。 – user2757842
@ user2757842 Whups,編輯。現在應該工作。 –
非常感謝,只有一個問題,現在對不起,它不再拋出這個錯誤,但它正在返回這一行......:發生錯誤:無法獲得可用的格式:spawn ENOENT。任何想法可能是什麼? – user2757842