diff --git a/.gitignore b/.gitignore index 42f9bd5..617cd62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist node_modules debug.js +test/local diff --git a/package-lock.json b/package-lock.json index a2510c0..3c08645 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "leather", - "version": "2.1.1", + "version": "2.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "leather", - "version": "2.1.1", + "version": "2.1.2", "license": "MIT", "devDependencies": { "ava": "^5.2.0", diff --git a/package.json b/package.json index a242dc6..98941dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "leather", - "version": "2.1.1", + "version": "2.1.2", "description": "A pure JS library for extracting image/video attributes such as width, height, size, and mime type", "author": "Sidney Liebrand", "license": "MIT", diff --git a/src/extractors/mp4.js b/src/extractors/mp4.js index 4efcaef..c956051 100644 --- a/src/extractors/mp4.js +++ b/src/extractors/mp4.js @@ -10,6 +10,7 @@ export function attributes(input) { const type = stream.skip(4).take(8).toString('hex'); const mime = MIME_TYPES[type] || 'video/mp4'; + stream.goto(0); const result = Object.assign(v2(stream) ?? {}, {size: stream.size(), mime}); if (!Number.isInteger(result.width) || !Number.isInteger(result.height)) { @@ -68,6 +69,6 @@ function v2(stream, lastTkhd) { stream.goto(pos); } - stream.skip(size); + stream.skip(size - 8); } }