Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
105d641
1
Parent(s):
31f8aca
fallback to the boring, non-GL version
Browse files- Dockerfile +4 -4
- src/production/assembleShots.mts +3 -1
- src/production/concatNoGL.mts +33 -0
Dockerfile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
FROM node:18
|
| 2 |
-
|
| 3 |
|
| 4 |
ARG DEBIAN_FRONTEND=noninteractive
|
| 5 |
|
|
@@ -36,6 +36,6 @@ COPY --chown=user . $HOME/app
|
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
CMD [ "xvfb-run", "-s", "-ac -screen 0 1920x1080x24", "npm", "run", "start" ]
|
| 41 |
-
|
|
|
|
| 1 |
FROM node:18
|
| 2 |
+
# try this maybe
|
| 3 |
|
| 4 |
ARG DEBIAN_FRONTEND=noninteractive
|
| 5 |
|
|
|
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
+
# we can't use this (it time out)
|
| 40 |
+
# CMD [ "xvfb-run", "-s", "-ac -screen 0 1920x1080x24", "npm", "run", "start" ]
|
| 41 |
+
CMD [ "npm", "run", "start" ]
|
src/production/assembleShots.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import path from "node:path"
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
|
| 5 |
import { VideoShot } from '../types.mts'
|
| 6 |
import { pendingFilesDirFilePath } from "../config.mts"
|
|
|
|
| 1 |
import path from "node:path"
|
| 2 |
|
| 3 |
+
// due to Docker issues, we disable OpenGL transitions for now
|
| 4 |
+
// import concat from 'ffmpeg-concat'
|
| 5 |
+
import concat from './concatNoGL.mts'
|
| 6 |
|
| 7 |
import { VideoShot } from '../types.mts'
|
| 8 |
import { pendingFilesDirFilePath } from "../config.mts"
|
src/production/concatNoGL.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ffmpeg from "fluent-ffmpeg";
|
| 2 |
+
import fs from "fs";
|
| 3 |
+
|
| 4 |
+
interface IConcatParams {
|
| 5 |
+
output: string;
|
| 6 |
+
videos: string[];
|
| 7 |
+
transitions: any;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const concat = async ({ output, videos }: IConcatParams): Promise<void> => {
|
| 11 |
+
if(!output || !Array.isArray(videos)) {
|
| 12 |
+
throw new Error("An output file and videos must be provided");
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
if(!videos.every(video => fs.existsSync(video))) {
|
| 16 |
+
throw new Error("All videos must exist");
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
const ffmpegCommand = ffmpeg();
|
| 20 |
+
|
| 21 |
+
videos.forEach((video) =>
|
| 22 |
+
ffmpegCommand.addInput(video)
|
| 23 |
+
);
|
| 24 |
+
|
| 25 |
+
return new Promise<void>((resolve, reject) => {
|
| 26 |
+
ffmpegCommand
|
| 27 |
+
.on('error', reject)
|
| 28 |
+
.on('end', resolve)
|
| 29 |
+
.mergeToFile(output);
|
| 30 |
+
});
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
export default concat;
|