@remotion/media-parser 4.0.321 → 4.0.322

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getActualDecoderParameters = void 0;
4
4
  const aac_codecprivate_1 = require("../../aac-codecprivate");
5
- // Example video: 'https://remotion-assets.s3.eu-central-1.amazonaws.com/example-videos/riverside.mp4';
5
+ // Example video: 'https://pub-646d808d9cb240cea53bedc76dd3cd0c.r2.dev/riverside.mp4';
6
6
  // This video has `numberOfChannels = 2`, but the actual number of channels is `1` according to Codec Private.
7
7
  // Therefore, prioritizing Codec Private over `numberOfChannels`.
8
8
  const getActualDecoderParameters = ({ audioCodec, codecPrivate, numberOfChannels, sampleRate, }) => {
@@ -31,6 +31,7 @@ const calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
31
31
  const jumpMarks = [];
32
32
  const allSamplesSortedByOffset = samplePositionTracks
33
33
  .flat(1)
34
+ .filter((s) => s.track.type === 'audio' || s.track.type === 'video')
34
35
  .sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
35
36
  let indexToVisit = 0;
36
37
  const visited = new Set();
@@ -134,7 +134,7 @@ const parseMdatSection = async (state) => {
134
134
  });
135
135
  }
136
136
  if (samplesWithIndex.track.type === 'video') {
137
- // https://remotion-assets.s3.eu-central-1.amazonaws.com/example-videos/sei_checkpoint.mp4
137
+ // https://pub-646d808d9cb240cea53bedc76dd3cd0c.r2.dev/sei_checkpoint.mp4
138
138
  // Position in file 0x0001aba615
139
139
  // https://github.com/remotion-dev/remotion/issues/4680
140
140
  // In Chrome, we may not treat recovery points as keyframes
@@ -11648,7 +11648,7 @@ var calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
11648
11648
  progresses[track[0].track.trackId] = 0;
11649
11649
  }
11650
11650
  const jumpMarks = [];
11651
- const allSamplesSortedByOffset = samplePositionTracks.flat(1).sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11651
+ const allSamplesSortedByOffset = samplePositionTracks.flat(1).filter((s) => s.track.type === "audio" || s.track.type === "video").sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11652
11652
  let indexToVisit = 0;
11653
11653
  const visited = new Set;
11654
11654
  let rollOverToProcess = false;
@@ -18105,7 +18105,7 @@ var downloadAndParseMedia = async (options) => {
18105
18105
  return returnValue;
18106
18106
  };
18107
18107
  // src/version.ts
18108
- var VERSION = "4.0.321";
18108
+ var VERSION = "4.0.322";
18109
18109
 
18110
18110
  // src/index.ts
18111
18111
  var MediaParserInternals = {
@@ -11733,7 +11733,7 @@ var calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
11733
11733
  progresses[track[0].track.trackId] = 0;
11734
11734
  }
11735
11735
  const jumpMarks = [];
11736
- const allSamplesSortedByOffset = samplePositionTracks.flat(1).sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11736
+ const allSamplesSortedByOffset = samplePositionTracks.flat(1).filter((s) => s.track.type === "audio" || s.track.type === "video").sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11737
11737
  let indexToVisit = 0;
11738
11738
  const visited = new Set;
11739
11739
  let rollOverToProcess = false;
@@ -11630,7 +11630,7 @@ var calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
11630
11630
  progresses[track[0].track.trackId] = 0;
11631
11631
  }
11632
11632
  const jumpMarks = [];
11633
- const allSamplesSortedByOffset = samplePositionTracks.flat(1).sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11633
+ const allSamplesSortedByOffset = samplePositionTracks.flat(1).filter((s) => s.track.type === "audio" || s.track.type === "video").sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11634
11634
  let indexToVisit = 0;
11635
11635
  const visited = new Set;
11636
11636
  let rollOverToProcess = false;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.321";
1
+ export declare const VERSION = "4.0.322";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.321';
5
+ exports.VERSION = '4.0.322';
package/package.json CHANGED
@@ -3,15 +3,15 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-parser"
4
4
  },
5
5
  "name": "@remotion/media-parser",
6
- "version": "4.0.321",
6
+ "version": "4.0.322",
7
7
  "main": "dist/index.js",
8
8
  "sideEffects": false,
