How can I read and change details of file in nodejs?

I have a .mp4 file, I want to read and change this file details (Right mouse click file -> Properties -> Details tab) . I want to read and change Description property (Title, Subtitle, Rating, Tags, Comments).
How i can do it with nodejs.

Thank so much

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Use the ffmetadata npm module for reading/writing files properties.

Following is the example from ffmetadata npm site.

var ffmetadata = require("ffmetadata");

// Read song.mp3 metadata
ffmetadata.read("song.mp3", function(err, data) {
    if (err) console.error("Error reading metadata", err);
    else console.log(data);
});

// Set the artist for song.mp3
var data = {
  artist: "Me",
};
ffmetadata.write("song.mp3", data, function(err) {
    if (err) console.error("Error writing metadata", err);
    else console.log("Data written");
});

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply