@remotion/media 4.0.355 → 4.0.356
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/audio/audio-for-rendering.js +37 -3
- package/dist/audio/audio.js +1 -1
- package/dist/audio/props.d.ts +15 -0
- package/dist/audio-extraction/audio-iterator.d.ts +3 -2
- package/dist/audio-extraction/audio-iterator.js +13 -2
- package/dist/audio-extraction/audio-manager.d.ts +6 -5
- package/dist/audio-extraction/audio-manager.js +5 -3
- package/dist/audio-extraction/extract-audio.d.ts +3 -2
- package/dist/audio-extraction/extract-audio.js +11 -4
- package/dist/caches.d.ts +6 -5
- package/dist/convert-audiodata/apply-tonefrequency.d.ts +2 -0
- package/dist/convert-audiodata/apply-tonefrequency.js +44 -0
- package/dist/convert-audiodata/wsola.d.ts +13 -0
- package/dist/convert-audiodata/wsola.js +197 -0
- package/dist/esm/index.mjs +1297 -140
- package/dist/extract-frame-and-audio.d.ts +3 -2
- package/dist/extract-frame-and-audio.js +60 -26
- package/dist/get-sink-weak.d.ts +2 -7
- package/dist/index.d.ts +12 -3
- package/dist/index.js +11 -2
- package/dist/video/media-player.d.ts +70 -0
- package/dist/video/media-player.js +419 -0
- package/dist/video/props.d.ts +36 -18
- package/dist/video/timeout-utils.d.ts +2 -0
- package/dist/video/timeout-utils.js +18 -0
- package/dist/video/video-for-preview.d.ts +17 -0
- package/dist/video/video-for-preview.js +218 -0
- package/dist/video/video-for-rendering.d.ts +23 -2
- package/dist/video/video-for-rendering.js +47 -4
- package/dist/video/video.js +13 -14
- package/dist/video-extraction/extract-frame-via-broadcast-channel.d.ts +3 -2
- package/dist/video-extraction/extract-frame-via-broadcast-channel.js +53 -4
- package/dist/video-extraction/extract-frame.d.ts +2 -1
- package/dist/video-extraction/extract-frame.js +9 -3
- package/dist/video-extraction/get-frames-since-keyframe.d.ts +12 -7
- package/dist/video-extraction/get-frames-since-keyframe.js +70 -17
- package/package.json +3 -3
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { EncodedPacket } from 'mediabunny';
|
|
2
2
|
import { AudioSampleSink, EncodedPacketSink, VideoSampleSink } from 'mediabunny';
|
|
3
|
+
type VideoSinks = {
|
|
4
|
+
sampleSink: VideoSampleSink;
|
|
5
|
+
packetSink: EncodedPacketSink;
|
|
6
|
+
};
|
|
7
|
+
type AudioSinks = {
|
|
8
|
+
sampleSink: AudioSampleSink;
|
|
9
|
+
};
|
|
10
|
+
export type AudioSinkResult = AudioSinks | 'no-audio-track' | 'cannot-decode-audio' | 'unknown-container-format';
|
|
11
|
+
export type VideoSinkResult = VideoSinks | 'no-video-track' | 'cannot-decode' | 'unknown-container-format';
|
|
3
12
|
export declare const getSinks: (src: string) => Promise<WeakRef<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
packetSink: EncodedPacketSink;
|
|
7
|
-
} | null;
|
|
8
|
-
audio: {
|
|
9
|
-
sampleSink: AudioSampleSink;
|
|
10
|
-
} | null;
|
|
13
|
+
getVideo: () => Promise<VideoSinkResult>;
|
|
14
|
+
getAudio: (index: number) => Promise<AudioSinkResult>;
|
|
11
15
|
actualMatroskaTimestamps: {
|
|
12
16
|
observeTimestamp: (startTime: number) => void;
|
|
13
17
|
getRealTimestamp: (observedTimestamp: number) => number | null;
|
|
@@ -21,3 +25,4 @@ export declare const getFramesSinceKeyframe: ({ packetSink, videoSampleSink, sta
|
|
|
21
25
|
videoSampleSink: VideoSampleSink;
|
|
22
26
|
startPacket: EncodedPacket;
|
|
23
27
|
}) => Promise<import("./keyframe-bank").KeyframeBank>;
|
|
28
|
+
export {};
|
|
@@ -1,27 +1,80 @@
|
|
|
1
|
-
import { ALL_FORMATS, AudioSampleSink, EncodedPacketSink, Input, MATROSKA, UrlSource, VideoSampleSink, } from 'mediabunny';
|
|
1
|
+
import { ALL_FORMATS, AudioSampleSink, EncodedPacketSink, Input, MATROSKA, UrlSource, VideoSampleSink, WEBM, } from 'mediabunny';
|
|
2
2
|
import { makeKeyframeBank } from './keyframe-bank';
|
|
3
3
|
import { rememberActualMatroskaTimestamps } from './remember-actual-matroska-timestamps';
|
|
4
|
+
const getRetryDelay = (() => {
|
|
5
|
+
return null;
|
|
6
|
+
});
|
|
7
|
+
const getFormatOrNull = async (input) => {
|
|
8
|
+
try {
|
|
9
|
+
return await input.getFormat();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
4
15
|
export const getSinks = async (src) => {
|
|
5
16
|
const input = new Input({
|
|
6
17
|
formats: ALL_FORMATS,
|
|
7
|
-
source: new UrlSource(src
|
|
18
|
+
source: new UrlSource(src, {
|
|
19
|
+
getRetryDelay,
|
|
20
|
+
}),
|
|
8
21
|
});
|
|
9
|
-
const format = await input
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
22
|
+
const format = await getFormatOrNull(input);
|
|
23
|
+
const isMatroska = format === MATROSKA || format === WEBM;
|
|
24
|
+
const getVideoSinks = async () => {
|
|
25
|
+
if (format === null) {
|
|
26
|
+
return 'unknown-container-format';
|
|
27
|
+
}
|
|
28
|
+
const videoTrack = await input.getPrimaryVideoTrack();
|
|
29
|
+
if (!videoTrack) {
|
|
30
|
+
return 'no-video-track';
|
|
31
|
+
}
|
|
32
|
+
const canDecode = await videoTrack.canDecode();
|
|
33
|
+
if (!canDecode) {
|
|
34
|
+
return 'cannot-decode';
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
sampleSink: new VideoSampleSink(videoTrack),
|
|
38
|
+
packetSink: new EncodedPacketSink(videoTrack),
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
let videoSinksPromise = null;
|
|
42
|
+
const getVideoSinksPromise = () => {
|
|
43
|
+
if (videoSinksPromise) {
|
|
44
|
+
return videoSinksPromise;
|
|
45
|
+
}
|
|
46
|
+
videoSinksPromise = getVideoSinks();
|
|
47
|
+
return videoSinksPromise;
|
|
48
|
+
};
|
|
49
|
+
// audioSinksPromise is now a record indexed by audio track index
|
|
50
|
+
const audioSinksPromise = {};
|
|
51
|
+
const getAudioSinks = async (index) => {
|
|
52
|
+
if (format === null) {
|
|
53
|
+
return 'unknown-container-format';
|
|
54
|
+
}
|
|
55
|
+
const audioTracks = await input.getAudioTracks();
|
|
56
|
+
const audioTrack = audioTracks[index];
|
|
57
|
+
if (!audioTrack) {
|
|
58
|
+
return 'no-audio-track';
|
|
59
|
+
}
|
|
60
|
+
const canDecode = await audioTrack.canDecode();
|
|
61
|
+
if (!canDecode) {
|
|
62
|
+
return 'cannot-decode-audio';
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
sampleSink: new AudioSampleSink(audioTrack),
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const getAudioSinksPromise = (index) => {
|
|
69
|
+
if (audioSinksPromise[index]) {
|
|
70
|
+
return audioSinksPromise[index];
|
|
71
|
+
}
|
|
72
|
+
audioSinksPromise[index] = getAudioSinks(index);
|
|
73
|
+
return audioSinksPromise[index];
|
|
74
|
+
};
|
|
13
75
|
return new WeakRef({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
sampleSink: new VideoSampleSink(videoTrack),
|
|
17
|
-
packetSink: new EncodedPacketSink(videoTrack),
|
|
18
|
-
}
|
|
19
|
-
: null,
|
|
20
|
-
audio: audioTrack
|
|
21
|
-
? {
|
|
22
|
-
sampleSink: new AudioSampleSink(audioTrack),
|
|
23
|
-
}
|
|
24
|
-
: null,
|
|
76
|
+
getVideo: () => getVideoSinksPromise(),
|
|
77
|
+
getAudio: (index) => getAudioSinksPromise(index),
|
|
25
78
|
actualMatroskaTimestamps: rememberActualMatroskaTimestamps(isMatroska),
|
|
26
79
|
isMatroska,
|
|
27
80
|
getDuration: () => input.computeDuration(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.356",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.mjs",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"mediabunny": "1.21.0",
|
|
17
17
|
"webdriverio": "9.19.2",
|
|
18
|
-
"remotion": "4.0.
|
|
18
|
+
"remotion": "4.0.356"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": ">=16.8.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react": "19.0.0",
|
|
28
28
|
"react-dom": "19.0.0",
|
|
29
29
|
"vitest": "3.2.4",
|
|
30
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
30
|
+
"@remotion/eslint-config-internal": "4.0.356"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [],
|
|
33
33
|
"publishConfig": {
|