Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
7fca805
1
Parent(s):
bb04353
upgrade dependencies
Browse files- package-lock.json +14 -14
- package.json +2 -2
- src/core/utils/videoChunksOnly.ts +39 -0
- src/main.ts +2 -33
package-lock.json
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
"version": "1.0.3",
|
10 |
"license": "Apache License",
|
11 |
"dependencies": {
|
12 |
-
"@aitube/clap": "0.0.
|
13 |
"@aitube/encoders": "0.0.0",
|
14 |
"@aitube/io": "0.0.0",
|
15 |
"dotenv": "^16.4.5",
|
@@ -29,9 +29,9 @@
|
|
29 |
}
|
30 |
},
|
31 |
"node_modules/@aitube/clap": {
|
32 |
-
"version": "0.0.
|
33 |
-
"resolved": "https://registry.npmjs.org/@aitube/clap/-/clap-0.0.
|
34 |
-
"integrity": "sha512-
|
35 |
"dependencies": {
|
36 |
"pure-uuid": "^1.8.1",
|
37 |
"yaml": "^2.4.2"
|
@@ -1454,9 +1454,9 @@
|
|
1454 |
}
|
1455 |
},
|
1456 |
"node_modules/@types/express-serve-static-core": {
|
1457 |
-
"version": "4.19.
|
1458 |
-
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.
|
1459 |
-
"integrity": "sha512-
|
1460 |
"dev": true,
|
1461 |
"dependencies": {
|
1462 |
"@types/node": "*",
|
@@ -1848,11 +1848,11 @@
|
|
1848 |
}
|
1849 |
},
|
1850 |
"node_modules/braces": {
|
1851 |
-
"version": "3.0.
|
1852 |
-
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.
|
1853 |
-
"integrity": "sha512-
|
1854 |
"dependencies": {
|
1855 |
-
"fill-range": "^7.
|
1856 |
},
|
1857 |
"engines": {
|
1858 |
"node": ">=8"
|
@@ -2556,9 +2556,9 @@
|
|
2556 |
}
|
2557 |
},
|
2558 |
"node_modules/fill-range": {
|
2559 |
-
"version": "7.
|
2560 |
-
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.
|
2561 |
-
"integrity": "sha512-
|
2562 |
"dependencies": {
|
2563 |
"to-regex-range": "^5.0.1"
|
2564 |
},
|
|
|
9 |
"version": "1.0.3",
|
10 |
"license": "Apache License",
|
11 |
"dependencies": {
|
12 |
+
"@aitube/clap": "0.0.20",
|
13 |
"@aitube/encoders": "0.0.0",
|
14 |
"@aitube/io": "0.0.0",
|
15 |
"dotenv": "^16.4.5",
|
|
|
29 |
}
|
30 |
},
|
31 |
"node_modules/@aitube/clap": {
|
32 |
+
"version": "0.0.20",
|
33 |
+
"resolved": "https://registry.npmjs.org/@aitube/clap/-/clap-0.0.20.tgz",
|
34 |
+
"integrity": "sha512-QOEl3GTHRpaBtKGYoH+iabY9TfLYogOoIfc/YuwC01paO/woMASccjDloPGiPe9C0/P88AqB6s7bN3Dkz1v0TQ==",
|
35 |
"dependencies": {
|
36 |
"pure-uuid": "^1.8.1",
|
37 |
"yaml": "^2.4.2"
|
|
|
1454 |
}
|
1455 |
},
|
1456 |
"node_modules/@types/express-serve-static-core": {
|
1457 |
+
"version": "4.19.1",
|
1458 |
+
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.1.tgz",
|
1459 |
+
"integrity": "sha512-ej0phymbFLoCB26dbbq5PGScsf2JAJ4IJHjG10LalgUV36XKTmA4GdA+PVllKvRk0sEKt64X8975qFnkSi0hqA==",
|
1460 |
"dev": true,
|
1461 |
"dependencies": {
|
1462 |
"@types/node": "*",
|
|
|
1848 |
}
|
1849 |
},
|
1850 |
"node_modules/braces": {
|
1851 |
+
"version": "3.0.3",
|
1852 |
+
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
1853 |
+
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
1854 |
"dependencies": {
|
1855 |
+
"fill-range": "^7.1.1"
|
1856 |
},
|
1857 |
"engines": {
|
1858 |
"node": ">=8"
|
|
|
2556 |
}
|
2557 |
},
|
2558 |
"node_modules/fill-range": {
|
2559 |
+
"version": "7.1.1",
|
2560 |
+
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
2561 |
+
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
2562 |
"dependencies": {
|
2563 |
"to-regex-range": "^5.0.1"
|
2564 |
},
|
package.json
CHANGED
@@ -8,12 +8,12 @@
|
|
8 |
"dev": "tsx src/index.ts",
|
9 |
"docker": "npm run docker:build && npm run docker:run",
|
10 |
"docker:build": "docker build -t ai-tube-clap-exporter .",
|
11 |
-
"docker:run": "docker run -it -p
|
12 |
},
|
13 |
"author": "Julian Bilcke <julian.bilcke@huggingface.co>",
|
14 |
"license": "Apache License",
|
15 |
"dependencies": {
|
16 |
-
"@aitube/clap": "0.0.
|
17 |
"@aitube/encoders": "0.0.0",
|
18 |
"@aitube/io": "0.0.0",
|
19 |
"dotenv": "^16.4.5",
|
|
|
8 |
"dev": "tsx src/index.ts",
|
9 |
"docker": "npm run docker:build && npm run docker:run",
|
10 |
"docker:build": "docker build -t ai-tube-clap-exporter .",
|
11 |
+
"docker:run": "docker run -it -p 3000:3000 ai-tube-clap-exporter"
|
12 |
},
|
13 |
"author": "Julian Bilcke <julian.bilcke@huggingface.co>",
|
14 |
"license": "Apache License",
|
15 |
"dependencies": {
|
16 |
+
"@aitube/clap": "0.0.20",
|
17 |
"@aitube/encoders": "0.0.0",
|
18 |
"@aitube/io": "0.0.0",
|
19 |
"dotenv": "^16.4.5",
|
src/core/utils/videoChunksOnly.ts
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { ClapProject, ClapSegment, ClapSegmentCategory } from "@aitube/clap"
|
2 |
+
|
3 |
+
export function videoChunksOnly(clap: ClapProject): ClapSegment[] {
|
4 |
+
const alreadyAnEmbeddedFinalVideo = clap.segments.filter(s =>
|
5 |
+
s.category === ClapSegmentCategory.VIDEO &&
|
6 |
+
s.status === "completed" &&
|
7 |
+
s.startTimeInMs === 0 &&
|
8 |
+
s.endTimeInMs === clap.meta.durationInMs &&
|
9 |
+
s.assetUrl).at(0)
|
10 |
+
|
11 |
+
let ignoreThisVideoSegmentId = ""
|
12 |
+
|
13 |
+
if (alreadyAnEmbeddedFinalVideo) {
|
14 |
+
ignoreThisVideoSegmentId = alreadyAnEmbeddedFinalVideo?.id || ""
|
15 |
+
|
16 |
+
/*
|
17 |
+
you know what.. let's just ignore it, and re-generate fresh content
|
18 |
+
because most probably the user made an honest mistake
|
19 |
+
|
20 |
+
const outputFilePath = await writeBase64ToFile(
|
21 |
+
alreadyAnEmbeddedFinalVideo.assetUrl,
|
22 |
+
join(outputDir, `existing_final_video`)
|
23 |
+
)
|
24 |
+
|
25 |
+
return {
|
26 |
+
tmpWorkDir: outputDir,
|
27 |
+
outputFilePath
|
28 |
+
}
|
29 |
+
*/
|
30 |
+
}
|
31 |
+
|
32 |
+
const videoSegments = clap.segments.filter(s =>
|
33 |
+
s.category === ClapSegmentCategory.VIDEO &&
|
34 |
+
s.assetUrl.startsWith("data:video/") &&
|
35 |
+
s.id !== ignoreThisVideoSegmentId
|
36 |
+
)
|
37 |
+
|
38 |
+
return videoSegments
|
39 |
+
}
|
src/main.ts
CHANGED
@@ -16,6 +16,7 @@ import {
|
|
16 |
import { clapWithStoryboardsToVideoFile } from "./core/exporters/clapWithStoryboardsToVideoFile"
|
17 |
import { clapWithVideosToVideoFile } from "./core/exporters/clapWithVideosToVideoFile"
|
18 |
import { extractBase64 } from "@aitube/encoders"
|
|
|
19 |
|
20 |
/**
|
21 |
* Generate a .mp4 video inside a directory (if none is provided, it will be created in /tmp)
|
@@ -50,39 +51,7 @@ export async function clapToTmpVideoFilePath({
|
|
50 |
|
51 |
outputDir = outputDir || (await getRandomDirectory())
|
52 |
|
53 |
-
const
|
54 |
-
s.category === ClapSegmentCategory.VIDEO &&
|
55 |
-
s.status === "completed" &&
|
56 |
-
s.startTimeInMs === 0 &&
|
57 |
-
s.endTimeInMs === clap.meta.durationInMs &&
|
58 |
-
s.assetUrl).at(0)
|
59 |
-
|
60 |
-
let ignoreThisVideoSegmentId = ""
|
61 |
-
|
62 |
-
if (alreadyAnEmbeddedFinalVideo) {
|
63 |
-
ignoreThisVideoSegmentId = alreadyAnEmbeddedFinalVideo?.id || ""
|
64 |
-
|
65 |
-
/*
|
66 |
-
you know what.. let's just ignore it, and re-generate fresh content
|
67 |
-
because most probably the user made an honest mistake
|
68 |
-
|
69 |
-
const outputFilePath = await writeBase64ToFile(
|
70 |
-
alreadyAnEmbeddedFinalVideo.assetUrl,
|
71 |
-
join(outputDir, `existing_final_video`)
|
72 |
-
)
|
73 |
-
|
74 |
-
return {
|
75 |
-
tmpWorkDir: outputDir,
|
76 |
-
outputFilePath
|
77 |
-
}
|
78 |
-
*/
|
79 |
-
}
|
80 |
-
|
81 |
-
const videoSegments = clap.segments.filter(s =>
|
82 |
-
s.category === ClapSegmentCategory.VIDEO &&
|
83 |
-
s.assetUrl.startsWith("data:video/") &&
|
84 |
-
s.id !== ignoreThisVideoSegmentId
|
85 |
-
)
|
86 |
|
87 |
const storyboardSegments = clap.segments.filter(s => s.category === ClapSegmentCategory.STORYBOARD && s.assetUrl.startsWith("data:image/"))
|
88 |
|
|
|
16 |
import { clapWithStoryboardsToVideoFile } from "./core/exporters/clapWithStoryboardsToVideoFile"
|
17 |
import { clapWithVideosToVideoFile } from "./core/exporters/clapWithVideosToVideoFile"
|
18 |
import { extractBase64 } from "@aitube/encoders"
|
19 |
+
import { videoChunksOnly } from "./core/utils/videoChunksOnly"
|
20 |
|
21 |
/**
|
22 |
* Generate a .mp4 video inside a directory (if none is provided, it will be created in /tmp)
|
|
|
51 |
|
52 |
outputDir = outputDir || (await getRandomDirectory())
|
53 |
|
54 |
+
const videoSegments = videoChunksOnly(clap)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
const storyboardSegments = clap.segments.filter(s => s.category === ClapSegmentCategory.STORYBOARD && s.assetUrl.startsWith("data:image/"))
|
57 |
|