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
To watch any changes that are made to the file system, we can use the fs module provided by node. js that provides a solution here. For monitoring a file of any modification, we can either use the fs. watch() or fs.
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");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With