Blog

  • Transcoding in NODEJS using FFMPEG

    Posted by Himanshu Goyal | Last Updated: 17-Mar-16

    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 () {
    
    })
     
    
     

Tags: ffmpeg , nodejs

View All PostsLeave a Comment
comments powered by Disqus

Mobile Applications

Video Content

Bigdata & NoSQL

SaaS Applications

Miscellaneous

Archives


Alexa Certified Site Stats for www.oodlestechnologies.com