mp4edit
mp4edit copied to clipboard
Library does not work.
I updated the example and added some files that could be used by the code, but it outputs a result that cant be read by a player...
var fs = require('fs')
var mp4edit = require('mp4edit');
MP4 = mp4edit.MP4;
// Album cover
var coverImage = fs.readFileSync('cover.jpg');
// Original MP4 (m4a is an mp4 file that contains audio only)
var mp4 = fs.readFileSync('./test1.m4a');
var tags = {
title : "Song Title",
artist : "Song Artist",
album : "Album",
genre : "Any genre",
cover : coverImage
};
// Parse, give tags, and build mp4 file.
var output = MP4.make( MP4.giveTags( MP4.parse(mp4), tags));
fs.writeFileSync('./test1-output.m4a', output);
I'm now making another small personal project using this library so I'm revisiting it and getting it to work again. Hopefully by the end of this week I'll have a new release.
Any updates on this?
Okay so I just uploaded a recent version I have on my machine. Sorry. I'm not too good at maintaining open source software evidently. But it works for me now. I'll try to update the documentation, but for now, here's an example of how I'm using it:
var mp4 = new MP4(file); var tags = mp4.getCommonTags(); // Gives author, album, genre, cover and title. mp4.giveTags({artist:"The Beatles"}); var blob = new Blob([mp4.build().buffer], {type: 'audio/mp4'}); var url = URL.createObjectURL(blob);
Okay and the Quickstart has been updated with a browser example that's close to how I use it.
@lukeschaefer can you push that to npm?
@lukeschaefer Can you push up the latest working code?
bump...
....7 years later....
Refactored it to typescript and added tests and reuploaded to npm. Seems to mostly work now but it's still mostly hacky gross code I wrote a decade ago.
.... mostly hacky gross code I wrote a decade ago.
No worries. Updating your old code is like trying to solve a mystery in which you are the victim, investigator, and murderer. 😄