Spaces:
Running
Running
Commit ·
1bc35d7
1
Parent(s): f5ebff9
Nope ! Not working
Browse files- Dockerfile +13 -0
- server-plugins/frames.js +3 -0
- server-plugins/split-render.js +39 -12
Dockerfile
CHANGED
|
@@ -9,8 +9,21 @@ RUN apt-get update && \
|
|
| 9 |
wget curl procps \
|
| 10 |
htop vim nano \
|
| 11 |
xvfb x11-utils \
|
|
|
|
| 12 |
rm -rf /var/lib/apt/lists/*
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Install nginx
|
| 15 |
RUN apt-get update && apt-get install -y nginx wget && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 16 |
|
|
|
|
| 9 |
wget curl procps \
|
| 10 |
htop vim nano \
|
| 11 |
xvfb x11-utils \
|
| 12 |
+
xz-utils && \
|
| 13 |
rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# Install FFmpeg 8 from static build
|
| 16 |
+
RUN wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \
|
| 17 |
+
tar -xf ffmpeg-release-amd64-static.tar.xz && \
|
| 18 |
+
mv ffmpeg-*-amd64-static/ffmpeg /usr/local/bin/ffmpeg && \
|
| 19 |
+
mv ffmpeg-*-amd64-static/ffprobe /usr/local/bin/ffprobe && \
|
| 20 |
+
chmod +x /usr/local/bin/ffmpeg /usr/local/bin/ffprobe && \
|
| 21 |
+
rm -rf ffmpeg-* && \
|
| 22 |
+
ln -sf /usr/local/bin/ffmpeg /usr/bin/ffmpeg && \
|
| 23 |
+
ln -sf /usr/local/bin/ffprobe /usr/bin/ffprobe && \
|
| 24 |
+
ffmpeg -version
|
| 25 |
+
|
| 26 |
+
|
| 27 |
# Install nginx
|
| 28 |
RUN apt-get update && apt-get install -y nginx wget && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 29 |
|
server-plugins/frames.js
CHANGED
|
@@ -7,6 +7,9 @@ export class FramesPlugin extends Plugin {
|
|
| 7 |
super(name, options);
|
| 8 |
}
|
| 9 |
async applyPrerender(originalManuscript, jobId) {
|
|
|
|
|
|
|
|
|
|
| 10 |
_.set(originalManuscript, 'meta.generationConfig.extras.additionalBuildParams',
|
| 11 |
`--frames=${this.options.startFrame}-${this.options.endFrame}`);
|
| 12 |
}
|
|
|
|
| 7 |
super(name, options);
|
| 8 |
}
|
| 9 |
async applyPrerender(originalManuscript, jobId) {
|
| 10 |
+
if (!this.options.startFrame || !this.options.endFrame) {
|
| 11 |
+
return
|
| 12 |
+
}
|
| 13 |
_.set(originalManuscript, 'meta.generationConfig.extras.additionalBuildParams',
|
| 14 |
`--frames=${this.options.startFrame}-${this.options.endFrame}`);
|
| 15 |
}
|
server-plugins/split-render.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import _ from 'lodash'
|
| 2 |
import fs from 'fs'
|
| 3 |
import { Plugin } from './plugin.js';
|
| 4 |
-
import { exec } from 'child_process'
|
| 5 |
import _path from 'path';
|
| 6 |
import { PerformanceRecorder } from 'common-utils';
|
| 7 |
|
|
@@ -74,26 +74,53 @@ export class SplitRenderPlugin extends Plugin {
|
|
| 74 |
// Create filter complex for overlay with transparency
|
| 75 |
const filterComplex = `[${frontVideoIndex}:v]colorkey=0x000000:0.08:0.02[fg];[${backVideoIndex}:v][fg]overlay=0:0:format=auto`;
|
| 76 |
|
| 77 |
-
// Build
|
| 78 |
-
const
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
console.error('[SplitRenderPlugin] FFmpeg failed:', fullErrorLog);
|
| 85 |
reject(new Error(fullErrorLog));
|
| 86 |
return;
|
| 87 |
}
|
|
|
|
| 88 |
fs.unlinkSync(outFile);
|
| 89 |
-
console.log('[SplitRenderPlugin] [FFmpeg stdout]:', stdout);
|
| 90 |
console.log('[SplitRenderPlugin] Removed initial render file:', outFile);
|
| 91 |
console.log('[SplitRenderPlugin] FFmpeg process completed successfully, took ', perf.elapsedString());
|
| 92 |
console.log('[SplitRenderPlugin] Final output file:', finalOutFile);
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
| 97 |
});
|
| 98 |
} else {
|
| 99 |
resolve('No input files to process. Skipping split-render post process');
|
|
|
|
| 1 |
import _ from 'lodash'
|
| 2 |
import fs from 'fs'
|
| 3 |
import { Plugin } from './plugin.js';
|
| 4 |
+
import { exec, spawn } from 'child_process'
|
| 5 |
import _path from 'path';
|
| 6 |
import { PerformanceRecorder } from 'common-utils';
|
| 7 |
|
|
|
|
| 74 |
// Create filter complex for overlay with transparency
|
| 75 |
const filterComplex = `[${frontVideoIndex}:v]colorkey=0x000000:0.08:0.02[fg];[${backVideoIndex}:v][fg]overlay=0:0:format=auto`;
|
| 76 |
|
| 77 |
+
// Build ffmpeg arguments array
|
| 78 |
+
const ffmpegArgs = [
|
| 79 |
+
...inputPart.split(' ').filter(arg => arg !== ''),
|
| 80 |
+
'-filter_complex', filterComplex,
|
| 81 |
+
'-c:v', 'libx264',
|
| 82 |
+
'-pix_fmt', 'yuv420p',
|
| 83 |
+
'-y', finalOutFile
|
| 84 |
+
];
|
| 85 |
|
| 86 |
+
console.log('[SplitRenderPlugin] Running ffmpeg with args:', ffmpegArgs);
|
| 87 |
+
|
| 88 |
+
const ffmpegProcess = spawn('ffmpeg', ffmpegArgs);
|
| 89 |
+
let stdout = '';
|
| 90 |
+
let stderr = '';
|
| 91 |
+
|
| 92 |
+
// Real-time stdout logging
|
| 93 |
+
ffmpegProcess.stdout.on('data', (data) => {
|
| 94 |
+
const output = data.toString();
|
| 95 |
+
stdout += output;
|
| 96 |
+
console.log('[SplitRenderPlugin] [FFmpeg STDOUT]:', output.trim());
|
| 97 |
+
});
|
| 98 |
+
|
| 99 |
+
// Real-time stderr logging (FFmpeg progress info usually goes to stderr)
|
| 100 |
+
ffmpegProcess.stderr.on('data', (data) => {
|
| 101 |
+
const output = data.toString();
|
| 102 |
+
stderr += output;
|
| 103 |
+
console.log('[SplitRenderPlugin] [FFmpeg STDERR]:', output.trim());
|
| 104 |
+
});
|
| 105 |
+
|
| 106 |
+
ffmpegProcess.on('close', (code) => {
|
| 107 |
+
if (code !== 0) {
|
| 108 |
+
const fullErrorLog = `FFmpeg process failed with code ${code}\n\nSTDOUT:\n${stdout}\n\nSTDERR:\n${stderr}`;
|
| 109 |
console.error('[SplitRenderPlugin] FFmpeg failed:', fullErrorLog);
|
| 110 |
reject(new Error(fullErrorLog));
|
| 111 |
return;
|
| 112 |
}
|
| 113 |
+
|
| 114 |
fs.unlinkSync(outFile);
|
|
|
|
| 115 |
console.log('[SplitRenderPlugin] Removed initial render file:', outFile);
|
| 116 |
console.log('[SplitRenderPlugin] FFmpeg process completed successfully, took ', perf.elapsedString());
|
| 117 |
console.log('[SplitRenderPlugin] Final output file:', finalOutFile);
|
| 118 |
+
resolve('FFmpeg completed successfully');
|
| 119 |
+
});
|
| 120 |
+
|
| 121 |
+
ffmpegProcess.on('error', (error) => {
|
| 122 |
+
console.error('[SplitRenderPlugin] FFmpeg spawn error:', error);
|
| 123 |
+
reject(error);
|
| 124 |
});
|
| 125 |
} else {
|
| 126 |
resolve('No input files to process. Skipping split-render post process');
|