Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
d305e44
1
Parent(s):
db05cb4
working on audio generation
Browse files- Dockerfile +17 -0
- package-lock.json +121 -47
- package.json +6 -1
- src/app/api/resolve/providers/falai/index.ts +2 -2
- src/app/api/resolve/providers/replicate/index.ts +0 -2
- src/components/monitor/DynamicPlayer/index.tsx +4 -12
- src/lib/core/constants.ts +1 -1
- src/lib/ffmpeg/convertAudioToMp3.ts +50 -0
- src/lib/utils/decodeOutput.ts +9 -0
Dockerfile
CHANGED
@@ -10,6 +10,19 @@ RUN apk add git git-lfs procps htop vim nano
|
|
10 |
|
11 |
RUN apk add alpine-sdk pkgconfig
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Set up a new user named "user" with user ID 1000
|
14 |
RUN adduser --disabled-password --uid 1001 user
|
15 |
|
@@ -30,11 +43,15 @@ COPY --chown=user package*.json /app
|
|
30 |
# make sure the .env is copied as well
|
31 |
COPY --chown=user .env /app
|
32 |
|
|
|
|
|
33 |
# Copy the current directory contents into the container at /app setting the owner to the user
|
34 |
COPY --chown=user . /app
|
35 |
|
36 |
RUN npm ci --force
|
37 |
|
|
|
|
|
38 |
RUN npm run build
|
39 |
|
40 |
EXPOSE 3000
|
|
|
10 |
|
11 |
RUN apk add alpine-sdk pkgconfig
|
12 |
|
13 |
+
# For FFMPEG and gl concat
|
14 |
+
RUN apk add curl python3 python3-dev libx11-dev libsm-dev libxrender libxext-dev mesa-dev xvfb libxi-dev glew-dev
|
15 |
+
|
16 |
+
# For fonts, emojis etc
|
17 |
+
RUN apk add font-terminus font-noto font-noto-cjk font-noto-extra font-noto-emoji
|
18 |
+
RUN apk add font-arabic-misc font-inconsolata font-dejavu font-awesome
|
19 |
+
RUN apk add ttf-opensans
|
20 |
+
|
21 |
+
# For Puppeteer
|
22 |
+
RUN apk add build-base gcompat udev chromium
|
23 |
+
|
24 |
+
RUN apk add --no-cache ffmpeg
|
25 |
+
|
26 |
# Set up a new user named "user" with user ID 1000
|
27 |
RUN adduser --disabled-password --uid 1001 user
|
28 |
|
|
|
43 |
# make sure the .env is copied as well
|
44 |
COPY --chown=user .env /app
|
45 |
|
46 |
+
RUN ffmpeg -version
|
47 |
+
|
48 |
# Copy the current directory contents into the container at /app setting the owner to the user
|
49 |
COPY --chown=user . /app
|
50 |
|
51 |
RUN npm ci --force
|
52 |
|
53 |
+
# expose our secrets during the static build
|
54 |
+
# otherwise Upstash becomes unhappy
|
55 |
RUN npm run build
|
56 |
|
57 |
EXPOSE 3000
|
package-lock.json
CHANGED
@@ -58,6 +58,8 @@
|
|
58 |
"cmdk": "^0.2.1",
|
59 |
"eslint": "8.57.0",
|
60 |
"eslint-config-next": "14.1.0",
|
|
|
|
|
61 |
"lucide-react": "^0.334.0",
|
62 |
"mlt-xml": "^2.0.2",
|
63 |
"monaco-editor": "^0.49.0",
|
@@ -76,7 +78,7 @@
|
|
76 |
"react-hotkeys-hook": "^4.5.0",
|
77 |
"react-icons": "^5.2.1",
|
78 |
"react-reflex": "^4.2.6",
|
79 |
-
"replicate": "^0.30.
|
80 |
"sharp": "^0.33.4",
|
81 |
"sonner": "^1.4.41",
|
82 |
"tailwind-merge": "^2.3.0",
|
@@ -92,6 +94,9 @@
|
|
92 |
"yaml": "^2.4.2",
|
93 |
"zustand": "^4.5.2",
|
94 |
"zx": "^8.1.2"
|
|
|
|
|
|
|
95 |
}
|
96 |
},
|
97 |
"node_modules/@aitube/clap": {
|
@@ -1446,9 +1451,9 @@
|
|
1446 |
}
|
1447 |
},
|
1448 |
"node_modules/@next/env": {
|
1449 |
-
"version": "14.2.
|
1450 |
-
"resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.
|
1451 |
-
"integrity": "sha512-
|
1452 |
},
|
1453 |
"node_modules/@next/eslint-plugin-next": {
|
1454 |
"version": "14.1.0",
|
@@ -1459,9 +1464,9 @@
|
|
1459 |
}
|
1460 |
},
|
1461 |
"node_modules/@next/swc-darwin-arm64": {
|
1462 |
-
"version": "14.2.
|
1463 |
-
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.
|
1464 |
-
"integrity": "sha512-
|
1465 |
"cpu": [
|
1466 |
"arm64"
|
1467 |
],
|
@@ -1474,9 +1479,9 @@
|
|
1474 |
}
|
1475 |
},
|
1476 |
"node_modules/@next/swc-darwin-x64": {
|
1477 |
-
"version": "14.2.
|
1478 |
-
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.
|
1479 |
-
"integrity": "sha512-
|
1480 |
"cpu": [
|
1481 |
"x64"
|
1482 |
],
|
@@ -1489,9 +1494,9 @@
|
|
1489 |
}
|
1490 |
},
|
1491 |
"node_modules/@next/swc-linux-arm64-gnu": {
|
1492 |
-
"version": "14.2.
|
1493 |
-
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.
|
1494 |
-
"integrity": "sha512-
|
1495 |
"cpu": [
|
1496 |
"arm64"
|
1497 |
],
|
@@ -1504,9 +1509,9 @@
|
|
1504 |
}
|
1505 |
},
|
1506 |
"node_modules/@next/swc-linux-arm64-musl": {
|
1507 |
-
"version": "14.2.
|
1508 |
-
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.
|
1509 |
-
"integrity": "sha512-
|
1510 |
"cpu": [
|
1511 |
"arm64"
|
1512 |
],
|
@@ -1519,9 +1524,9 @@
|
|
1519 |
}
|
1520 |
},
|
1521 |
"node_modules/@next/swc-linux-x64-gnu": {
|
1522 |
-
"version": "14.2.
|
1523 |
-
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.
|
1524 |
-
"integrity": "sha512-
|
1525 |
"cpu": [
|
1526 |
"x64"
|
1527 |
],
|
@@ -1534,9 +1539,9 @@
|
|
1534 |
}
|
1535 |
},
|
1536 |
"node_modules/@next/swc-linux-x64-musl": {
|
1537 |
-
"version": "14.2.
|
1538 |
-
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.
|
1539 |
-
"integrity": "sha512-
|
1540 |
"cpu": [
|
1541 |
"x64"
|
1542 |
],
|
@@ -1549,9 +1554,9 @@
|
|
1549 |
}
|
1550 |
},
|
1551 |
"node_modules/@next/swc-win32-arm64-msvc": {
|
1552 |
-
"version": "14.2.
|
1553 |
-
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.
|
1554 |
-
"integrity": "sha512-
|
1555 |
"cpu": [
|
1556 |
"arm64"
|
1557 |
],
|
@@ -1564,9 +1569,9 @@
|
|
1564 |
}
|
1565 |
},
|
1566 |
"node_modules/@next/swc-win32-ia32-msvc": {
|
1567 |
-
"version": "14.2.
|
1568 |
-
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.
|
1569 |
-
"integrity": "sha512-
|
1570 |
"cpu": [
|
1571 |
"ia32"
|
1572 |
],
|
@@ -1579,9 +1584,9 @@
|
|
1579 |
}
|
1580 |
},
|
1581 |
"node_modules/@next/swc-win32-x64-msvc": {
|
1582 |
-
"version": "14.2.
|
1583 |
-
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.
|
1584 |
-
"integrity": "sha512-
|
1585 |
"cpu": [
|
1586 |
"x64"
|
1587 |
],
|
@@ -3122,6 +3127,15 @@
|
|
3122 |
"resolved": "https://registry.npmjs.org/@types/draco3d/-/draco3d-1.4.10.tgz",
|
3123 |
"integrity": "sha512-AX22jp8Y7wwaBgAixaSvkoG4M/+PlAcm3Qs4OW8yT9DM4xUpWKeFhLueTAyZF39pviAdcDdeJoACapiAceqNcw=="
|
3124 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3125 |
"node_modules/@types/fs-extra": {
|
3126 |
"version": "11.0.4",
|
3127 |
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz",
|
@@ -3694,6 +3708,11 @@
|
|
3694 |
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz",
|
3695 |
"integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ=="
|
3696 |
},
|
|
|
|
|
|
|
|
|
|
|
3697 |
"node_modules/asynckit": {
|
3698 |
"version": "0.4.0",
|
3699 |
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
@@ -4844,9 +4863,9 @@
|
|
4844 |
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
4845 |
},
|
4846 |
"node_modules/electron-to-chromium": {
|
4847 |
-
"version": "1.4.
|
4848 |
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
4849 |
-
"integrity": "sha512-
|
4850 |
},
|
4851 |
"node_modules/emoji-regex": {
|
4852 |
"version": "9.2.2",
|
@@ -5680,6 +5699,29 @@
|
|
5680 |
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
|
5681 |
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw=="
|
5682 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5683 |
"node_modules/for-each": {
|
5684 |
"version": "0.3.3",
|
5685 |
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
|
@@ -5753,6 +5795,19 @@
|
|
5753 |
"url": "https://github.com/sponsors/rawify"
|
5754 |
}
|
5755 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5756 |
"node_modules/fs.realpath": {
|
5757 |
"version": "1.0.0",
|
5758 |
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
@@ -6747,6 +6802,17 @@
|
|
6747 |
"node": ">=6"
|
6748 |
}
|
6749 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6750 |
"node_modules/jsx-ast-utils": {
|
6751 |
"version": "3.3.5",
|
6752 |
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz",
|
@@ -7156,11 +7222,11 @@
|
|
7156 |
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="
|
7157 |
},
|
7158 |
"node_modules/next": {
|
7159 |
-
"version": "14.2.
|
7160 |
-
"resolved": "https://registry.npmjs.org/next/-/next-14.2.
|
7161 |
-
"integrity": "sha512-
|
7162 |
"dependencies": {
|
7163 |
-
"@next/env": "14.2.
|
7164 |
"@swc/helpers": "0.5.5",
|
7165 |
"busboy": "1.6.0",
|
7166 |
"caniuse-lite": "^1.0.30001579",
|
@@ -7175,15 +7241,15 @@
|
|
7175 |
"node": ">=18.17.0"
|
7176 |
},
|
7177 |
"optionalDependencies": {
|
7178 |
-
"@next/swc-darwin-arm64": "14.2.
|
7179 |
-
"@next/swc-darwin-x64": "14.2.
|
7180 |
-
"@next/swc-linux-arm64-gnu": "14.2.
|
7181 |
-
"@next/swc-linux-arm64-musl": "14.2.
|
7182 |
-
"@next/swc-linux-x64-gnu": "14.2.
|
7183 |
-
"@next/swc-linux-x64-musl": "14.2.
|
7184 |
-
"@next/swc-win32-arm64-msvc": "14.2.
|
7185 |
-
"@next/swc-win32-ia32-msvc": "14.2.
|
7186 |
-
"@next/swc-win32-x64-msvc": "14.2.
|
7187 |
},
|
7188 |
"peerDependencies": {
|
7189 |
"@opentelemetry/api": "^1.1.0",
|
@@ -9648,6 +9714,14 @@
|
|
9648 |
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
9649 |
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
9650 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9651 |
"node_modules/update-browserslist-db": {
|
9652 |
"version": "1.0.16",
|
9653 |
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
|
|
|
58 |
"cmdk": "^0.2.1",
|
59 |
"eslint": "8.57.0",
|
60 |
"eslint-config-next": "14.1.0",
|
61 |
+
"fluent-ffmpeg": "^2.1.3",
|
62 |
+
"fs-extra": "^11.2.0",
|
63 |
"lucide-react": "^0.334.0",
|
64 |
"mlt-xml": "^2.0.2",
|
65 |
"monaco-editor": "^0.49.0",
|
|
|
78 |
"react-hotkeys-hook": "^4.5.0",
|
79 |
"react-icons": "^5.2.1",
|
80 |
"react-reflex": "^4.2.6",
|
81 |
+
"replicate": "^0.30.2",
|
82 |
"sharp": "^0.33.4",
|
83 |
"sonner": "^1.4.41",
|
84 |
"tailwind-merge": "^2.3.0",
|
|
|
94 |
"yaml": "^2.4.2",
|
95 |
"zustand": "^4.5.2",
|
96 |
"zx": "^8.1.2"
|
97 |
+
},
|
98 |
+
"devDependencies": {
|
99 |
+
"@types/fluent-ffmpeg": "^2.1.24"
|
100 |
}
|
101 |
},
|
102 |
"node_modules/@aitube/clap": {
|
|
|
1451 |
}
|
1452 |
},
|
1453 |
"node_modules/@next/env": {
|
1454 |
+
"version": "14.2.4",
|
1455 |
+
"resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.4.tgz",
|
1456 |
+
"integrity": "sha512-3EtkY5VDkuV2+lNmKlbkibIJxcO4oIHEhBWne6PaAp+76J9KoSsGvNikp6ivzAT8dhhBMYrm6op2pS1ApG0Hzg=="
|
1457 |
},
|
1458 |
"node_modules/@next/eslint-plugin-next": {
|
1459 |
"version": "14.1.0",
|
|
|
1464 |
}
|
1465 |
},
|
1466 |
"node_modules/@next/swc-darwin-arm64": {
|
1467 |
+
"version": "14.2.4",
|
1468 |
+
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.4.tgz",
|
1469 |
+
"integrity": "sha512-AH3mO4JlFUqsYcwFUHb1wAKlebHU/Hv2u2kb1pAuRanDZ7pD/A/KPD98RHZmwsJpdHQwfEc/06mgpSzwrJYnNg==",
|
1470 |
"cpu": [
|
1471 |
"arm64"
|
1472 |
],
|
|
|
1479 |
}
|
1480 |
},
|
1481 |
"node_modules/@next/swc-darwin-x64": {
|
1482 |
+
"version": "14.2.4",
|
1483 |
+
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.4.tgz",
|
1484 |
+
"integrity": "sha512-QVadW73sWIO6E2VroyUjuAxhWLZWEpiFqHdZdoQ/AMpN9YWGuHV8t2rChr0ahy+irKX5mlDU7OY68k3n4tAZTg==",
|
1485 |
"cpu": [
|
1486 |
"x64"
|
1487 |
],
|
|
|
1494 |
}
|
1495 |
},
|
1496 |
"node_modules/@next/swc-linux-arm64-gnu": {
|
1497 |
+
"version": "14.2.4",
|
1498 |
+
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.4.tgz",
|
1499 |
+
"integrity": "sha512-KT6GUrb3oyCfcfJ+WliXuJnD6pCpZiosx2X3k66HLR+DMoilRb76LpWPGb4tZprawTtcnyrv75ElD6VncVamUQ==",
|
1500 |
"cpu": [
|
1501 |
"arm64"
|
1502 |
],
|
|
|
1509 |
}
|
1510 |
},
|
1511 |
"node_modules/@next/swc-linux-arm64-musl": {
|
1512 |
+
"version": "14.2.4",
|
1513 |
+
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.4.tgz",
|
1514 |
+
"integrity": "sha512-Alv8/XGSs/ytwQcbCHwze1HmiIkIVhDHYLjczSVrf0Wi2MvKn/blt7+S6FJitj3yTlMwMxII1gIJ9WepI4aZ/A==",
|
1515 |
"cpu": [
|
1516 |
"arm64"
|
1517 |
],
|
|
|
1524 |
}
|
1525 |
},
|
1526 |
"node_modules/@next/swc-linux-x64-gnu": {
|
1527 |
+
"version": "14.2.4",
|
1528 |
+
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.4.tgz",
|
1529 |
+
"integrity": "sha512-ze0ShQDBPCqxLImzw4sCdfnB3lRmN3qGMB2GWDRlq5Wqy4G36pxtNOo2usu/Nm9+V2Rh/QQnrRc2l94kYFXO6Q==",
|
1530 |
"cpu": [
|
1531 |
"x64"
|
1532 |
],
|
|
|
1539 |
}
|
1540 |
},
|
1541 |
"node_modules/@next/swc-linux-x64-musl": {
|
1542 |
+
"version": "14.2.4",
|
1543 |
+
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.4.tgz",
|
1544 |
+
"integrity": "sha512-8dwC0UJoc6fC7PX70csdaznVMNr16hQrTDAMPvLPloazlcaWfdPogq+UpZX6Drqb1OBlwowz8iG7WR0Tzk/diQ==",
|
1545 |
"cpu": [
|
1546 |
"x64"
|
1547 |
],
|
|
|
1554 |
}
|
1555 |
},
|
1556 |
"node_modules/@next/swc-win32-arm64-msvc": {
|
1557 |
+
"version": "14.2.4",
|
1558 |
+
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.4.tgz",
|
1559 |
+
"integrity": "sha512-jxyg67NbEWkDyvM+O8UDbPAyYRZqGLQDTPwvrBBeOSyVWW/jFQkQKQ70JDqDSYg1ZDdl+E3nkbFbq8xM8E9x8A==",
|
1560 |
"cpu": [
|
1561 |
"arm64"
|
1562 |
],
|
|
|
1569 |
}
|
1570 |
},
|
1571 |
"node_modules/@next/swc-win32-ia32-msvc": {
|
1572 |
+
"version": "14.2.4",
|
1573 |
+
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.4.tgz",
|
1574 |
+
"integrity": "sha512-twrmN753hjXRdcrZmZttb/m5xaCBFa48Dt3FbeEItpJArxriYDunWxJn+QFXdJ3hPkm4u7CKxncVvnmgQMY1ag==",
|
1575 |
"cpu": [
|
1576 |
"ia32"
|
1577 |
],
|
|
|
1584 |
}
|
1585 |
},
|
1586 |
"node_modules/@next/swc-win32-x64-msvc": {
|
1587 |
+
"version": "14.2.4",
|
1588 |
+
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.4.tgz",
|
1589 |
+
"integrity": "sha512-tkLrjBzqFTP8DVrAAQmZelEahfR9OxWpFR++vAI9FBhCiIxtwHwBHC23SBHCTURBtwB4kc/x44imVOnkKGNVGg==",
|
1590 |
"cpu": [
|
1591 |
"x64"
|
1592 |
],
|
|
|
3127 |
"resolved": "https://registry.npmjs.org/@types/draco3d/-/draco3d-1.4.10.tgz",
|
3128 |
"integrity": "sha512-AX22jp8Y7wwaBgAixaSvkoG4M/+PlAcm3Qs4OW8yT9DM4xUpWKeFhLueTAyZF39pviAdcDdeJoACapiAceqNcw=="
|
3129 |
},
|
3130 |
+
"node_modules/@types/fluent-ffmpeg": {
|
3131 |
+
"version": "2.1.24",
|
3132 |
+
"resolved": "https://registry.npmjs.org/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.24.tgz",
|
3133 |
+
"integrity": "sha512-g5oQO8Jgi2kFS3tTub7wLvfLztr1s8tdXmRd8PiL/hLMLzTIAyMR2sANkTggM/rdEDAg3d63nYRRVepwBiCw5A==",
|
3134 |
+
"dev": true,
|
3135 |
+
"dependencies": {
|
3136 |
+
"@types/node": "*"
|
3137 |
+
}
|
3138 |
+
},
|
3139 |
"node_modules/@types/fs-extra": {
|
3140 |
"version": "11.0.4",
|
3141 |
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz",
|
|
|
3708 |
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz",
|
3709 |
"integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ=="
|
3710 |
},
|
3711 |
+
"node_modules/async": {
|
3712 |
+
"version": "0.2.10",
|
3713 |
+
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
|
3714 |
+
"integrity": "sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ=="
|
3715 |
+
},
|
3716 |
"node_modules/asynckit": {
|
3717 |
"version": "0.4.0",
|
3718 |
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
|
4863 |
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
4864 |
},
|
4865 |
"node_modules/electron-to-chromium": {
|
4866 |
+
"version": "1.4.799",
|
4867 |
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.799.tgz",
|
4868 |
+
"integrity": "sha512-3D3DwWkRTzrdEpntY0hMLYwj7SeBk1138CkPE8sBDSj3WzrzOiG2rHm3luw8jucpf+WiyLBCZyU9lMHyQI9M9Q=="
|
4869 |
},
|
4870 |
"node_modules/emoji-regex": {
|
4871 |
"version": "9.2.2",
|
|
|
5699 |
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
|
5700 |
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw=="
|
5701 |
},
|
5702 |
+
"node_modules/fluent-ffmpeg": {
|
5703 |
+
"version": "2.1.3",
|
5704 |
+
"resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.3.tgz",
|
5705 |
+
"integrity": "sha512-Be3narBNt2s6bsaqP6Jzq91heDgOEaDCJAXcE3qcma/EJBSy5FB4cvO31XBInuAuKBx8Kptf8dkhjK0IOru39Q==",
|
5706 |
+
"dependencies": {
|
5707 |
+
"async": "^0.2.9",
|
5708 |
+
"which": "^1.1.1"
|
5709 |
+
},
|
5710 |
+
"engines": {
|
5711 |
+
"node": ">=18"
|
5712 |
+
}
|
5713 |
+
},
|
5714 |
+
"node_modules/fluent-ffmpeg/node_modules/which": {
|
5715 |
+
"version": "1.3.1",
|
5716 |
+
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
5717 |
+
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
|
5718 |
+
"dependencies": {
|
5719 |
+
"isexe": "^2.0.0"
|
5720 |
+
},
|
5721 |
+
"bin": {
|
5722 |
+
"which": "bin/which"
|
5723 |
+
}
|
5724 |
+
},
|
5725 |
"node_modules/for-each": {
|
5726 |
"version": "0.3.3",
|
5727 |
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
|
|
|
5795 |
"url": "https://github.com/sponsors/rawify"
|
5796 |
}
|
5797 |
},
|
5798 |
+
"node_modules/fs-extra": {
|
5799 |
+
"version": "11.2.0",
|
5800 |
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
|
5801 |
+
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
|
5802 |
+
"dependencies": {
|
5803 |
+
"graceful-fs": "^4.2.0",
|
5804 |
+
"jsonfile": "^6.0.1",
|
5805 |
+
"universalify": "^2.0.0"
|
5806 |
+
},
|
5807 |
+
"engines": {
|
5808 |
+
"node": ">=14.14"
|
5809 |
+
}
|
5810 |
+
},
|
5811 |
"node_modules/fs.realpath": {
|
5812 |
"version": "1.0.0",
|
5813 |
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
|
|
6802 |
"node": ">=6"
|
6803 |
}
|
6804 |
},
|
6805 |
+
"node_modules/jsonfile": {
|
6806 |
+
"version": "6.1.0",
|
6807 |
+
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
6808 |
+
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
6809 |
+
"dependencies": {
|
6810 |
+
"universalify": "^2.0.0"
|
6811 |
+
},
|
6812 |
+
"optionalDependencies": {
|
6813 |
+
"graceful-fs": "^4.1.6"
|
6814 |
+
}
|
6815 |
+
},
|
6816 |
"node_modules/jsx-ast-utils": {
|
6817 |
"version": "3.3.5",
|
6818 |
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz",
|
|
|
7222 |
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="
|
7223 |
},
|
7224 |
"node_modules/next": {
|
7225 |
+
"version": "14.2.4",
|
7226 |
+
"resolved": "https://registry.npmjs.org/next/-/next-14.2.4.tgz",
|
7227 |
+
"integrity": "sha512-R8/V7vugY+822rsQGQCjoLhMuC9oFj9SOi4Cl4b2wjDrseD0LRZ10W7R6Czo4w9ZznVSshKjuIomsRjvm9EKJQ==",
|
7228 |
"dependencies": {
|
7229 |
+
"@next/env": "14.2.4",
|
7230 |
"@swc/helpers": "0.5.5",
|
7231 |
"busboy": "1.6.0",
|
7232 |
"caniuse-lite": "^1.0.30001579",
|
|
|
7241 |
"node": ">=18.17.0"
|
7242 |
},
|
7243 |
"optionalDependencies": {
|
7244 |
+
"@next/swc-darwin-arm64": "14.2.4",
|
7245 |
+
"@next/swc-darwin-x64": "14.2.4",
|
7246 |
+
"@next/swc-linux-arm64-gnu": "14.2.4",
|
7247 |
+
"@next/swc-linux-arm64-musl": "14.2.4",
|
7248 |
+
"@next/swc-linux-x64-gnu": "14.2.4",
|
7249 |
+
"@next/swc-linux-x64-musl": "14.2.4",
|
7250 |
+
"@next/swc-win32-arm64-msvc": "14.2.4",
|
7251 |
+
"@next/swc-win32-ia32-msvc": "14.2.4",
|
7252 |
+
"@next/swc-win32-x64-msvc": "14.2.4"
|
7253 |
},
|
7254 |
"peerDependencies": {
|
7255 |
"@opentelemetry/api": "^1.1.0",
|
|
|
9714 |
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
9715 |
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
9716 |
},
|
9717 |
+
"node_modules/universalify": {
|
9718 |
+
"version": "2.0.1",
|
9719 |
+
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
9720 |
+
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
|
9721 |
+
"engines": {
|
9722 |
+
"node": ">= 10.0.0"
|
9723 |
+
}
|
9724 |
+
},
|
9725 |
"node_modules/update-browserslist-db": {
|
9726 |
"version": "1.0.16",
|
9727 |
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
|
package.json
CHANGED
@@ -60,6 +60,8 @@
|
|
60 |
"cmdk": "^0.2.1",
|
61 |
"eslint": "8.57.0",
|
62 |
"eslint-config-next": "14.1.0",
|
|
|
|
|
63 |
"lucide-react": "^0.334.0",
|
64 |
"mlt-xml": "^2.0.2",
|
65 |
"monaco-editor": "^0.49.0",
|
@@ -78,7 +80,7 @@
|
|
78 |
"react-hotkeys-hook": "^4.5.0",
|
79 |
"react-icons": "^5.2.1",
|
80 |
"react-reflex": "^4.2.6",
|
81 |
-
"replicate": "^0.30.
|
82 |
"sharp": "^0.33.4",
|
83 |
"sonner": "^1.4.41",
|
84 |
"tailwind-merge": "^2.3.0",
|
@@ -94,5 +96,8 @@
|
|
94 |
"yaml": "^2.4.2",
|
95 |
"zustand": "^4.5.2",
|
96 |
"zx": "^8.1.2"
|
|
|
|
|
|
|
97 |
}
|
98 |
}
|
|
|
60 |
"cmdk": "^0.2.1",
|
61 |
"eslint": "8.57.0",
|
62 |
"eslint-config-next": "14.1.0",
|
63 |
+
"fluent-ffmpeg": "^2.1.3",
|
64 |
+
"fs-extra": "^11.2.0",
|
65 |
"lucide-react": "^0.334.0",
|
66 |
"mlt-xml": "^2.0.2",
|
67 |
"monaco-editor": "^0.49.0",
|
|
|
80 |
"react-hotkeys-hook": "^4.5.0",
|
81 |
"react-icons": "^5.2.1",
|
82 |
"react-reflex": "^4.2.6",
|
83 |
+
"replicate": "^0.30.2",
|
84 |
"sharp": "^0.33.4",
|
85 |
"sonner": "^1.4.41",
|
86 |
"tailwind-merge": "^2.3.0",
|
|
|
96 |
"yaml": "^2.4.2",
|
97 |
"zustand": "^4.5.2",
|
98 |
"zx": "^8.1.2"
|
99 |
+
},
|
100 |
+
"devDependencies": {
|
101 |
+
"@types/fluent-ffmpeg": "^2.1.24"
|
102 |
}
|
103 |
}
|
src/app/api/resolve/providers/falai/index.ts
CHANGED
@@ -131,7 +131,7 @@ export async function resolveSegment(request: ResolveRequest): Promise<ClapSegme
|
|
131 |
) {
|
132 |
const result = await fal.run(request.settings.falAiModelForSound, {
|
133 |
input: {
|
134 |
-
// note how we use the *segment* prompt for music
|
135 |
prompt: request.segment.prompt,
|
136 |
|
137 |
sync_mode: true,
|
@@ -139,7 +139,7 @@ export async function resolveSegment(request: ResolveRequest): Promise<ClapSegme
|
|
139 |
},
|
140 |
}) as FalAiAudioResponse
|
141 |
|
142 |
-
content = result?.audio_file?.url
|
143 |
} else if (
|
144 |
request.segment.category === ClapSegmentCategory.DIALOGUE
|
145 |
) {
|
|
|
131 |
) {
|
132 |
const result = await fal.run(request.settings.falAiModelForSound, {
|
133 |
input: {
|
134 |
+
// note how we use the *segment* prompt for music or sound
|
135 |
prompt: request.segment.prompt,
|
136 |
|
137 |
sync_mode: true,
|
|
|
139 |
},
|
140 |
}) as FalAiAudioResponse
|
141 |
|
142 |
+
content = await decodeOutput(result?.audio_file?.url)
|
143 |
} else if (
|
144 |
request.segment.category === ClapSegmentCategory.DIALOGUE
|
145 |
) {
|
src/app/api/resolve/providers/replicate/index.ts
CHANGED
@@ -2,8 +2,6 @@ import Replicate from 'replicate'
|
|
2 |
|
3 |
import { ResolveRequest } from "@/types"
|
4 |
import { ClapSegment, ClapSegmentCategory, ClapSegmentStatus, getClapAssetSourceType } from "@aitube/clap"
|
5 |
-
import { getVideoPrompt } from "@aitube/engine"
|
6 |
-
import { fetchContentToBase64 } from '@/lib/utils/fetchContentToBase64'
|
7 |
import { getResolveRequestPrompts } from '@/lib/utils/getResolveRequestPrompts'
|
8 |
import { decodeOutput } from '@/lib/utils/decodeOutput'
|
9 |
|
|
|
2 |
|
3 |
import { ResolveRequest } from "@/types"
|
4 |
import { ClapSegment, ClapSegmentCategory, ClapSegmentStatus, getClapAssetSourceType } from "@aitube/clap"
|
|
|
|
|
5 |
import { getResolveRequestPrompts } from '@/lib/utils/getResolveRequestPrompts'
|
6 |
import { decodeOutput } from '@/lib/utils/decodeOutput'
|
7 |
|
src/components/monitor/DynamicPlayer/index.tsx
CHANGED
@@ -33,14 +33,6 @@ export const DynamicPlayer = ({
|
|
33 |
upcomingStoryboardSegment
|
34 |
} = useRenderer(s => s.bufferedSegments)
|
35 |
|
36 |
-
console.log(`DynamicPlayer:`, {
|
37 |
-
activeVideoSegment,
|
38 |
-
upcomingVideoSegment,
|
39 |
-
activeStoryboardSegment,
|
40 |
-
upcomingStoryboardSegment
|
41 |
-
})
|
42 |
-
|
43 |
-
|
44 |
const currentSegment =
|
45 |
activeVideoSegment?.assetUrl
|
46 |
? activeVideoSegment
|
@@ -123,10 +115,10 @@ export const DynamicPlayer = ({
|
|
123 |
return () => {
|
124 |
clearTimeout(timeoutRef.current)
|
125 |
}
|
126 |
-
}, [
|
127 |
-
|
128 |
-
|
129 |
-
])
|
130 |
|
131 |
return (
|
132 |
<div className={cn(`@container flex flex-col items-center flex-grow w-full`, className)}>
|
|
|
33 |
upcomingStoryboardSegment
|
34 |
} = useRenderer(s => s.bufferedSegments)
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
const currentSegment =
|
37 |
activeVideoSegment?.assetUrl
|
38 |
? activeVideoSegment
|
|
|
115 |
return () => {
|
116 |
clearTimeout(timeoutRef.current)
|
117 |
}
|
118 |
+
}, [
|
119 |
+
currentSegmentKey,
|
120 |
+
preloadSegmentKey
|
121 |
+
])
|
122 |
|
123 |
return (
|
124 |
<div className={cn(`@container flex flex-col items-center flex-grow w-full`, className)}>
|
src/lib/core/constants.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
export const HARD_LIMIT_NB_MAX_ASSETS_TO_GENERATE_IN_PARALLEL = 32
|
5 |
|
6 |
export const APP_NAME = "Clapper AI"
|
7 |
-
export const APP_REVISION = "
|
8 |
|
9 |
export const APP_DOMAIN = "Clapper.app"
|
10 |
export const APP_LINK = "https://clapper.app"
|
|
|
4 |
export const HARD_LIMIT_NB_MAX_ASSETS_TO_GENERATE_IN_PARALLEL = 32
|
5 |
|
6 |
export const APP_NAME = "Clapper AI"
|
7 |
+
export const APP_REVISION = "r20240612-0135"
|
8 |
|
9 |
export const APP_DOMAIN = "Clapper.app"
|
10 |
export const APP_LINK = "https://clapper.app"
|
src/lib/ffmpeg/convertAudioToMp3.ts
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ffmpeg from 'fluent-ffmpeg';
|
2 |
+
import * as fs from 'fs';
|
3 |
+
import * as path from 'path';
|
4 |
+
import * as crypto from 'crypto';
|
5 |
+
|
6 |
+
// Define a map from media type to file extension
|
7 |
+
const EXTENSIONS: { [type: string]: string } = {
|
8 |
+
'audio/x-wav': 'wav',
|
9 |
+
'audio/wav': 'wav',
|
10 |
+
'audio/mp3': 'mp3',
|
11 |
+
'audio/mpeg': 'mp3',
|
12 |
+
'audio/webm': 'webm',
|
13 |
+
// add more if needed
|
14 |
+
};
|
15 |
+
|
16 |
+
export async function convertAudioToMp3(dataUri: string): Promise<string> {
|
17 |
+
const match = dataUri.match(/^data:(.*?);base64,(.*)$/);
|
18 |
+
if (!match) throw new Error('Invalid data URI');
|
19 |
+
|
20 |
+
const mediaType = match[1];
|
21 |
+
const base64Audio = match[2];
|
22 |
+
|
23 |
+
const format = EXTENSIONS[mediaType];
|
24 |
+
if (!format) throw new Error('Unsupported media type: ' + mediaType);
|
25 |
+
|
26 |
+
if (format === 'mp3') return dataUri; // If it's already a mp3, then do nothing
|
27 |
+
|
28 |
+
const randomName = crypto.randomBytes(15).toString('hex');
|
29 |
+
const inputPath = path.join(__dirname, `${randomName}.${format}`);
|
30 |
+
const outputPath = path.join(__dirname, `${randomName}.mp3`);
|
31 |
+
|
32 |
+
// Decode base64 and write to an audio file
|
33 |
+
const audioBuffer = Buffer.from(base64Audio, 'base64');
|
34 |
+
await fs.promises.writeFile(inputPath, audioBuffer);
|
35 |
+
|
36 |
+
return new Promise<string>((resolve, reject) => {
|
37 |
+
ffmpeg(inputPath)
|
38 |
+
.output(outputPath)
|
39 |
+
.on('end', async () => {
|
40 |
+
const mp3File = await fs.promises.readFile(outputPath);
|
41 |
+
await fs.promises.unlink(inputPath);
|
42 |
+
await fs.promises.unlink(outputPath);
|
43 |
+
resolve('data:audio/mp3;base64,' + mp3File.toString('base64'));
|
44 |
+
})
|
45 |
+
.on('error', async (err) => {
|
46 |
+
await fs.promises.unlink(inputPath);
|
47 |
+
reject(err);
|
48 |
+
}).run();
|
49 |
+
});
|
50 |
+
}
|
src/lib/utils/decodeOutput.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import { fetchContentToBase64 } from "./fetchContentToBase64"
|
2 |
import { convertToJpeg } from "./convertToJpeg"
|
3 |
|
@@ -19,9 +21,16 @@ export async function decodeOutput(input: any): Promise<string> {
|
|
19 |
//
|
20 |
// if you really want to have a pro, Hollywood-grade storyboard storage,
|
21 |
// this isn't impossible but then you need to use either file paths or remote URL paths
|
|
|
22 |
const jpegImageAsBase64 = await convertToJpeg(base64Url)
|
23 |
|
24 |
return jpegImageAsBase64
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
return base64Url
|
|
|
1 |
+
import { convertAudioToMp3 } from '@/lib/ffmpeg/convertAudioToMp3'
|
2 |
+
|
3 |
import { fetchContentToBase64 } from "./fetchContentToBase64"
|
4 |
import { convertToJpeg } from "./convertToJpeg"
|
5 |
|
|
|
21 |
//
|
22 |
// if you really want to have a pro, Hollywood-grade storyboard storage,
|
23 |
// this isn't impossible but then you need to use either file paths or remote URL paths
|
24 |
+
// and if you want some lossless like this, we should add a parameter to support that
|
25 |
const jpegImageAsBase64 = await convertToJpeg(base64Url)
|
26 |
|
27 |
return jpegImageAsBase64
|
28 |
+
} else if (base64Url.startsWith("data:audio/wav") || base64Url.startsWith("data:audio/x-wav")) {
|
29 |
+
// same logic as for images here: we convert to a more compact format
|
30 |
+
// and if you want some lossless, we should add a parameter to support that
|
31 |
+
const mp4AudioAsBase64 = await convertAudioToMp3(base64Url)
|
32 |
+
|
33 |
+
return mp4AudioAsBase64
|
34 |
}
|
35 |
|
36 |
return base64Url
|