@remotion/studio 4.0.365 → 4.0.366
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.
- package/dist/components/Timeline/TimelineVideoInfo.js +12 -21
- package/dist/esm/chunk-5ywrk91r.js +59891 -0
- package/dist/esm/chunk-7e8m9pmd.js +59851 -0
- package/dist/esm/chunk-fsj6zw61.js +59894 -0
- package/dist/esm/chunk-j0sv4v53.js +59898 -0
- package/dist/esm/chunk-knnc4kgj.js +42408 -0
- package/dist/esm/chunk-q2rx70vn.js +60152 -0
- package/dist/esm/chunk-qvkzstcp.js +59855 -0
- package/dist/esm/chunk-xyx01n16.js +59894 -0
- package/dist/esm/chunk-y4fchsz3.js +59891 -0
- package/dist/esm/internals.mjs +12049 -16825
- package/dist/esm/previewEntry.mjs +12049 -16825
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/extract-frames.d.ts +17 -0
- package/dist/helpers/extract-frames.js +62 -0
- package/dist/helpers/resize-video-frame.d.ts +4 -0
- package/dist/helpers/resize-video-frame.js +39 -0
- package/dist/helpers/use-max-media-duration.js +14 -17
- package/package.json +10 -11
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineVideoInfo = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const media_parser_1 = require("@remotion/media-parser");
|
|
6
|
-
const webcodecs_1 = require("@remotion/webcodecs");
|
|
7
|
-
const worker_1 = require("@remotion/webcodecs/worker");
|
|
8
5
|
const react_1 = require("react");
|
|
9
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const extract_frames_1 = require("../../helpers/extract-frames");
|
|
10
8
|
const frame_database_1 = require("../../helpers/frame-database");
|
|
9
|
+
const resize_video_frame_1 = require("../../helpers/resize-video-frame");
|
|
11
10
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
12
11
|
const HEIGHT = (0, timeline_layout_1.getTimelineLayerHeight)('video') - 2;
|
|
13
12
|
const containerStyle = {
|
|
@@ -20,10 +19,11 @@ const containerStyle = {
|
|
|
20
19
|
fontSize: 10,
|
|
21
20
|
fontFamily: 'Arial, Helvetica',
|
|
22
21
|
};
|
|
23
|
-
const
|
|
22
|
+
const WEBCODECS_TIMESCALE = 1000000;
|
|
23
|
+
const MAX_TIME_DEVIATION = WEBCODECS_TIMESCALE * 0.05;
|
|
24
24
|
const getDurationOfOneFrame = ({ visualizationWidth, aspectRatio, segmentDuration, }) => {
|
|
25
25
|
const framesFitInWidthUnrounded = visualizationWidth / (HEIGHT * aspectRatio);
|
|
26
|
-
return (segmentDuration / framesFitInWidthUnrounded) *
|
|
26
|
+
return (segmentDuration / framesFitInWidthUnrounded) * WEBCODECS_TIMESCALE;
|
|
27
27
|
};
|
|
28
28
|
const fixRounding = (value) => {
|
|
29
29
|
if (value % 1 >= 0.49999999) {
|
|
@@ -41,7 +41,7 @@ const calculateTimestampSlots = ({ visualizationWidth, fromSeconds, segmentDurat
|
|
|
41
41
|
});
|
|
42
42
|
const timestampTargets = [];
|
|
43
43
|
for (let i = 0; i < framesFitInWidth + 1; i++) {
|
|
44
|
-
const target = fromSeconds *
|
|
44
|
+
const target = fromSeconds * WEBCODECS_TIMESCALE + durationOfOneFrame * (i + 0.5);
|
|
45
45
|
const snappedToDuration = (Math.round(fixRounding(target / durationOfOneFrame)) - 1) *
|
|
46
46
|
durationOfOneFrame;
|
|
47
47
|
timestampTargets.push(snappedToDuration);
|
|
@@ -68,7 +68,7 @@ const drawSlot = ({ frame, ctx, filledSlots, visualizationWidth, timestamp, segm
|
|
|
68
68
|
aspectRatio: frame.displayWidth / frame.displayHeight,
|
|
69
69
|
segmentDuration,
|
|
70
70
|
});
|
|
71
|
-
const relativeTimestamp = timestamp - fromSeconds *
|
|
71
|
+
const relativeTimestamp = timestamp - fromSeconds * WEBCODECS_TIMESCALE;
|
|
72
72
|
const frameIndex = relativeTimestamp / durationOfOneFrame;
|
|
73
73
|
const left = Math.floor((frameIndex * frame.displayWidth) / window.devicePixelRatio); // round to avoid antialiasing
|
|
74
74
|
ctx.drawImage(frame, left, 0, frame.displayWidth / window.devicePixelRatio, frame.displayHeight / window.devicePixelRatio);
|
|
@@ -189,9 +189,8 @@ const TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrame
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
(0, frame_database_1.clearOldFrames)();
|
|
192
|
-
(0,
|
|
193
|
-
|
|
194
|
-
timestampsInSeconds: ({ track }) => {
|
|
192
|
+
(0, extract_frames_1.extractFrames)({
|
|
193
|
+
timestampsInSeconds: ({ track, }) => {
|
|
195
194
|
aspectRatio.current = track.width / track.height;
|
|
196
195
|
frame_database_1.aspectRatioCache.set(src, aspectRatio.current);
|
|
197
196
|
ensureSlots({
|
|
@@ -201,19 +200,14 @@ const TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrame
|
|
|
201
200
|
visualizationWidth,
|
|
202
201
|
aspectRatio: aspectRatio.current,
|
|
203
202
|
});
|
|
204
|
-
return Array.from(filledSlots.keys()).map((timestamp) => timestamp /
|
|
203
|
+
return Array.from(filledSlots.keys()).map((timestamp) => timestamp / WEBCODECS_TIMESCALE);
|
|
205
204
|
},
|
|
206
205
|
src,
|
|
207
206
|
onFrame: (frame) => {
|
|
208
207
|
const scale = (HEIGHT / frame.displayHeight) * window.devicePixelRatio;
|
|
209
|
-
const transformed = (0,
|
|
208
|
+
const transformed = (0, resize_video_frame_1.resizeVideoFrame)({
|
|
210
209
|
frame,
|
|
211
|
-
|
|
212
|
-
mode: 'scale',
|
|
213
|
-
scale,
|
|
214
|
-
},
|
|
215
|
-
rotation: 0,
|
|
216
|
-
needsToBeMultipleOfTwo: false,
|
|
210
|
+
scale,
|
|
217
211
|
});
|
|
218
212
|
if (transformed !== frame) {
|
|
219
213
|
frame.close();
|
|
@@ -259,9 +253,6 @@ const TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrame
|
|
|
259
253
|
});
|
|
260
254
|
})
|
|
261
255
|
.catch((e) => {
|
|
262
|
-
if ((0, media_parser_1.hasBeenAborted)(e)) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
256
|
setError(e);
|
|
266
257
|
})
|
|
267
258
|
.finally(() => {
|