FFmpeg with node.js. Transcode a file to another format -



FFmpeg with node.js. Transcode a file to another format -

have bit of problem this, have .avi file in transcode .flv file using ffmpeg, here have far:

var ffmpeg = require('fluent-ffmpeg'); //make sure set right path video file var proc = new ffmpeg({ source: 'c:/users/jay/documents/movie/drop.avi', nolog: true }) //set path ffmpeg installed .setffmpegpath("c:\users\jay\documents\ffmpeg") //set size .withsize('50%') // set fps .withfps(24) // set output format forcefulness .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 file <-- new file want --> .savetofile('c:/users/jay/documents/movie/drop.flv');

it seems straightforward plenty , can through ffmpeg command line, trying working within node.js app, here error returning:

c:\users\jay\workspace\ffmpegtest\test.js:17 .withsize('50%') ^ typeerror: cannot phone call method 'withsize' of undefined @ object.<anonymous> (c:\users\jay\workspace\ffmpegtest\test.js:17:2) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:906:3

it throws same error each built in ffmpeg function (.toformat, .withfps etc)

if has solution this, i'd appreciate it

setffmpegpath() doesn't homecoming instance of this, seen in source here. meaning can't chain method.

change to

var ffmpeg = require('fluent-ffmpeg'); //make sure set right path video file var proc = new ffmpeg({ source: 'c:/users/jay/documents/movie/drop.avi', nolog: true }) //set path ffmpeg installed proc.setffmpegpath("c:\\users\\jay\\documents\\ffmpeg") proc //set size .withsize('50%') // set fps .withfps(24) // set output format forcefulness .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 file <-- new file want --> .savetofile('c:/users/jay/documents/movie/drop.flv');

node.js ffmpeg transcode

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -