jbilcke-hf HF staff commited on
Commit
93a2c43
·
1 Parent(s): bfdc3bb

upgrade dependencies

Browse files
package-lock.json CHANGED
@@ -9,7 +9,7 @@
9
  "version": "1.0.0",
10
  "license": "Apache License",
11
  "dependencies": {
12
- "@aitube/clap": "0.0.10",
13
  "@aitube/encoders": "0.0.0",
14
  "@aitube/io": "0.0.0",
15
  "dotenv": "^16.3.1",
@@ -29,9 +29,9 @@
29
  }
30
  },
31
  "node_modules/@aitube/clap": {
32
- "version": "0.0.10",
33
- "resolved": "https://registry.npmjs.org/@aitube/clap/-/clap-0.0.10.tgz",
34
- "integrity": "sha512-pj855yWhUJ0QTJIaxMJhg0PwC3JaHsScJ5rQ8iqog7zDBWNNJR9MPBtFDYRuIs3vmUsGVxHwSlIBz5I1VjMF8w==",
35
  "dependencies": {
36
  "pure-uuid": "^1.8.1",
37
  "yaml": "^2.4.1"
@@ -1065,9 +1065,9 @@
1065
  "dev": true
1066
  },
1067
  "node_modules/@types/node": {
1068
- "version": "20.12.8",
1069
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
1070
- "integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
1071
  "dependencies": {
1072
  "undici-types": "~5.26.4"
1073
  }
@@ -2049,9 +2049,9 @@
2049
  }
2050
  },
2051
  "node_modules/get-tsconfig": {
2052
- "version": "4.7.3",
2053
- "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz",
2054
- "integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==",
2055
  "dev": true,
2056
  "dependencies": {
2057
  "resolve-pkg-maps": "^1.0.0"
@@ -2667,15 +2667,15 @@
2667
  }
2668
  },
2669
  "node_modules/puppeteer": {
2670
- "version": "22.7.1",
2671
- "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.7.1.tgz",
2672
- "integrity": "sha512-JBCBCwQ9+dyPp5haqeecgv0N0vgWFx44woUeKJaPeJT8CU3RXrd8F/tqJQbuAmcWlbMhYJSlTJkIFrwVAs6BNA==",
2673
  "hasInstallScript": true,
2674
  "dependencies": {
2675
  "@puppeteer/browsers": "2.2.3",
2676
  "cosmiconfig": "9.0.0",
2677
  "devtools-protocol": "0.0.1273771",
2678
- "puppeteer-core": "22.7.1"
2679
  },
2680
  "bin": {
2681
  "puppeteer": "lib/esm/puppeteer/node/cli.js"
@@ -2685,15 +2685,15 @@
2685
  }
2686
  },
2687
  "node_modules/puppeteer-core": {
2688
- "version": "22.7.1",
2689
- "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.7.1.tgz",
2690
- "integrity": "sha512-jD7T7yN7PWGuJmNT0TAEboA26s0VVnvbgCxqgQIF+eNQW2u71ENaV2JwzSJiCHO+e72H4Ue6AgKD9USQ8xAcOQ==",
2691
  "dependencies": {
2692
  "@puppeteer/browsers": "2.2.3",
2693
  "chromium-bidi": "0.5.19",
2694
  "debug": "4.3.4",
2695
  "devtools-protocol": "0.0.1273771",
2696
- "ws": "8.16.0"
2697
  },
2698
  "engines": {
2699
  "node": ">=18"
@@ -3211,9 +3211,9 @@
3211
  "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
3212
  },
3213
  "node_modules/tsx": {
3214
- "version": "4.9.0",
3215
- "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.9.0.tgz",
3216
- "integrity": "sha512-UY0UUhDPL6MkqkZU4xTEjEBOLfV+RIt4xeeJ1qwK73xai4/zveG+X6+tieILa7rjtegUW2LE4p7fw7gAoLuytA==",
3217
  "dev": true,
3218
  "dependencies": {
3219
  "esbuild": "~0.20.2",
@@ -3385,9 +3385,9 @@
3385
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
3386
  },
3387
  "node_modules/ws": {
3388
- "version": "8.16.0",
3389
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
3390
- "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
3391
  "engines": {
3392
  "node": ">=10.0.0"
3393
  },
 
9
  "version": "1.0.0",
10
  "license": "Apache License",
11
  "dependencies": {
12
+ "@aitube/clap": "0.0.14",
13
  "@aitube/encoders": "0.0.0",
14
  "@aitube/io": "0.0.0",
15
  "dotenv": "^16.3.1",
 
29
  }
30
  },
31
  "node_modules/@aitube/clap": {
32
+ "version": "0.0.14",
33
+ "resolved": "https://registry.npmjs.org/@aitube/clap/-/clap-0.0.14.tgz",
34
+ "integrity": "sha512-i4mq3YFecWVOTS/p5QaSQ0VJfurKXlyRc8FJMqKI6P/7rpf4vE4IL+jBKa4HPsYeNt85/KOt3MJKEFVtgiWGfQ==",
35
  "dependencies": {
36
  "pure-uuid": "^1.8.1",
37
  "yaml": "^2.4.1"
 
1065
  "dev": true
1066
  },
1067
  "node_modules/@types/node": {
1068
+ "version": "20.12.10",
1069
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz",
1070
+ "integrity": "sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==",
1071
  "dependencies": {
1072
  "undici-types": "~5.26.4"
1073
  }
 
2049
  }
2050
  },
2051
  "node_modules/get-tsconfig": {
2052
+ "version": "4.7.4",
2053
+ "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.4.tgz",
2054
+ "integrity": "sha512-ofbkKj+0pjXjhejr007J/fLf+sW+8H7K5GCm+msC8q3IpvgjobpyPqSRFemNyIMxklC0zeJpi7VDFna19FacvQ==",
2055
  "dev": true,
2056
  "dependencies": {
2057
  "resolve-pkg-maps": "^1.0.0"
 
2667
  }
2668
  },
2669
  "node_modules/puppeteer": {
2670
+ "version": "22.8.0",
2671
+ "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.8.0.tgz",
2672
+ "integrity": "sha512-Z616wyTr0d7KpxmfcBG22rAkzuo/xzHJ3ycpu4KiJ3dZNHn/C1CpqcCwPlpiIIsmPojTAfWjo6EMR7M+AaC0Ww==",
2673
  "hasInstallScript": true,
2674
  "dependencies": {
2675
  "@puppeteer/browsers": "2.2.3",
2676
  "cosmiconfig": "9.0.0",
2677
  "devtools-protocol": "0.0.1273771",
2678
+ "puppeteer-core": "22.8.0"
2679
  },
2680
  "bin": {
2681
  "puppeteer": "lib/esm/puppeteer/node/cli.js"
 
2685
  }
2686
  },
2687
  "node_modules/puppeteer-core": {
2688
+ "version": "22.8.0",
2689
+ "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.8.0.tgz",
2690
+ "integrity": "sha512-S5bWx3g/fNuyFxjZX9TkZMN07CEH47+9Zm6IiTl1QfqI9pnVaShbwrD9kRe5vmz/XPp/jLGhhxRUj1sY4wObnA==",
2691
  "dependencies": {
2692
  "@puppeteer/browsers": "2.2.3",
2693
  "chromium-bidi": "0.5.19",
2694
  "debug": "4.3.4",
2695
  "devtools-protocol": "0.0.1273771",
2696
+ "ws": "8.17.0"
2697
  },
2698
  "engines": {
2699
  "node": ">=18"
 
3211
  "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
3212
  },
3213
  "node_modules/tsx": {
3214
+ "version": "4.9.3",
3215
+ "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.9.3.tgz",
3216
+ "integrity": "sha512-czVbetlILiyJZI5zGlj2kw9vFiSeyra9liPD4nG+Thh4pKTi0AmMEQ8zdV/L2xbIVKrIqif4sUNrsMAOksx9Zg==",
3217
  "dev": true,
3218
  "dependencies": {
3219
  "esbuild": "~0.20.2",
 
3385
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
3386
  },
3387
  "node_modules/ws": {
3388
+ "version": "8.17.0",
3389
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
3390
+ "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
3391
  "engines": {
3392
  "node": ">=10.0.0"
3393
  },
package.json CHANGED
@@ -13,7 +13,7 @@
13
  "author": "Julian Bilcke <julian.bilcke@huggingface.co>",
14
  "license": "Apache License",
15
  "dependencies": {
16
- "@aitube/clap": "0.0.10",
17
  "@aitube/encoders": "0.0.0",
18
  "@aitube/io": "0.0.0",
19
  "dotenv": "^16.3.1",
 
13
  "author": "Julian Bilcke <julian.bilcke@huggingface.co>",
14
  "license": "Apache License",
15
  "dependencies": {
16
+ "@aitube/clap": "0.0.14",
17
  "@aitube/encoders": "0.0.0",
18
  "@aitube/io": "0.0.0",
19
  "dotenv": "^16.3.1",
src/core/exporters/storyboardSegmentToVideoFile.ts CHANGED
@@ -1,13 +1,11 @@
1
  import { join } from "node:path"
2
 
3
- import { ClapProject, ClapSegment } from "@aitube/clap"
4
  import { extractBase64 } from "@aitube/encoders"
5
  import { deleteFile, writeBase64ToFile } from "@aitube/io"
6
  //import { addTextToVideo, concatenateVideosWithAudio, imageToVideoBase64 } from "@aitube/ffmpeg"
7
  import { addTextToVideo, concatenateVideosWithAudio, imageToVideoBase64 } from "../../bug-in-bun/aitube_ffmpeg"
8
 
9
- import { startOfSegment1IsWithinSegment2 } from "../utils/startOfSegment1IsWithinSegment2"
10
-
11
  export async function storyboardSegmentToVideoFile({
12
  clap,
13
  segment,
@@ -31,13 +29,13 @@ export async function storyboardSegmentToVideoFile({
31
  outputVideoFormat: "mp4",
32
  })
33
 
34
- const interfaceSegments = clap.segments.filter(s =>
35
- // nope, not all interfaces asset have the assetUrl
36
- // although in the future.. we might want to
37
- // s.assetUrl.startsWith("data:text/") &&
38
- s.category === "interface" &&
39
- startOfSegment1IsWithinSegment2(s, segment)
40
  )
 
41
  console.log(`clapWithStoryboardsToVideoFile: got ${interfaceSegments.length} interface segments for shot ${segment.id} [${segment.startTimeInMs}:${segment.endTimeInMs}]`)
42
 
43
  const interfaceSegment = interfaceSegments.at(0)
@@ -60,12 +58,12 @@ export async function storyboardSegmentToVideoFile({
60
  storyboardSegmentVideoFilePath = videoSegmentWithOverlayFilePath
61
  }
62
 
63
-
64
- const dialogueSegments = clap.segments.filter(s =>
65
- s.assetUrl.startsWith("data:audio/") &&
66
- s.category === "dialogue" &&
67
- startOfSegment1IsWithinSegment2(s, segment)
68
- )
69
 
70
  console.log(`clapWithStoryboardsToVideoFile: got ${dialogueSegments.length} dialogue segments for shot ${segment.id} [${segment.startTimeInMs}:${segment.endTimeInMs}]`)
71
 
 
1
  import { join } from "node:path"
2
 
3
+ import { ClapProject, ClapSegment, ClapSegmentCategory, ClapSegmentFilteringMode, filterSegments } from "@aitube/clap"
4
  import { extractBase64 } from "@aitube/encoders"
5
  import { deleteFile, writeBase64ToFile } from "@aitube/io"
6
  //import { addTextToVideo, concatenateVideosWithAudio, imageToVideoBase64 } from "@aitube/ffmpeg"
7
  import { addTextToVideo, concatenateVideosWithAudio, imageToVideoBase64 } from "../../bug-in-bun/aitube_ffmpeg"
8
 
 
 
9
  export async function storyboardSegmentToVideoFile({
10
  clap,
11
  segment,
 
29
  outputVideoFormat: "mp4",
30
  })
31
 
32
+ const interfaceSegments = filterSegments(
33
+ ClapSegmentFilteringMode.START,
34
+ segment,
35
+ clap.segments,
36
+ ClapSegmentCategory.INTERFACE
 
37
  )
38
+
39
  console.log(`clapWithStoryboardsToVideoFile: got ${interfaceSegments.length} interface segments for shot ${segment.id} [${segment.startTimeInMs}:${segment.endTimeInMs}]`)
40
 
41
  const interfaceSegment = interfaceSegments.at(0)
 
58
  storyboardSegmentVideoFilePath = videoSegmentWithOverlayFilePath
59
  }
60
 
61
+ const dialogueSegments = filterSegments(
62
+ ClapSegmentFilteringMode.START,
63
+ segment,
64
+ clap.segments,
65
+ ClapSegmentCategory.DIALOGUE
66
+ ).filter(s => s.assetUrl.startsWith("data:audio/"))
67
 
68
  console.log(`clapWithStoryboardsToVideoFile: got ${dialogueSegments.length} dialogue segments for shot ${segment.id} [${segment.startTimeInMs}:${segment.endTimeInMs}]`)
69
 
src/core/exporters/videoSegmentToVideoFile.ts CHANGED
@@ -1,13 +1,11 @@
1
  import { join } from "node:path"
2
 
3
- import { ClapProject, ClapSegment } from "@aitube/clap"
4
  import { extractBase64 } from "@aitube/encoders"
5
  import { deleteFile, writeBase64ToFile } from "@aitube/io"
6
  // import { addTextToVideo, concatenateVideosWithAudio } from "@aitube/ffmpeg"
7
  import { addTextToVideo, concatenateVideosWithAudio } from "../../bug-in-bun/aitube_ffmpeg"
8
 
9
- import { startOfSegment1IsWithinSegment2 } from "../utils/startOfSegment1IsWithinSegment2"
10
-
11
  export async function videoSegmentToVideoFile({
12
  clap,
13
  segment,
@@ -25,13 +23,13 @@ export async function videoSegmentToVideoFile({
25
  segment.assetUrl,
26
  join(outputDir, `tmp_asset_${segment.id}.${base64Info.extension}`)
27
  )
28
- const interfaceSegments = clap.segments.filter(s =>
29
- // nope, not all interfaces asset have the assetUrl
30
- // although in the future.. we might want to
31
- // s.assetUrl.startsWith("data:text/") &&
32
- s.category === "interface" &&
33
- startOfSegment1IsWithinSegment2(s, segment)
34
  )
 
35
  const interfaceSegment = interfaceSegments.at(0)
36
  if (interfaceSegment) {
37
  // here we are free to use mp4, since this is an internal intermediary format
@@ -49,11 +47,14 @@ export async function videoSegmentToVideoFile({
49
  await deleteFile(videoSegmentFilePath)
50
  videoSegmentFilePath = videoSegmentWithOverlayFilePath
51
  }
52
- const dialogueSegments = clap.segments.filter(s =>
53
- s.assetUrl.startsWith("data:audio/") &&
54
- s.category === "dialogue" &&
55
- startOfSegment1IsWithinSegment2(s, segment)
56
- )
 
 
 
57
  const dialogueSegment = dialogueSegments.at(0)
58
  if (dialogueSegment) {
59
  extractBase64(dialogueSegment.assetUrl)
 
1
  import { join } from "node:path"
2
 
3
+ import { ClapProject, ClapSegment, ClapSegmentCategory, ClapSegmentFilteringMode, filterSegments } from "@aitube/clap"
4
  import { extractBase64 } from "@aitube/encoders"
5
  import { deleteFile, writeBase64ToFile } from "@aitube/io"
6
  // import { addTextToVideo, concatenateVideosWithAudio } from "@aitube/ffmpeg"
7
  import { addTextToVideo, concatenateVideosWithAudio } from "../../bug-in-bun/aitube_ffmpeg"
8
 
 
 
9
  export async function videoSegmentToVideoFile({
10
  clap,
11
  segment,
 
23
  segment.assetUrl,
24
  join(outputDir, `tmp_asset_${segment.id}.${base64Info.extension}`)
25
  )
26
+ const interfaceSegments = filterSegments(
27
+ ClapSegmentFilteringMode.START,
28
+ segment,
29
+ clap.segments,
30
+ ClapSegmentCategory.INTERFACE
 
31
  )
32
+
33
  const interfaceSegment = interfaceSegments.at(0)
34
  if (interfaceSegment) {
35
  // here we are free to use mp4, since this is an internal intermediary format
 
47
  await deleteFile(videoSegmentFilePath)
48
  videoSegmentFilePath = videoSegmentWithOverlayFilePath
49
  }
50
+
51
+ const dialogueSegments = filterSegments(
52
+ ClapSegmentFilteringMode.START,
53
+ segment,
54
+ clap.segments,
55
+ ClapSegmentCategory.DIALOGUE
56
+ ).map(s => s.assetUrl.startsWith("data:audio/"))
57
+
58
  const dialogueSegment = dialogueSegments.at(0)
59
  if (dialogueSegment) {
60
  extractBase64(dialogueSegment.assetUrl)
src/core/utils/startOfSegment1IsWithinSegment2.ts DELETED
@@ -1,6 +0,0 @@
1
- import { ClapSegment } from "@aitube/clap"
2
-
3
- export function startOfSegment1IsWithinSegment2(s1: ClapSegment, s2: ClapSegment) {
4
- const startOfSegment1 = s1.startTimeInMs
5
- return s2.startTimeInMs <= startOfSegment1 && startOfSegment1 <= s2.endTimeInMs
6
- }
 
 
 
 
 
 
 
src/main.ts CHANGED
@@ -1,6 +1,6 @@
1
  import { join } from "node:path"
2
 
3
- import { ClapProject } from "@aitube/clap"
4
  import { deleteFilesWithName, getRandomDirectory, writeBase64ToFile } from "@aitube/io"
5
  import {
6
  concatenateAudio,
@@ -47,8 +47,8 @@ export async function clapToTmpVideoFilePath({
47
 
48
  outputDir = outputDir || (await getRandomDirectory())
49
 
50
- const videoSegments = clap.segments.filter(s => s.category === "video" && s.assetUrl.startsWith("data:video/"))
51
- const storyboardSegments = clap.segments.filter(s => s.category === "storyboard" && s.assetUrl.startsWith("data:image/"))
52
 
53
  const canUseVideos = videoSegments.length > 0
54
  const canUseStoryboards = !canUseVideos && storyboardSegments.length > 0
@@ -97,7 +97,7 @@ export async function clapToTmpVideoFilePath({
97
  const audioTracks: string[] = []
98
 
99
  const musicSegments = clap.segments.filter(s =>
100
- s.category === "music" &&
101
  s.assetUrl.startsWith("data:audio/")
102
  )
103
 
 
1
  import { join } from "node:path"
2
 
3
+ import { ClapProject, ClapSegmentCategory } from "@aitube/clap"
4
  import { deleteFilesWithName, getRandomDirectory, writeBase64ToFile } from "@aitube/io"
5
  import {
6
  concatenateAudio,
 
47
 
48
  outputDir = outputDir || (await getRandomDirectory())
49
 
50
+ const videoSegments = clap.segments.filter(s => s.category === ClapSegmentCategory.VIDEO && s.assetUrl.startsWith("data:video/"))
51
+ const storyboardSegments = clap.segments.filter(s => s.category === ClapSegmentCategory.STORYBOARD && s.assetUrl.startsWith("data:image/"))
52
 
53
  const canUseVideos = videoSegments.length > 0
54
  const canUseStoryboards = !canUseVideos && storyboardSegments.length > 0
 
97
  const audioTracks: string[] = []
98
 
99
  const musicSegments = clap.segments.filter(s =>
100
+ s.category === ClapSegmentCategory.MUSIC &&
101
  s.assetUrl.startsWith("data:audio/")
102
  )
103