@remotion/webcodecs 4.0.331 → 4.0.332
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.
|
@@ -95,7 +95,11 @@ const createMatroskaMedia = async ({ writer, onBytesProgress, onMillisecondsProg
|
|
|
95
95
|
isVideo,
|
|
96
96
|
chunk,
|
|
97
97
|
})) {
|
|
98
|
-
return {
|
|
98
|
+
return {
|
|
99
|
+
cluster: currentCluster,
|
|
100
|
+
isNew: false,
|
|
101
|
+
smallestProgress,
|
|
102
|
+
};
|
|
99
103
|
}
|
|
100
104
|
currentCluster = await (0, cluster_1.makeCluster)({
|
|
101
105
|
writer: w,
|
|
@@ -103,7 +107,11 @@ const createMatroskaMedia = async ({ writer, onBytesProgress, onMillisecondsProg
|
|
|
103
107
|
timescale,
|
|
104
108
|
logLevel,
|
|
105
109
|
});
|
|
106
|
-
return {
|
|
110
|
+
return {
|
|
111
|
+
cluster: currentCluster,
|
|
112
|
+
isNew: true,
|
|
113
|
+
smallestProgress,
|
|
114
|
+
};
|
|
107
115
|
};
|
|
108
116
|
const updateDuration = async (newDuration) => {
|
|
109
117
|
const blocks = (0, make_duration_with_padding_1.makeDurationWithPadding)(newDuration);
|
|
@@ -111,6 +119,7 @@ const createMatroskaMedia = async ({ writer, onBytesProgress, onMillisecondsProg
|
|
|
111
119
|
onBytesProgress(w.getWrittenByteCount());
|
|
112
120
|
};
|
|
113
121
|
const addSample = async ({ chunk, trackNumber, isVideo, }) => {
|
|
122
|
+
const offset = w.getWrittenByteCount();
|
|
114
123
|
const { cluster, isNew, smallestProgress } = await getClusterOrMakeNew({
|
|
115
124
|
chunk,
|
|
116
125
|
isVideo,
|
|
@@ -119,11 +128,13 @@ const createMatroskaMedia = async ({ writer, onBytesProgress, onMillisecondsProg
|
|
|
119
128
|
await updateDuration(newDuration);
|
|
120
129
|
const { timecodeRelativeToCluster } = await cluster.addSample(chunk, trackNumber);
|
|
121
130
|
if (isNew) {
|
|
122
|
-
|
|
131
|
+
if (offset === null) {
|
|
132
|
+
throw new Error('offset is null');
|
|
133
|
+
}
|
|
123
134
|
cues.push({
|
|
124
135
|
time: (0, cluster_1.timestampToClusterTimestamp)(smallestProgress, timescale) +
|
|
125
136
|
timecodeRelativeToCluster,
|
|
126
|
-
clusterPosition:
|
|
137
|
+
clusterPosition: offset - seekHeadOffset,
|
|
127
138
|
trackNumber,
|
|
128
139
|
});
|
|
129
140
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -3751,7 +3751,11 @@ var createMatroskaMedia = async ({
|
|
|
3751
3751
|
isVideo,
|
|
3752
3752
|
chunk
|
|
3753
3753
|
})) {
|
|
3754
|
-
return {
|
|
3754
|
+
return {
|
|
3755
|
+
cluster: currentCluster,
|
|
3756
|
+
isNew: false,
|
|
3757
|
+
smallestProgress
|
|
3758
|
+
};
|
|
3755
3759
|
}
|
|
3756
3760
|
currentCluster = await makeCluster({
|
|
3757
3761
|
writer: w,
|
|
@@ -3759,7 +3763,11 @@ var createMatroskaMedia = async ({
|
|
|
3759
3763
|
timescale,
|
|
3760
3764
|
logLevel
|
|
3761
3765
|
});
|
|
3762
|
-
return {
|
|
3766
|
+
return {
|
|
3767
|
+
cluster: currentCluster,
|
|
3768
|
+
isNew: true,
|
|
3769
|
+
smallestProgress
|
|
3770
|
+
};
|
|
3763
3771
|
};
|
|
3764
3772
|
const updateDuration = async (newDuration) => {
|
|
3765
3773
|
const blocks = makeDurationWithPadding(newDuration);
|
|
@@ -3771,6 +3779,7 @@ var createMatroskaMedia = async ({
|
|
|
3771
3779
|
trackNumber,
|
|
3772
3780
|
isVideo
|
|
3773
3781
|
}) => {
|
|
3782
|
+
const offset = w.getWrittenByteCount();
|
|
3774
3783
|
const { cluster, isNew, smallestProgress } = await getClusterOrMakeNew({
|
|
3775
3784
|
chunk,
|
|
3776
3785
|
isVideo
|
|
@@ -3779,10 +3788,12 @@ var createMatroskaMedia = async ({
|
|
|
3779
3788
|
await updateDuration(newDuration);
|
|
3780
3789
|
const { timecodeRelativeToCluster } = await cluster.addSample(chunk, trackNumber);
|
|
3781
3790
|
if (isNew) {
|
|
3782
|
-
|
|
3791
|
+
if (offset === null) {
|
|
3792
|
+
throw new Error("offset is null");
|
|
3793
|
+
}
|
|
3783
3794
|
cues.push({
|
|
3784
3795
|
time: timestampToClusterTimestamp(smallestProgress, timescale) + timecodeRelativeToCluster,
|
|
3785
|
-
clusterPosition:
|
|
3796
|
+
clusterPosition: offset - seekHeadOffset,
|
|
3786
3797
|
trackNumber
|
|
3787
3798
|
});
|
|
3788
3799
|
}
|
|
@@ -5655,13 +5666,10 @@ var internalExtractFrames = ({
|
|
|
5655
5666
|
lastFrame = frame;
|
|
5656
5667
|
return;
|
|
5657
5668
|
}
|
|
5658
|
-
if (expectedFrames[0] + 6667 < frame.timestamp && lastFrame) {
|
|
5669
|
+
if (expectedFrames[0] + 6667 < frame.timestamp && lastFrame && lastFrame !== lastFrameEmitted) {
|
|
5659
5670
|
onFrame(lastFrame);
|
|
5660
5671
|
lastFrameEmitted = lastFrame;
|
|
5661
5672
|
expectedFrames.shift();
|
|
5662
|
-
if (lastFrame) {
|
|
5663
|
-
lastFrame.close();
|
|
5664
|
-
}
|
|
5665
5673
|
lastFrame = frame;
|
|
5666
5674
|
return;
|
|
5667
5675
|
}
|
package/dist/esm/worker.mjs
CHANGED
|
@@ -401,13 +401,10 @@ var internalExtractFrames = ({
|
|
|
401
401
|
lastFrame = frame;
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
|
-
if (expectedFrames[0] + 6667 < frame.timestamp && lastFrame) {
|
|
404
|
+
if (expectedFrames[0] + 6667 < frame.timestamp && lastFrame && lastFrame !== lastFrameEmitted) {
|
|
405
405
|
onFrame(lastFrame);
|
|
406
406
|
lastFrameEmitted = lastFrame;
|
|
407
407
|
expectedFrames.shift();
|
|
408
|
-
if (lastFrame) {
|
|
409
|
-
lastFrame.close();
|
|
410
|
-
}
|
|
411
408
|
lastFrame = frame;
|
|
412
409
|
return;
|
|
413
410
|
}
|
|
@@ -55,13 +55,12 @@ const internalExtractFrames = ({ src, onFrame, signal, timestampsInSeconds, ackn
|
|
|
55
55
|
// A WebM might have a timestamp of 67000 but we request 66666
|
|
56
56
|
// See a test with this problem in it-tests/rendering/frame-accuracy.test.ts
|
|
57
57
|
// Solution: We allow a 10.000ms - 3.333ms = 6.667ms difference between the requested timestamp and the actual timestamp
|
|
58
|
-
if (expectedFrames[0] + 6667 < frame.timestamp &&
|
|
58
|
+
if (expectedFrames[0] + 6667 < frame.timestamp &&
|
|
59
|
+
lastFrame &&
|
|
60
|
+
lastFrame !== lastFrameEmitted) {
|
|
59
61
|
onFrame(lastFrame);
|
|
60
62
|
lastFrameEmitted = lastFrame;
|
|
61
63
|
expectedFrames.shift();
|
|
62
|
-
if (lastFrame) {
|
|
63
|
-
lastFrame.close();
|
|
64
|
-
}
|
|
65
64
|
lastFrame = frame;
|
|
66
65
|
return;
|
|
67
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/webcodecs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.332",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.mjs",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
20
20
|
"license": "Remotion License (See https://remotion.dev/docs/webcodecs#license)",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@remotion/media-parser": "4.0.
|
|
23
|
-
"@remotion/licensing": "4.0.
|
|
22
|
+
"@remotion/media-parser": "4.0.332",
|
|
23
|
+
"@remotion/licensing": "4.0.332"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {},
|
|
26
26
|
"devDependencies": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"vite": "5.4.19",
|
|
30
30
|
"@playwright/test": "1.51.1",
|
|
31
31
|
"eslint": "9.19.0",
|
|
32
|
-
"@remotion/example-videos": "4.0.
|
|
33
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
32
|
+
"@remotion/example-videos": "4.0.332",
|
|
33
|
+
"@remotion/eslint-config-internal": "4.0.332"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [],
|
|
36
36
|
"publishConfig": {
|