shiveshnavin commited on
Commit
050859f
·
1 Parent(s): 5f248ee

Reduce logging

Browse files
app.js CHANGED
@@ -17,80 +17,13 @@ import axios from 'axios'
17
  const __filename = fileURLToPath(import.meta.url);
18
  const __dirname = dirname(__filename)
19
 
20
- let pl = {
21
- onLog: console.log
22
  }
23
-
24
- let jobs = {}
25
- function render() {
26
- let outputFile = '';
27
- let thumbnailFile = '';
28
- let manuscriptFile = '';
29
-
30
- return new Promise((resolve, reject) => {
31
-
32
- if (existsSync(outputFile)) {
33
- unlinkSync(outputFile)
34
- }
35
- const SEMIBI_MEDIA_RENDERER = "../semibit-media-render-farm"
36
- const options = {
37
- cwd: _resolve(SEMIBI_MEDIA_RENDERER),
38
- };
39
- const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
40
- var script = spawn(npmCommand, ['run', 'render-build', '--', outputFile], options);
41
-
42
- jobs[manuscriptFile] = {
43
- kill: (() => {
44
- pl.onLog("Killing Rendering of video/poster")
45
- script.kill()
46
- resolve([{
47
- status: false
48
- }])
49
- })
50
- }
51
- script.stdout.on('data', (data) => {
52
- if (!process.env.is_pm2)
53
- process.stdout?.write(data);
54
- });
55
- script.stderr.on('data', (data) => {
56
- process.stderr?.write(data);
57
- try {
58
- pl.onLog(data?.toString())
59
- } catch (e) {
60
-
61
- }
62
- });
63
- script.on('close', (code) => {
64
-
65
- script = spawn(npmCommand, ['run', 'render-still', '--', thumbnailFile], options);
66
- script.stdout.on('data', (data) => {
67
- process.stdout?.write(data);
68
- });
69
- script.stderr.on('data', (data) => {
70
- process.stderr?.write(data);
71
- pl.onLog(data)
72
- });
73
- script.on('close', (code) => {
74
- resolve([{
75
- status: true,
76
- outputFile,
77
- manuscriptFile,
78
- posterImage: thumbnailFile
79
- }])
80
- });
81
-
82
-
83
- })
84
-
85
- })
86
- }
87
-
88
- const db = new FireStoreDB(join(__dirname, 'common-creds/firebase/semibitmedia.json'))
89
-
90
  function modifyFiles(originalManuscript, originalManuscriptFile) {
91
 
92
- let fname = join(__dirname, "./src/textWithBgImage/SequentialScene.orig.tsx")
93
- let fnameTarget = join(__dirname, "./src/textWithBgImage/SequentialScene.tsx")
94
  let SequentialSceneText = readFileSync(fname).toString()
95
  let seqScene = "";
96
  let script = originalManuscript.transcript
@@ -492,7 +425,8 @@ function doRender(jobId, composition, statusCb) {
492
  console.log('Starting video render')
493
  childProcess.stdout.on('data', (data) => {
494
  sendToObserver(jobId, data)
495
- console.log(data.toString());
 
496
  });
497
 
498
  childProcess.stderr.on('data', (data) => {
@@ -522,7 +456,8 @@ function doRenderPoster(jobId, statusCb) {
522
  console.log('Starting poster render')
523
  childProcess.stdout.on('data', (data) => {
524
  sendToObserver(jobId, data)
525
- console.log(data.toString());
 
526
  });
527
 
528
  childProcess.stderr.on('data', (data) => {
 
17
  const __filename = fileURLToPath(import.meta.url);
18
  const __dirname = dirname(__filename)
19
 
20
+ if (process.env.is_pm2) {
21
+ console.log('Disabling render logs to stdout as env is pm2')
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  function modifyFiles(originalManuscript, originalManuscriptFile) {
24
 
25
+ let fname = join(__dirname, "./src/youtube/SequentialScene.orig.tsx")
26
+ let fnameTarget = join(__dirname, "./src/youtube/SequentialScene.tsx")
27
  let SequentialSceneText = readFileSync(fname).toString()
28
  let seqScene = "";
29
  let script = originalManuscript.transcript
 
425
  console.log('Starting video render')
426
  childProcess.stdout.on('data', (data) => {
427
  sendToObserver(jobId, data)
428
+ if (!process.env.is_pm2)
429
+ console.log(data.toString());
430
  });
431
 
432
  childProcess.stderr.on('data', (data) => {
 
456
  console.log('Starting poster render')
457
  childProcess.stdout.on('data', (data) => {
458
  sendToObserver(jobId, data)
459
+ if (!process.env.is_pm2)
460
+ console.log(data.toString());
461
  });
462
 
463
  childProcess.stderr.on('data', (data) => {
package.json CHANGED
@@ -11,7 +11,7 @@
11
  "extract32": "set MODIFY_FILES=1 && node app.js",
12
  "extract": "MODIFY_FILES=1 && node app.js",
13
  "preview": "remotion studio",
14
- "render-build:igreels": "remotion render --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 4 --gl=angle IGReelComposition",
15
  "render-build": "remotion render --image-format=jpeg --quality=70 --gl=angle ",
16
  "render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
17
  "upgrade": "remotion upgrade",
 
11
  "extract32": "set MODIFY_FILES=1 && node app.js",
12
  "extract": "MODIFY_FILES=1 && node app.js",
13
  "preview": "remotion studio",
14
+ "render-build:igreels": "remotion render --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 2 --gl=angle IGReelComposition",
15
  "render-build": "remotion render --image-format=jpeg --quality=70 --gl=angle ",
16
  "render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
17
  "upgrade": "remotion upgrade",
preview.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ npm run preview
public/assets/transitions.json CHANGED
@@ -19,7 +19,7 @@
19
  "durationSec": 2.07
20
  },
21
  {
22
- "mood": "excited,happy",
23
  "file": "assets/effects/effect_fire_2.webm",
24
  "durationSec": 0.93
25
  },
@@ -34,7 +34,7 @@
34
  "durationSec": 1
35
  },
36
  {
37
- "mood": "excited,happy",
38
  "file": "assets/effects/effect_sky.webm",
39
  "durationSec": 2.07
40
  },
 
19
  "durationSec": 2.07
20
  },
21
  {
22
+ "mood": "excited,happy,intro",
23
  "file": "assets/effects/effect_fire_2.webm",
24
  "durationSec": 0.93
25
  },
 
34
  "durationSec": 1
35
  },
36
  {
37
+ "mood": "excited,happy,intro",
38
  "file": "assets/effects/effect_sky.webm",
39
  "durationSec": 2.07
40
  },
src/ig-reel/IGReelComposition.tsx CHANGED
@@ -6,6 +6,9 @@ import { Series } from "remotion";
6
  import { IGScene } from './IGSimpleScene';
7
  import { OriginalManuscript, Transcript } from '../models/OriginalManuscriptModel';
8
  import TransitionSeries from 'remotion-transition-series';
 
 
 
9
 
10
  export const IGReelComposition: React.FC = (props: OriginalManuscript) => {
11
  const { fontFamily } = loadFont();
@@ -14,6 +17,9 @@ export const IGReelComposition: React.FC = (props: OriginalManuscript) => {
14
  let fps = meta.fps
15
  let frame = useCurrentFrame()
16
 
 
 
 
17
 
18
  let bgMusicPath = staticFile(bgMusic || '')
19
  return (
@@ -46,6 +52,12 @@ export const IGReelComposition: React.FC = (props: OriginalManuscript) => {
46
  }
47
  </TransitionSeries>
48
 
 
 
 
 
 
 
49
 
50
  </AbsoluteFill >
51
  );
 
6
  import { IGScene } from './IGSimpleScene';
7
  import { OriginalManuscript, Transcript } from '../models/OriginalManuscriptModel';
8
  import TransitionSeries from 'remotion-transition-series';
9
+ import { VideoSplash } from '../anims/VideoSplash';
10
+ import Transitions from '../../public/assets/transitions.json'
11
+ import { RenderUtils } from '../RenderUtils';
12
 
13
  export const IGReelComposition: React.FC = (props: OriginalManuscript) => {
14
  const { fontFamily } = loadFont();
 
17
  let fps = meta.fps
18
  let frame = useCurrentFrame()
19
 
20
+ let textLen = props.transcript.length % 5
21
+ let transitions = Transitions.filter(t => t.mood?.indexOf("intro") > -1)
22
+ let startTransition = RenderUtils.randomElement(transitions, `x-${textLen}`)
23
 
24
  let bgMusicPath = staticFile(bgMusic || '')
25
  return (
 
52
  }
53
  </TransitionSeries>
54
 
55
+ <div
56
+ style={{
57
+ width: '100%',
58
+ height: '100%'
59
+ }}
60
+ ><VideoSplash file={startTransition.file} /></div>
61
 
62
  </AbsoluteFill >
63
  );
src/youtube/SequentialScene.tsx CHANGED
@@ -96,24 +96,24 @@ export const SequentialScene: React.FC = (
96
  }
97
 
98
 
 
 
99
 
100
- {getScene(contents[0])}
101
 
102
- {getTransitionScene(contents[1])}
103
 
104
- {getScene(contents[1])}
105
 
106
- {getTransitionScene(contents[2])}
107
 
108
- {getScene(contents[2])}
109
 
110
- {getTransitionScene(contents[3])}
111
 
112
- {getScene(contents[3])}
113
 
114
- {getTransitionScene(contents[4])}
115
-
116
- {getScene(contents[4])}
117
 
118
 
119
 
 
96
  }
97
 
98
 
99
+
100
+ {getScene(contents[0])}
101
 
102
+ {getTransitionScene(contents[1])}
103
 
104
+ {getScene(contents[1])}
105
 
106
+ {getTransitionScene(contents[2])}
107
 
108
+ {getScene(contents[2])}
109
 
110
+ {getTransitionScene(contents[3])}
111
 
112
+ {getScene(contents[3])}
113
 
114
+ {getTransitionScene(contents[4])}
115
 
116
+ {getScene(contents[4])}
 
 
117
 
118
 
119
 
start.sh CHANGED
@@ -1 +1 @@
1
- npm start
 
1
+ is_pm2=1 npm start