shiveshnavin commited on
Commit
e1e42ea
·
1 Parent(s): 9e457ce

Added Paperdrive platform

Browse files
.vscode/settings.json CHANGED
@@ -2,8 +2,8 @@
2
  "editor.tabSize": 2,
3
  "typescript.tsdk": "node_modules/typescript/lib",
4
  "editor.codeActionsOnSave": {
5
- "source.organizeImports": false,
6
- "source.fixAll": true
7
  },
8
  "typescript.enablePromptUseWorkspaceTsdk": true,
9
  "css.lint.unknownAtRules": "ignore"
 
2
  "editor.tabSize": 2,
3
  "typescript.tsdk": "node_modules/typescript/lib",
4
  "editor.codeActionsOnSave": {
5
+ "source.organizeImports": "never",
6
+ "source.fixAll": "explicit"
7
  },
8
  "typescript.enablePromptUseWorkspaceTsdk": true,
9
  "css.lint.unknownAtRules": "ignore"
common-creds CHANGED
@@ -1 +1 @@
1
- Subproject commit aef4467f366d76969ca0d9699062c17b2f767977
 
1
+ Subproject commit 5e7f22af79dfea56918ce3d6a5757fb796d474be
package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -1,88 +1,90 @@
1
  {
2
- "name": "semibit-media-render-farm",
3
- "version": "1.0.0",
4
- "type": "module",
5
- "description": "semibit media renderer",
6
- "sideEffects": [
7
- "*.css"
8
- ],
9
- "scripts": {
10
- "start": "node server.js",
11
- "extract32": "set MODIFY_FILES=1 && node app.js",
12
- "extract": "MODIFY_FILES=1 && node app.js",
13
- "preview": "remotion studio",
14
- "preinstall": "cd common-utils && npm run build",
15
- "build:utils": "cd common-utils && npm run build && cd .. && npm install ./common-utils",
16
- "render-build:igreels": "remotion render --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 2 --gl=angle IGReelComposition",
17
- "render-build": "remotion render --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 2 --gl=angle",
18
- "render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
19
- "upgrade": "remotion upgrade",
20
- "postinstall": "cd node_modules/common-utils && npm run build && cd ../../ && node ffmpeg-fix.js",
21
- "serve": "firebase emulators:start --only functions --project semibitmedia",
22
- "shell": "firebase functions:shell --project semibitmedia",
23
- "deploy": "firebase deploy --only functions --project semibitmedia",
24
- "logs": "firebase functions:log --project semibitmedia"
25
- },
26
- "engines": {
27
- "node": "16"
28
- },
29
- "private": true,
30
- "repository": {},
31
- "license": "UNLICENSED",
32
- "pnpm": {
33
- "peerDependencyRules": {
34
- "ignoreMissing": [
35
- "webpack"
36
- ]
37
- }
38
- },
39
- "dependencies": {
40
- "@ffmpeg-installer/ffmpeg": "^1.1.0",
41
- "@remotion/bundler": "4.0.19",
42
- "@remotion/cli": "4.0.19",
43
- "@remotion/eslint-config": "4.0.19",
44
- "@remotion/google-fonts": "4.0.19",
45
- "@remotion/lottie": "^4.0.19",
46
- "@remotion/noise": "4.0.19",
47
- "@remotion/preload": "4.0.19",
48
- "@remotion/tailwind": "4.0.19",
49
- "@remotion/zod-types": "4.0.19",
50
- "@types/react": "^18.0.26",
51
- "@types/web": "^0.0.86",
52
- "axios": "^1.4.0",
53
- "body-parser": "^1.20.2",
54
- "common-utils": "file:common-utils",
55
- "express": "^4.18.2",
56
- "ffbinaries": "^1.1.5",
57
- "firebase-admin": "^11.9.0",
58
- "firebase-functions": "^4.4.1",
59
- "fs-extra": "^11.1.1",
60
- "gojs-react": "^1.1.2",
61
- "i": "^0.3.7",
62
- "lodash": "^4.17.21",
63
- "lottie-web": "^5.12.2",
64
- "multi-db-orm": "^1.3.0",
65
- "npm": "^9.8.1",
66
- "path": "^0.12.7",
67
- "puppeteer": "^21.3.6",
68
- "react": "^18.0.0",
69
- "react-dom": "^18.0.0",
70
- "reactflow": "^11.9.4",
71
- "remotion": "4.0.19",
72
- "remotion-animated": "^2.0.0",
73
- "remotion-transition-series": "^0.0.10",
74
- "socket.io": "^4.7.2",
75
- "styled-components": "^6.0.5",
76
- "syllable-count-english": "^1.0.6",
77
- "tree-kill": "^1.2.2",
78
- "ts-node-dev": "^2.0.0",
79
- "typescript": "^4.9.4",
80
- "which": "^3.0.1",
81
- "ws": "^8.13.0",
82
- "zod": "^3.21.4"
83
- },
84
- "packageManager": "npm@8.19.4",
85
- "devDependencies": {
86
- "@types/lodash": "^4.14.199"
87
- }
 
 
88
  }
 
1
  {
2
+ "name": "semibit-media-render-farm",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "semibit media renderer",
6
+ "sideEffects": [
7
+ "*.css"
8
+ ],
9
+ "scripts": {
10
+ "start": "node server.js",
11
+ "extract32": "set MODIFY_FILES=1 && node app.js",
12
+ "extract": "MODIFY_FILES=1 && node app.js",
13
+ "preview": "remotion studio",
14
+ "preinstall": "cd common-utils && npm run build",
15
+ "build:utils": "cd common-utils && npm run build && cd .. && npm install ./common-utils",
16
+ "render-build:igreels": "remotion render --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 2 --gl=angle IGReelComposition",
17
+ "render-build": "remotion render --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 2 --gl=angle",
18
+ "render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
19
+ "render-image": "remotion still --image-format=jpeg $npm_config_composition $npm_config_output",
20
+ "upgrade": "remotion upgrade",
21
+ "postinstall": "cd node_modules/common-utils && npm run build && cd ../../ && node ffmpeg-fix.js",
22
+ "serve": "firebase emulators:start --only functions --project semibitmedia",
23
+ "shell": "firebase functions:shell --project semibitmedia",
24
+ "deploy": "firebase deploy --only functions --project semibitmedia",
25
+ "logs": "firebase functions:log --project semibitmedia"
26
+ },
27
+ "engines": {
28
+ "node": "16"
29
+ },
30
+ "private": true,
31
+ "repository": {},
32
+ "license": "UNLICENSED",
33
+ "pnpm": {
34
+ "peerDependencyRules": {
35
+ "ignoreMissing": [
36
+ "webpack"
37
+ ]
38
+ }
39
+ },
40
+ "dependencies": {
41
+ "@ffmpeg-installer/ffmpeg": "^1.1.0",
42
+ "@remotion/bundler": "4.0.19",
43
+ "@remotion/cli": "4.0.19",
44
+ "@remotion/eslint-config": "4.0.19",
45
+ "@remotion/google-fonts": "4.0.19",
46
+ "@remotion/lottie": "^4.0.19",
47
+ "@remotion/noise": "4.0.19",
48
+ "@remotion/preload": "4.0.19",
49
+ "@remotion/tailwind": "4.0.19",
50
+ "@remotion/zod-types": "4.0.19",
51
+ "@types/react": "^18.0.26",
52
+ "@types/web": "^0.0.86",
53
+ "axios": "^1.4.0",
54
+ "body-parser": "^1.20.2",
55
+ "common-utils": "file:common-utils",
56
+ "express": "^4.18.2",
57
+ "ffbinaries": "^1.1.5",
58
+ "firebase-admin": "^11.9.0",
59
+ "firebase-functions": "^4.4.1",
60
+ "fs-extra": "^11.1.1",
61
+ "gojs-react": "^1.1.2",
62
+ "i": "^0.3.7",
63
+ "lodash": "^4.17.21",
64
+ "lottie-web": "^5.12.2",
65
+ "multi-db-orm": "^1.3.0",
66
+ "npm": "^9.8.1",
67
+ "path": "^0.12.7",
68
+ "puppeteer": "^21.3.6",
69
+ "react": "^18.0.0",
70
+ "react-dom": "^18.0.0",
71
+ "react-qrcode-logo": "^3.0.0",
72
+ "reactflow": "^11.9.4",
73
+ "remotion": "4.0.19",
74
+ "remotion-animated": "^2.0.0",
75
+ "remotion-transition-series": "^0.0.10",
76
+ "socket.io": "^4.7.2",
77
+ "styled-components": "^6.0.5",
78
+ "syllable-count-english": "^1.0.6",
79
+ "tree-kill": "^1.2.2",
80
+ "ts-node-dev": "^2.0.0",
81
+ "typescript": "^4.9.4",
82
+ "which": "^3.0.1",
83
+ "ws": "^8.13.0",
84
+ "zod": "^3.21.4"
85
+ },
86
+ "packageManager": "npm@8.19.4",
87
+ "devDependencies": {
88
+ "@types/lodash": "^4.14.199"
89
+ }
90
  }
src/Compositions.tsx CHANGED
@@ -12,6 +12,8 @@ import { RenderUtils } from './RenderUtils';
12
  import { VideoSplash, VideoSplashSchema } from './anims/VideoSplash';
13
  import { YoutubeVideoScene } from './youtube/YoutubeVideoScene';
14
  import { LinkedinFullSysDesignComposition } from './linkedin-video/LinkedinFullSysDesignComposition';
 
 
15
 
16
 
17
 
@@ -194,6 +196,35 @@ export const Compositions: React.FC = () => {
194
  })}
195
  />
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  <Composition
198
  defaultProps={{
199
  direction: 'left',
 
12
  import { VideoSplash, VideoSplashSchema } from './anims/VideoSplash';
13
  import { YoutubeVideoScene } from './youtube/YoutubeVideoScene';
14
  import { LinkedinFullSysDesignComposition } from './linkedin-video/LinkedinFullSysDesignComposition';
15
+ import { PaperDriveComposition } from './paperdrive/PaperDriveComposition';
16
+ import { PaperDriveHorizontalCoverComposition } from './paperdrive/PaperDriveHorizontalCoverComposition';
17
 
18
 
19
 
 
196
  })}
197
  />
198
 
199
+ <Composition
200
+ id='PaperDriveComposition'
201
+ component={PaperDriveComposition}
202
+ durationInFrames={Script.meta.fps * Script.transcript.length}
203
+ fps={fps}
204
+ width={Script.meta?.resolution?.width || 1920}
205
+ height={Script.meta?.resolution?.height || 1080}
206
+ defaultProps={Object.assign(Script, {
207
+ bgMusic: RenderUtils.getFileName(Script.bgMusic, "mp3"),
208
+ contents: contents,
209
+ intro: intro,
210
+ outro: outro
211
+ })}
212
+ />
213
+
214
+ <Composition
215
+ id='PaperDriveHorizontalCoverComposition'
216
+ component={PaperDriveHorizontalCoverComposition}
217
+ durationInFrames={duration}
218
+ fps={fps}
219
+ width={Script.meta?.resolution?.width || 1920}
220
+ height={Script.meta?.resolution?.height || 1080}
221
+ defaultProps={Object.assign(Script, {
222
+ bgMusic: RenderUtils.getFileName(Script.bgMusic, "mp3"),
223
+ contents: contents,
224
+ intro: intro,
225
+ outro: outro
226
+ })}
227
+ />
228
  <Composition
229
  defaultProps={{
230
  direction: 'left',
src/RenderUtils.ts CHANGED
@@ -19,7 +19,7 @@ function levenshteinDistance(str1: string, str2: string) {
19
  }
20
  export class RenderUtils {
21
 
22
- public static splitWordsIntoGroups(words) {
23
  const groups = [];
24
  let currentGroup = [];
25
 
@@ -60,11 +60,11 @@ export class RenderUtils {
60
  }
61
 
62
 
63
- public static findCurrentGroupByTime(timeSec: Number, groups) {
64
  var t = timeSec;
65
  let wds = groups
66
  for (let i = 0; i < wds.length; i++) {
67
- const x = wds[i];
68
  if (x.start != undefined && x.end != undefined && (t >= x.start && t < x.end)) {
69
  return x
70
  }
@@ -72,7 +72,7 @@ export class RenderUtils {
72
  }
73
 
74
 
75
- public static findCurrentWord(timeSec, frames) {
76
  var t = timeSec;
77
  let wds = frames
78
  for (let i = 0; i < wds.length; i++) {
@@ -88,14 +88,14 @@ export class RenderUtils {
88
  return arr[Math.floor(random(seed || 1) * arr.length)];
89
  }
90
 
91
- public static hashCode(s) {
92
- return s.split("").reduce(function (a, b) {
93
  a = ((a << 5) - a) + b.charCodeAt(0);
94
  return a & a;
95
  }, 0);
96
  }
97
 
98
- public static splitArrayIntoChunks(arr, chunkSize) {
99
  const chunkedArr = [];
100
  for (let i = 0; i < arr.length; i += chunkSize) {
101
  chunkedArr.push(arr.slice(i, i + chunkSize));
@@ -103,7 +103,7 @@ export class RenderUtils {
103
  return chunkedArr;
104
  }
105
 
106
- public static splitArray(arr, pieces) {
107
  let result = [];
108
  let chunkSize = Math.ceil(arr.length / pieces);
109
  for (let i = 0, j = arr.length; i < j; i += chunkSize) {
 
19
  }
20
  export class RenderUtils {
21
 
22
+ public static splitWordsIntoGroups(words: any) {
23
  const groups = [];
24
  let currentGroup = [];
25
 
 
60
  }
61
 
62
 
63
+ public static findCurrentGroupByTime(timeSec: Number, groups: any[]) {
64
  var t = timeSec;
65
  let wds = groups
66
  for (let i = 0; i < wds.length; i++) {
67
+ const x: any = wds[i];
68
  if (x.start != undefined && x.end != undefined && (t >= x.start && t < x.end)) {
69
  return x
70
  }
 
72
  }
73
 
74
 
75
+ public static findCurrentWord(timeSec: Number, frames: any[]) {
76
  var t = timeSec;
77
  let wds = frames
78
  for (let i = 0; i < wds.length; i++) {
 
88
  return arr[Math.floor(random(seed || 1) * arr.length)];
89
  }
90
 
91
+ public static hashCode(s: string) {
92
+ return s.split("").reduce(function (a: number, b: string) {
93
  a = ((a << 5) - a) + b.charCodeAt(0);
94
  return a & a;
95
  }, 0);
96
  }
97
 
98
+ public static splitArrayIntoChunks(arr: string | any[], chunkSize: number) {
99
  const chunkedArr = [];
100
  for (let i = 0; i < arr.length; i += chunkSize) {
101
  chunkedArr.push(arr.slice(i, i + chunkSize));
 
103
  return chunkedArr;
104
  }
105
 
106
+ public static splitArray(arr: string | any[], pieces: number) {
107
  let result = [];
108
  let chunkSize = Math.ceil(arr.length / pieces);
109
  for (let i = 0, j = arr.length; i < j; i += chunkSize) {
src/paperdrive/PaperDriveComposition.tsx ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { AbsoluteFill, Audio, Easing, Img, interpolate, staticFile, useCurrentFrame } from 'remotion';
2
+ import React from 'react'
3
+ import { loadFont } from "@remotion/google-fonts/MontserratAlternates";
4
+ import { Series } from "remotion";
5
+ import { IGScene } from '../ig-reel/IGSimpleScene';
6
+ import { OriginalManuscript, Transcript } from 'common-utils';
7
+ import TransitionSeries from 'remotion-transition-series';
8
+ import { VideoSplash } from '../anims/VideoSplash';
9
+ import Transitions from '../../public/assets/transitions.json'
10
+ import { RenderUtils } from '../RenderUtils';
11
+ import GeneralSubtitles from '../subtitles/general_Subtitles';
12
+ import { PaperDrivePage } from './PaperDrivePage';
13
+
14
+ export const PaperDriveComposition = (props: OriginalManuscript) => {
15
+ const { fontFamily } = loadFont();
16
+ let { meta, bgMusic, bgMusicDuration } = props
17
+ let transcripts: Transcript[] = props.transcript
18
+ let fps = meta.fps
19
+ let frame = useCurrentFrame()
20
+ return (
21
+
22
+
23
+ <Series>
24
+ {
25
+ props.transcript.map(transcript => {
26
+ return (
27
+ <Series.Sequence durationInFrames={transcript.durationInSeconds * fps}>
28
+ <PaperDrivePage transcript={transcript} />
29
+ </Series.Sequence>
30
+ )
31
+ })
32
+ }
33
+
34
+ </Series>
35
+
36
+ );
37
+ };
src/paperdrive/PaperDriveHorizontalCoverComposition.tsx ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { AbsoluteFill, Img, staticFile } from 'remotion';
2
+ import React from 'react'
3
+ import { loadFont } from "@remotion/google-fonts/MontserratAlternates";
4
+ import { PaperDrivePoster } from './types';
5
+
6
+ function adjustFontSize(text: string, fullFont?: number): number {
7
+ if (!fullFont) {
8
+ fullFont = 160
9
+ }
10
+ const wordCount = text.split(' ').length;
11
+ return fullFont - (wordCount * (wordCount > 5 ? 4.5 : 1));
12
+ }
13
+
14
+ function splitSentence(sentence: string): [string, string] {
15
+ const words = sentence.trim().split(' ');
16
+ const lastWord = words[words.length - 1];
17
+ const lastWordIndex = sentence.lastIndexOf(lastWord);
18
+ const firstPart = sentence.slice(0, lastWordIndex).trim();
19
+ const secondPart = sentence.slice(lastWordIndex).trim();
20
+ return [firstPart, secondPart];
21
+ }
22
+
23
+ export const PaperDriveHorizontalCoverComposition: React.FC<PaperDrivePoster> = (props: PaperDrivePoster) => {
24
+ const { fontFamily } = loadFont();
25
+
26
+ return (
27
+ <AbsoluteFill>
28
+
29
+
30
+ </AbsoluteFill >
31
+ );
32
+ };
src/paperdrive/PaperDrivePage.tsx ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Transcript } from "common-utils"
2
+ import React from "react"
3
+ import { AbsoluteFill, staticFile } from "remotion"
4
+ import { QRCode } from 'react-qrcode-logo';
5
+ import { RenderUtils } from '../RenderUtils';
6
+
7
+ export type PaperDrivePageExtras = {
8
+ marginBottom: string;
9
+ url: string,
10
+ leftMarginLineColor?: string,
11
+ lineColor?: string,
12
+ qr?: {
13
+ logoOpacity?: number;
14
+ showLogo?: any;
15
+ color?: string | undefined;
16
+ size?: number //200
17
+ qrStyle?: "squares" | "dots" | "fluid"
18
+ position?: {
19
+ position: "static" | "relative" | "absolute" | "sticky" | "fixed" // "right"
20
+ top?: number // 0
21
+ left?: number // 0
22
+ bottom?: number // 0
23
+ right?: number // 0
24
+ }
25
+ },
26
+ marginLeft: string // "10%"
27
+ marginTop: string // "10%"
28
+ }
29
+ export function PaperDrivePage({ transcript }: { transcript: Transcript }) {
30
+ const extras = transcript.extras as PaperDrivePageExtras
31
+ const qrImageBlend = transcript.imageAbsPaths?.[0]?.path
32
+ const defaultQrSize = 300
33
+ const logo = qrImageBlend ? staticFile(RenderUtils.getFileName(qrImageBlend)!) : undefined
34
+ return (
35
+ <AbsoluteFill style={{
36
+ background: 'white',
37
+ paddingTop: extras.marginTop ?? '10%',
38
+ paddingBottom: extras.marginBottom ?? '5%',
39
+ }}>
40
+ <AbsoluteFill style={{
41
+ background: 'white',
42
+ position: 'relative',
43
+ padding: '20px', // Add padding for some spacing
44
+ backgroundImage: `linear-gradient(to bottom, transparent 94%, ${extras.lineColor ?? 'lightgray'} 94%)`, // Horizontal lines
45
+ backgroundSize: '100% 30px' // Distance between lines
46
+ }}>
47
+ </AbsoluteFill>
48
+
49
+ <div style={extras.qr?.position ?? {
50
+ position: 'absolute',
51
+ top: 0,
52
+ right: 0
53
+ }}>
54
+ <QRCode
55
+ fgColor={extras.qr?.color ?? 'black'}
56
+ size={extras.qr?.size ?? defaultQrSize}
57
+ value={extras.url}
58
+ qrStyle={extras.qr?.qrStyle ?? 'squares'}
59
+ logoImage={extras.qr?.showLogo ? logo : undefined}
60
+ logoWidth={extras.qr?.size ?? defaultQrSize}
61
+ logoHeight={extras.qr?.size ?? defaultQrSize}
62
+ logoOpacity={extras.qr?.logoOpacity ?? 0.1}
63
+ removeQrCodeBehindLogo={false}
64
+ />
65
+ </div>
66
+
67
+ <div style={{
68
+ position: 'absolute',
69
+ left: extras.marginLeft,
70
+ top: '0',
71
+ height: '100%',
72
+ width: '2px',
73
+ backgroundColor: extras.leftMarginLineColor ?? 'lightgray',
74
+ }}>
75
+ </div>
76
+ </AbsoluteFill>
77
+ )
78
+ }
src/paperdrive/types/index.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export type PaperDrivePoster = {
2
+
3
+ }
src/youtube/SequentialScene.tsx CHANGED
@@ -107,14 +107,6 @@ export const SequentialScene: React.FC = (
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
 
120
  {
 
107
 
108
  {getScene(contents[2])}
109
 
 
 
 
 
 
 
 
 
110
 
111
 
112
  {