Intro: The fluent-ffmpeg npm module used to perform various opertion like video transcoding ,get video meta data,thumbnail of video ,reduce size of image etc.Using this module you can convert any transcoding flavour. you first install the ffmpeg and then install the npm module .you can convert with any flavour like 144p,256p,360p,720p etc.
Install procedure:
- sudo apt-get install ffmpeg
- npm install fluent-ffmpeg
- var ffmpeg=require('fluent-ffmpeg')
Code For Video Transcoding:
ffmpeg("path of file to transfer").fps(25).size(data.height + 'x' + data.width).
videoCodec(data.video_codec).addOption('-strict', 'experimental').
videoBitrate(data.video_bitrate).audioCodec(data.audio_codec).
audioBitrate(data.audio_bitrate).on('error', function (err) {
console.log(err)
}).on('end', function () {
//code after transcoding
})
Code For Thumbnail Generation:
ffmpeg(serverPath).screenshots({
count: 1, //number of thumbnail want to generate
folder: //path where you want to save
filename: timeStamp + '_thumbnail.png',
size: '320x240'
}).on('end', function () {
})
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Himanshu Goyal
Himanshu is a bright Java ,Mean stack developer and have good knowledge of Hibernate, Spring,FFmepg,Neo4j JSON, Jquery, NODE.JS .His hobbies are learning new things, fitness .