Next, we need to install one dependency via NPM, inquirer: Next, we're going to modify the package.json that was created to set the project type to be module:ĭoing this enables ESModules support in Node.js allowing us to use import and export in our code (as opposed to require() and modules.export. The -f stands for "force" and skips the automated wizard for generating this file (we skip it here for the sake of speed but feel free to omit the -f and follow the prompts). This will automatically initialize a package.json file inside of your project folder. Terminal cd video-converter & npm init -f Next, cd into that folder and run npm init -f: This should be placed wherever you keep projects on your computer (e.g., ~/projects where ~ is the home folder or root on your computer). If you have Node.js installed, next, we want to create a new folder for our project. If you don't have Node.js installed, read this tutorial first before continuing. Make sure that you have the latest LTS version of Node.js installed on your machine. For this tutorial, we're going to build a Node.js project from scratch. on( 'progress', ( progress ) => % done` ) ģ2 33 // The callback that is run when FFmpeg is finished 34. saveToFile( 'video.mp4' )Ģ0 21 // Log the percentage of work completed 22. In other words, to make the video 720 pixels wide 15 // and make FFmpeg calculate its height, use scale=720:-2 instead. The -2 means FFmpeg should figure out the 14 // exact size of the other dimension. input( 'video.mp4' )ġ2 13 // Scale the video to 720 pixels in height. 1 const ffmpegStatic = require ( 'ffmpeg-static' ) Ģ const ffmpeg = require ( 'fluent-ffmpeg' ) ģ 4 // Tell fluent-ffmpeg where it can find FFmpeg tFfmpegPath(ffmpegStatic) ĩ 10 // Input file 11.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |