Reputation: 401
I'm using following npm package in NodeJS application. What I need to do is reduce the size of videos. My videos are in mp4 format. Is there any way to reduce size of those videos using node-ffmpeg ? https://www.npmjs.com/package/ffmpeg
There are not good answers or samples. I followed this code some steps and idea, but no good. fluent ffmpeg size output option not working
In normal ffmpeg, we can do like this.
ffmpeg -i <inputfilename> -s 640x480 -b:v 512k -vcodec mpeg1video -acodec copy <outputfilename>
How can we do the same in NodeJS ?
Please help me on this. any sample code or idea is welcome.
Upvotes: 1
Views: 6635
Reputation: 38749
Just use child_process
. That's all that the node modules do.
e.g.
child_process.execFile('ffmpeg', [
'-i', inputfilename,
'-s', '640x480',
'-b:v', '512k',
'-c:v', 'mpeg1video',
'-c:a', 'copy',
outputfilename
], function(error, stdout, stderr) {
// ...
})
I would avoid using any modules as they obfuscate what commands they're actually running, and if you want to do something more advanced that they haven't added code for then you're stuck.
Upvotes: 2