-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
End-Of-Stream error when parsing some MP4 video files with parseStream #2337
Comments
Hello Borewit, Thank you for maintaining this library! I have two video/mp4 files that can't be parsed with parseStream. I've seen some related issues but didn't manage to make it work:
Feel free to ask me additional information |
Hi @arnaud-martin, I downloaded your file. |
Which function do you use to parse these files @arnaud-martin? describe('Issue #2337', () => {
it('1.mp4', async () => {
const filePath = path.join(mp4Samples, '1.mp4');
const {format, common} = await mm.parseFile(filePath);
assert.strictEqual(format.container, 'mp42/mp41', 'format.container');
assert.strictEqual(format.codec, 'MPEG-4/AAC', 'format.codec');
});
it('2.mp4', async () => {
const filePath = path.join(mp4Samples, '1.mp4');
const {format, common} = await mm.parseFile(filePath);
assert.strictEqual(format.container, 'mp42/mp41', 'format.container');
assert.strictEqual(format.codec, 'MPEG-4/AAC', 'format.codec');
});
}); |
parseStream, all the following tests fail when I run them in this minimal reproduction repository: describe("Stream", () => {
it("should parse video 1", async () => {
const stream = fs.createReadStream(filepath1);
const promise = parseStream(stream);
await expect(promise).resolves.not.toThrow();
});
it("should parse video 2", async () => {
const stream = fs.createReadStream(filepath2);
const promise = parseStream(stream);
await expect(promise).resolves.not.toThrow();
});
});
describe("Stream with size", () => {
it("should parse video 1 with size", async () => {
const stream = fs.createReadStream(filepath1);
const { size } = fs.statSync(filepath1);
const promise = parseStream(stream, { size });
await expect(promise).resolves.not.toThrow();
});
it("should parse video 2 with size", async () => {
const stream = fs.createReadStream(filepath2);
const { size } = fs.statSync(filepath2);
const promise = parseStream(stream, { size });
await expect(promise).resolves.not.toThrow();
});
}); |
You are still using version 7.14.0, I missed that, it is about time to update... Either you need to migrate your project from CommonJS to ESM, or follow these instructions: CommonJS backward compatibility. These tests will succeed with the current version. |
Thank you, I've updated and followed the CommonJS backward compatibility instructions: It works! Have a nice day |
Is there an existing issue for this?
music-metadata version
7.14.0
Current Behavior
parseStream throws End-Of-Stream error on two video/mp4 files that are successfully parsed with parseBuffer
Error:
Reproduction repository: https://github.com/arnaud-martin/music-metadata-parse-stream-video-mp4-bug
Assets: https://we.tl/t-lOcWURy6AR
Link expires on 2025-01-26, if you need me to reupload or prefer another file sharing method please tell me
Expected Behavior
parseStream successfully parses the video/mp4 files
Attached audio sample?
The text was updated successfully, but these errors were encountered: