mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-09 16:53:47 +02:00
Support rotation metadata in Matroska muxer
This commit is contained in:
+2
-2
@@ -17,8 +17,8 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build.mjs && tsc && api-extractor run && node append-namespace.mjs",
|
"build": "node build.mjs && npm run lint && tsc && api-extractor run && node append-namespace.mjs",
|
||||||
"build-local": "node build.mjs && tsc && api-extractor run --local --verbose && node append-namespace.mjs",
|
"build-local": "node build.mjs && npm run lint && tsc && api-extractor run --local --verbose && node append-namespace.mjs",
|
||||||
"watch": "node build.mjs --watch",
|
"watch": "node build.mjs --watch",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"check": "tsc --noEmit"
|
"check": "tsc --noEmit"
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export enum EBMLId {
|
|||||||
Primaries = 0x55bb,
|
Primaries = 0x55bb,
|
||||||
Range = 0x55b9,
|
Range = 0x55b9,
|
||||||
Projection = 0x7670,
|
Projection = 0x7670,
|
||||||
|
ProjectionType = 0x7671,
|
||||||
ProjectionPoseRoll = 0x7675,
|
ProjectionPoseRoll = 0x7675,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ export class MatroskaMuxer extends Muxer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private videoSpecificTrackInfo(trackData: MatroskaVideoTrackData) {
|
private videoSpecificTrackInfo(trackData: MatroskaVideoTrackData) {
|
||||||
|
const { frameRate, rotation } = trackData.track.metadata;
|
||||||
|
|
||||||
const elements: EBMLElement['data'] = [
|
const elements: EBMLElement['data'] = [
|
||||||
(trackData.info.decoderConfig.description
|
(trackData.info.decoderConfig.description
|
||||||
? {
|
? {
|
||||||
@@ -237,10 +239,10 @@ export class MatroskaMuxer extends Muxer {
|
|||||||
data: toUint8Array(trackData.info.decoderConfig.description),
|
data: toUint8Array(trackData.info.decoderConfig.description),
|
||||||
}
|
}
|
||||||
: null),
|
: null),
|
||||||
(trackData.track.metadata.frameRate
|
(frameRate
|
||||||
? {
|
? {
|
||||||
id: EBMLId.DefaultDuration,
|
id: EBMLId.DefaultDuration,
|
||||||
data: 1e9 / trackData.track.metadata.frameRate,
|
data: 1e9 / frameRate,
|
||||||
}
|
}
|
||||||
: null),
|
: null),
|
||||||
];
|
];
|
||||||
@@ -272,6 +274,21 @@ export class MatroskaMuxer extends Muxer {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
: null),
|
: null),
|
||||||
|
(typeof rotation === 'number' && rotation !== 0
|
||||||
|
? {
|
||||||
|
id: EBMLId.Projection,
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
id: EBMLId.ProjectionType,
|
||||||
|
data: 0, // rectangular
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: EBMLId.ProjectionPoseRoll,
|
||||||
|
data: (rotation + 180) % 360 - 180, // [0, 270] -> [-180, 90]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
: null),
|
||||||
] };
|
] };
|
||||||
|
|
||||||
elements.push(videoElement);
|
elements.push(videoElement);
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
- Test tree shaking
|
|
||||||
- Throw if edit list detected
|
- Throw if edit list detected
|
||||||
- Add the new audio codecs to muxers
|
|
||||||
- Mov muxer!!! Only mov can hold PCM audio, MP4 cannot
|
|
||||||
- A stream source?? Or like a callback-driven source
|
- A stream source?? Or like a callback-driven source
|
||||||
- onHeader, etc callbacks for Matroska
|
- onHeader, etc callbacks for Matroska
|
||||||
- https://github.com/Vanilagy/mp4-muxer/issues/83 tell him it's possible now
|
- https://github.com/Vanilagy/mp4-muxer/issues/83 tell him it's possible now
|
||||||
- Matroska projection for video rotation in muxer
|
|
||||||
Reference in New Issue
Block a user