@remotion/captions 4.0.364 → 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/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/captions"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/captions",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.366",
|
|
7
7
|
"description": "Primitives for dealing with captions",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -16,15 +16,12 @@
|
|
|
16
16
|
"test": "bun test src",
|
|
17
17
|
"make": "tsc -d"
|
|
18
18
|
},
|
|
19
|
-
"files": [
|
|
20
|
-
"dist"
|
|
21
|
-
],
|
|
22
19
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
23
20
|
"license": "MIT",
|
|
24
21
|
"dependencies": {},
|
|
25
22
|
"peerDependencies": {},
|
|
26
23
|
"devDependencies": {
|
|
27
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
24
|
+
"@remotion/eslint-config-internal": "4.0.366",
|
|
28
25
|
"eslint": "9.19.0"
|
|
29
26
|
},
|
|
30
27
|
"keywords": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bun_test_1 = require("bun:test");
|
|
4
|
-
const ensure_max_characters_per_line_1 = require("../ensure-max-characters-per-line");
|
|
5
|
-
(0, bun_test_1.test)('Ensure max characters per line', () => {
|
|
6
|
-
const captions = [
|
|
7
|
-
{
|
|
8
|
-
confidence: 1,
|
|
9
|
-
endMs: 6000,
|
|
10
|
-
startMs: 3000,
|
|
11
|
-
text: 'This is a demonstration of SRT subtitles.',
|
|
12
|
-
timestampMs: 4500,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
confidence: 1,
|
|
16
|
-
endMs: 10500,
|
|
17
|
-
startMs: 7000,
|
|
18
|
-
text: 'You can use SRT files to add subtitles to your videos.',
|
|
19
|
-
timestampMs: 8750,
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
// TODO: This creates captions that are not nice!
|
|
23
|
-
(0, bun_test_1.expect)((0, ensure_max_characters_per_line_1.ensureMaxCharactersPerLine)({ captions, maxCharsPerLine: 42 })).toEqual({
|
|
24
|
-
segments: [
|
|
25
|
-
[
|
|
26
|
-
{
|
|
27
|
-
text: ' This',
|
|
28
|
-
startMs: 3000,
|
|
29
|
-
endMs: 6000,
|
|
30
|
-
confidence: 1,
|
|
31
|
-
timestampMs: 4500,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
text: 'is',
|
|
35
|
-
startMs: 3000,
|
|
36
|
-
endMs: 6000,
|
|
37
|
-
confidence: 1,
|
|
38
|
-
timestampMs: 4500,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
text: 'a',
|
|
42
|
-
startMs: 3000,
|
|
43
|
-
endMs: 6000,
|
|
44
|
-
confidence: 1,
|
|
45
|
-
timestampMs: 4500,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
text: 'demonstration',
|
|
49
|
-
startMs: 3000,
|
|
50
|
-
endMs: 6000,
|
|
51
|
-
confidence: 1,
|
|
52
|
-
timestampMs: 4500,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
text: 'of',
|
|
56
|
-
startMs: 3000,
|
|
57
|
-
endMs: 6000,
|
|
58
|
-
confidence: 1,
|
|
59
|
-
timestampMs: 4500,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
text: 'SRT',
|
|
63
|
-
startMs: 3000,
|
|
64
|
-
endMs: 6000,
|
|
65
|
-
confidence: 1,
|
|
66
|
-
timestampMs: 4500,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
text: 'subtitles.',
|
|
70
|
-
startMs: 3000,
|
|
71
|
-
endMs: 6000,
|
|
72
|
-
confidence: 1,
|
|
73
|
-
timestampMs: 4500,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
text: ' You',
|
|
77
|
-
startMs: 7000,
|
|
78
|
-
endMs: 10500,
|
|
79
|
-
confidence: 1,
|
|
80
|
-
timestampMs: 8750,
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
{
|
|
85
|
-
text: 'can',
|
|
86
|
-
startMs: 7000,
|
|
87
|
-
endMs: 10500,
|
|
88
|
-
confidence: 1,
|
|
89
|
-
timestampMs: 8750,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
text: 'use',
|
|
93
|
-
startMs: 7000,
|
|
94
|
-
endMs: 10500,
|
|
95
|
-
confidence: 1,
|
|
96
|
-
timestampMs: 8750,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
text: 'SRT',
|
|
100
|
-
startMs: 7000,
|
|
101
|
-
endMs: 10500,
|
|
102
|
-
confidence: 1,
|
|
103
|
-
timestampMs: 8750,
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
text: 'files',
|
|
107
|
-
startMs: 7000,
|
|
108
|
-
endMs: 10500,
|
|
109
|
-
confidence: 1,
|
|
110
|
-
timestampMs: 8750,
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
text: 'to',
|
|
114
|
-
startMs: 7000,
|
|
115
|
-
endMs: 10500,
|
|
116
|
-
confidence: 1,
|
|
117
|
-
timestampMs: 8750,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
text: 'add',
|
|
121
|
-
startMs: 7000,
|
|
122
|
-
endMs: 10500,
|
|
123
|
-
confidence: 1,
|
|
124
|
-
timestampMs: 8750,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
text: 'subtitles',
|
|
128
|
-
startMs: 7000,
|
|
129
|
-
endMs: 10500,
|
|
130
|
-
confidence: 1,
|
|
131
|
-
timestampMs: 8750,
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
[
|
|
135
|
-
{
|
|
136
|
-
text: 'to',
|
|
137
|
-
startMs: 7000,
|
|
138
|
-
endMs: 10500,
|
|
139
|
-
confidence: 1,
|
|
140
|
-
timestampMs: 8750,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
text: 'your',
|
|
144
|
-
startMs: 7000,
|
|
145
|
-
endMs: 10500,
|
|
146
|
-
confidence: 1,
|
|
147
|
-
timestampMs: 8750,
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
text: 'videos.',
|
|
151
|
-
startMs: 7000,
|
|
152
|
-
endMs: 10500,
|
|
153
|
-
confidence: 1,
|
|
154
|
-
timestampMs: 8750,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
],
|
|
158
|
-
});
|
|
159
|
-
});
|
package/dist/test/srt.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/test/srt.test.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bun_test_1 = require("bun:test");
|
|
4
|
-
const parse_srt_1 = require("../parse-srt");
|
|
5
|
-
const serialize_srt_1 = require("../serialize-srt");
|
|
6
|
-
const input = `
|
|
7
|
-
1
|
|
8
|
-
00:00:00,000 --> 00:00:02,500
|
|
9
|
-
Welcome to the Example Subtitle File!
|
|
10
|
-
|
|
11
|
-
2
|
|
12
|
-
00:00:03,000 --> 00:00:06,000
|
|
13
|
-
This is a demonstration of SRT subtitles.
|
|
14
|
-
|
|
15
|
-
3
|
|
16
|
-
00:00:07,000 --> 00:00:10,500
|
|
17
|
-
You can use SRT files to add subtitles to your videos.
|
|
18
|
-
|
|
19
|
-
`.trim();
|
|
20
|
-
(0, bun_test_1.test)('Should create captions', () => {
|
|
21
|
-
const { captions } = (0, parse_srt_1.parseSrt)({ input });
|
|
22
|
-
(0, bun_test_1.expect)(captions).toEqual([
|
|
23
|
-
{
|
|
24
|
-
confidence: 1,
|
|
25
|
-
endMs: 2500,
|
|
26
|
-
startMs: 0,
|
|
27
|
-
text: 'Welcome to the Example Subtitle File!',
|
|
28
|
-
timestampMs: 1250,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
confidence: 1,
|
|
32
|
-
endMs: 6000,
|
|
33
|
-
startMs: 3000,
|
|
34
|
-
text: 'This is a demonstration of SRT subtitles.',
|
|
35
|
-
timestampMs: 4500,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
confidence: 1,
|
|
39
|
-
endMs: 10500,
|
|
40
|
-
startMs: 7000,
|
|
41
|
-
text: 'You can use SRT files to add subtitles to your videos.',
|
|
42
|
-
timestampMs: 8750,
|
|
43
|
-
},
|
|
44
|
-
]);
|
|
45
|
-
const serialized = (0, serialize_srt_1.serializeSrt)({ lines: captions.map((c) => [c]) });
|
|
46
|
-
(0, bun_test_1.expect)(serialized).toEqual(input);
|
|
47
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/test/tiktok.test.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bun_test_1 = require("bun:test");
|
|
4
|
-
const create_tiktok_style_captions_1 = require("../create-tiktok-style-captions");
|
|
5
|
-
const captions = [
|
|
6
|
-
{
|
|
7
|
-
text: 'Using',
|
|
8
|
-
startMs: 40,
|
|
9
|
-
endMs: 300,
|
|
10
|
-
timestampMs: 200,
|
|
11
|
-
confidence: 0.948258,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
text: " Remotion's",
|
|
15
|
-
startMs: 300,
|
|
16
|
-
endMs: 900,
|
|
17
|
-
timestampMs: 440,
|
|
18
|
-
confidence: 0.548411,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
text: ' TikTok',
|
|
22
|
-
startMs: 900,
|
|
23
|
-
endMs: 1260,
|
|
24
|
-
timestampMs: 1080,
|
|
25
|
-
confidence: 0.953265,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
text: ' template,',
|
|
29
|
-
startMs: 1260,
|
|
30
|
-
endMs: 1950,
|
|
31
|
-
timestampMs: 1600,
|
|
32
|
-
confidence: 0.968126,
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
(0, bun_test_1.test)('Should create captions', () => {
|
|
36
|
-
const { pages: tikTokStyleCaptions } = (0, create_tiktok_style_captions_1.createTikTokStyleCaptions)({
|
|
37
|
-
captions,
|
|
38
|
-
combineTokensWithinMilliseconds: 500,
|
|
39
|
-
});
|
|
40
|
-
(0, bun_test_1.expect)(tikTokStyleCaptions).toEqual([
|
|
41
|
-
{
|
|
42
|
-
durationMs: 860,
|
|
43
|
-
text: "Using Remotion's",
|
|
44
|
-
startMs: 40,
|
|
45
|
-
tokens: [
|
|
46
|
-
{
|
|
47
|
-
text: 'Using',
|
|
48
|
-
fromMs: 40,
|
|
49
|
-
toMs: 300,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
text: " Remotion's",
|
|
53
|
-
fromMs: 300,
|
|
54
|
-
toMs: 900,
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
text: 'TikTok template,',
|
|
60
|
-
startMs: 900,
|
|
61
|
-
durationMs: 1050,
|
|
62
|
-
tokens: [
|
|
63
|
-
{
|
|
64
|
-
text: 'TikTok',
|
|
65
|
-
fromMs: 900,
|
|
66
|
-
toMs: 1260,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
text: ' template,',
|
|
70
|
-
fromMs: 1260,
|
|
71
|
-
toMs: 1950,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
]);
|
|
76
|
-
});
|