Skip to content

Commit

Permalink
feat(captions): get hardcoded caption from render
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurdenner committed Sep 8, 2021
1 parent 78194b7 commit 4c832be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 10 additions & 1 deletion packages/renderer/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,16 @@ export const renderFrames = async ({
assetsInfo: {
assets,
bundleDir: webpackBundle,
captions: [],
// TODO: Figure out how to make this dynamic
captions: [
{
id: '123',
src: path.resolve(
__dirname,
'../../example/src/RemoteVideo/src/subs.srt'
),
},
],
},
frameCount,
};
Expand Down
8 changes: 2 additions & 6 deletions packages/renderer/src/stitcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import execa from 'execa';
import path from 'path';
import {
Codec,
ImageFormat,
Expand Down Expand Up @@ -126,10 +125,7 @@ export const stitchFramesToVideo = async (options: {
console.log('filters', filters);
}

const pathToSubtitle = path.resolve(
__dirname,
'../../example/src/RemoteVideo/src/subs.srt'
);
const {captions} = options.assetsInfo;

const {complexFilterFlag, cleanup} = await createFfmpegComplexFilter(filters);
const ffmpegArgs = [
Expand All @@ -141,7 +137,7 @@ export const stitchFramesToVideo = async (options: {
? ['-i', `element-%0${frameInfo.numberLength}d.${imageFormat}`]
: null,
...assetsToFfmpegInputs({
assets: assetPaths.concat([pathToSubtitle]),
assets: assetPaths.concat(captions.map((caption) => caption.src)),
isAudioOnly,
fps: options.fps,
frameCount: options.assetsInfo.assets.length,
Expand Down

0 comments on commit 4c832be

Please sign in to comment.