How to Retrieve File Data from a Video in Node.JS

When editing or composing a video, a smooth process necessitates access to meta data that might otherwise be buried or difficult to find. With the following Cloudmersive API, you can easily access a video’s info for any use. For your convenience, this API works with many formats including AVI, ASF, FLV, GIF, MP4, MPEG/MPG, Matroska/WEBM, MOV, AIFF, ASF, CAF, MP3, MP2, MP1, Ogg, OMG/OMA, and WAV.

Image for post
Image for post

First, let’s install our client:

npm install cloudmersive-video-api-client –save

Or, you can add the following to your package.json:

"dependencies": {    "cloudmersive-video-api-client": "^2.0.1"  }

Then, we can call our function:

var CloudmersiveVideoApiClient = require('cloudmersive-video-api-client');
var defaultClient = CloudmersiveVideoApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveVideoApiClient.VideoApi();var opts = {
'inputFile': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Input file to perform the operation on.
'fileUrl': "fileUrl_example" // String | Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.videoGetInfo(opts, callback);

Following these steps, you can gain access to the file data that will make your next project a breeze!

Written by

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store