shiveshnavin commited on
Commit
3903eb1
·
1 Parent(s): 2e506e8

Fix dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. proxy-renderer.js +29 -10
Dockerfile CHANGED
@@ -37,7 +37,7 @@ RUN npm run bundle || true
37
  RUN npm run skip-font-warn || true
38
 
39
  # Copy nginx config and start script
40
- COPY --chown=1000nginx.conf /etc/nginx/nginx.conf
41
  COPY --chown=1000 start.sh /app/start.sh
42
  RUN chmod +x /app/start.sh
43
 
 
37
  RUN npm run skip-font-warn || true
38
 
39
  # Copy nginx config and start script
40
+ COPY --chown=1000 nginx.conf /etc/nginx/nginx.conf
41
  COPY --chown=1000 start.sh /app/start.sh
42
  RUN chmod +x /app/start.sh
43
 
proxy-renderer.js CHANGED
@@ -4,7 +4,7 @@ import path from 'path';
4
  import fs from 'fs';
5
  import axios from 'axios';
6
  import os from 'os'
7
- import { exec } from 'child_process';
8
  const { RenderUtils } = await import('./src/RenderUtils.cjs');
9
  const { GenerateScript } = await import('./src/GenerateScript.cjs');
10
 
@@ -98,16 +98,35 @@ export const renderProxy = async (outFile, jobId, options) => {
98
 
99
  await new Promise((resolve, reject) => {
100
  console.log('Stitching chunks...: ' + concatCmd)
101
- exec(concatCmd, (error, stdout, stderr) => {
102
- if (error) {
103
- console.error(`Error stitching chunks: ${error.message}`);
104
- return reject(error);
105
- }
106
- if (stderr) {
107
- console.error(`FFmpeg stderr: ${stderr}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
- console.log(`FFmpeg stdout: ${stdout}`);
110
- resolve();
 
 
111
  });
112
  });
113
 
 
4
  import fs from 'fs';
5
  import axios from 'axios';
6
  import os from 'os'
7
+ import { exec, spawn } from 'child_process';
8
  const { RenderUtils } = await import('./src/RenderUtils.cjs');
9
  const { GenerateScript } = await import('./src/GenerateScript.cjs');
10
 
 
98
 
99
  await new Promise((resolve, reject) => {
100
  console.log('Stitching chunks...: ' + concatCmd)
101
+ const ffmpegProcess = spawn(ffmpegPath, [
102
+ '-f', 'concat',
103
+ '-safe', '0',
104
+ '-i', concatListPath,
105
+ '-c:v', 'copy',
106
+ '-c:a', 'aac',
107
+ '-b:a', '192k',
108
+ '-y',
109
+ outFile
110
+ ]);
111
+
112
+ ffmpegProcess.stdout.on('data', (data) => {
113
+ console.log(data.toString());
114
+ });
115
+
116
+ ffmpegProcess.stderr.on('data', (data) => {
117
+ console.error(data.toString());
118
+ });
119
+
120
+ ffmpegProcess.on('close', (code) => {
121
+ if (code === 0) {
122
+ resolve();
123
+ } else {
124
+ reject(new Error(`FFmpeg process exited with code ${code}`));
125
  }
126
+ });
127
+
128
+ ffmpegProcess.on('error', (err) => {
129
+ reject(err);
130
  });
131
  });
132