9
9
  "devDependencies": {
10
10
  "@types/wicg-file-system-access": "2023.10.5",
11
11
  "eslint": "9.19.0",
12
12
  "@types/bun": "1.2.8",
13
- "@remotion/example-videos": "4.0.321",
14
- "@remotion/eslint-config-internal": "4.0.321"
13
+ "@remotion/example-videos": "4.0.322",
14
+ "@remotion/eslint-config-internal": "4.0.322"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public"
@@ -1,30 +0,0 @@
1
- import type { BufferIterator } from '../../iterator/buffer-iterator';
2
- import type { BaseBox } from './base-type';
3
- export type ThreeDMatrix = [
4
- number,
5
- number,
6
- number,
7
- number,
8
- number,
9
- number,
10
- number,
11
- number,
12
- number
13
- ];
14
- export interface MvhdBox extends BaseBox {
15
- durationInUnits: number;
16
- durationInSeconds: number;
17
- creationTime: number | null;
18
- modificationTime: number | null;
19
- timeScale: number;
20
- rate: number;
21
- volume: number;
22
- matrix: ThreeDMatrix;
23
- nextTrackId: number;
24
- type: 'mvhd-box';
25
- }
26
- export declare const parseMvhd: ({ iterator, offset, size, }: {
27
- iterator: BufferIterator;
28
- offset: number;
29
- size: number;
30
- }) => MvhdBox;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseMvhd = void 0;
4
- const buffer_iterator_1 = require("../../iterator/buffer-iterator");
5
- const to_date_1 = require("./to-date");
6
- const parseMvhd = ({ iterator, offset, size, }) => {
7
- const version = iterator.getUint8();
8
- // Flags, we discard them
9
- iterator.discard(3);
10
- const creationTime = version === 1 ? iterator.getUint64() : iterator.getUint32();
11
- const modificationTime = version === 1 ? iterator.getUint64() : iterator.getUint32();
12
- const timeScale = iterator.getUint32();
13
- const durationInUnits = version === 1 ? iterator.getUint64() : iterator.getUint32();
14
- const durationInSeconds = Number(durationInUnits) / timeScale;
15
- const rateArray = iterator.getSlice(4);
16
- const rateView = (0, buffer_iterator_1.getArrayBufferIterator)(rateArray, rateArray.length);
17
- const rate = rateView.getInt8() * 10 +
18
- rateView.getInt8() +
19
- rateView.getInt8() * 0.1 +
20
- rateView.getInt8() * 0.01;
21
- const volumeArray = iterator.getSlice(2);
22
- const volumeView = (0, buffer_iterator_1.getArrayBufferIterator)(volumeArray, volumeArray.length);
23
- const volume = volumeView.getInt8() + volumeView.getInt8() * 0.1;
24
- // reserved 16bit
25
- iterator.discard(2);
26
- // reserved 32bit x2
27
- iterator.discard(4);
28
- iterator.discard(4);
29
- // matrix
30
- const matrix = [
31
- iterator.getFixedPointSigned1616Number(),
32
- iterator.getFixedPointSigned1616Number(),
33
- iterator.getFixedPointSigned230Number(),
34
- iterator.getFixedPointSigned1616Number(),
35
- iterator.getFixedPointSigned1616Number(),
36
- iterator.getFixedPointSigned230Number(),
37
- iterator.getFixedPointSigned1616Number(),
38
- iterator.getFixedPointSigned1616Number(),
39
- iterator.getFixedPointSigned230Number(),
40
- ];
41
- // pre-defined
42
- iterator.discard(4 * 6);
43
- // next track id
44
- const nextTrackId = iterator.getUint32();
45
- volumeView.destroy();
46
- const bytesRemaining = size - (iterator.counter.getOffset() - offset);
47
- if (bytesRemaining !== 0) {
48
- throw new Error('expected 0 bytes ' + bytesRemaining);
49
- }
50
- return {
51
- creationTime: (0, to_date_1.toUnixTimestamp)(Number(creationTime)),
52
- modificationTime: (0, to_date_1.toUnixTimestamp)(Number(modificationTime)),
53
- timeScale,
54
- durationInUnits: Number(durationInUnits),
55
- durationInSeconds,
56
- rate,
57
- volume,
58
- matrix: matrix,
59
- nextTrackId,
60
- type: 'mvhd-box',
61
- boxSize: size,
62
- offset,
63
- };
64
- };
65
- exports.parseMvhd = parseMvhd;