Welcome folks today in this blog post we will be using the fluent-ffmpeg
library to get duration,size
and codec
and metadata
of video mp4 video in command line using node.js
. All the full source code of the application is shown below.
Get Started
In order to get started you need to make a new node.js
project using the below command as shown below
npm init -y
npm i fluent-ffmpeg
And now we need to create the index.js
file and copy paste the following code
index.js
1 2 3 4 5 6 7 |
const ffmpeg = require('fluent-ffmpeg') let path = "video.mp4" ffmpeg.ffprobe(path,(error,data) => { console.log(data) }) |
As you can see we are importing the fluent-ffmpeg
library and then we are using the ffproble
method to get the information
about the video.mp4
file. Now in order to run this node.js
app you need to execute the below command as shown below
nodemon index.js