Skip to content

Commit

Permalink
Merge pull request #11 from SidOfc/patch/mp4-v2
Browse files Browse the repository at this point in the history
patch/mp4 v2
  • Loading branch information
SidOfc authored Mar 19, 2023
2 parents 8193b1b + 92445f1 commit 880bef9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
node_modules
debug.js
test/local
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/extractors/mp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -68,6 +69,6 @@ function v2(stream, lastTkhd) {
stream.goto(pos);
}

stream.skip(size);
stream.skip(size - 8);
}
}

0 comments on commit 880bef9

Please sign in to comment.