🎥 Make videos programmatically with React
merged main branch and updated image-formats.ts
Shankhadeep Dey940491697509
diff --git a/packages/bundler/package.json b/packages/bundler/package.jsonindex 81debd85ac..1f7be1baa9 100644--- a/packages/bundler/package.json+++ b/packages/bundler/package.json@@ -1,6 +1,6 @@{"name": "@remotion/bundler",- "version": "1.3.0",+ "version": "1.3.1","description": "Bundler for Remotion","main": "dist/index.js","repository": {diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.tsindex e4ae45551d..e9e97be306 100644--- a/packages/cli/src/image-formats.ts+++ b/packages/cli/src/image-formats.ts@@ -3,7 +3,7 @@ import {OutputFormat} from 'remotion';export type FrameFormat = 'png' | 'jpeg';export const getFrameFormat = (format: OutputFormat): FrameFormat => {- if (format === 'mp4') {+ if (format === 'mp4' || format === 'webm-v8' || format === 'webm-v9') {return 'jpeg';}if (format === 'png-sequence') {diff --git a/packages/docs/docs/jsx-support.md b/packages/docs/docs/jsx-support.mdindex f349a1bf2e..6fee6d39c4 100644--- a/packages/docs/docs/jsx-support.md+++ b/packages/docs/docs/jsx-support.md@@ -7,7 +7,7 @@ Since Remotion 1.3, you can opt out of Typescript and it's type checking advanta## Opting out of Typescript-You may import import `.js` and `.jsx` files as normal. If you would like to completely move to JS, rename `index.tsx` and `Video.tsx` so they have a `.jsx` file extension. Remove types such as `React.FC` and `SpringConfig`.+You may import `.js` and `.jsx` files as normal. If you would like to completely move to JS, rename `index.tsx` and `Video.tsx` so they have a `.jsx` file extension. Remove types such as `React.FC` and `SpringConfig`.## Upgradingdiff --git a/packages/example/remotion.config.ts b/packages/example/remotion.config.tsindex d35573ed0f..61983646bb 100644--- a/packages/example/remotion.config.ts+++ b/packages/example/remotion.config.ts@@ -1,6 +1,7 @@+import os from 'os';import {Config} from 'remotion';-Config.Rendering.setConcurrency(4);+Config.Rendering.setConcurrency(os.cpus().length);Config.Output.setOverwriteOutput(true);Config.Output.setPixelFormat('yuv420p');diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.tsindex b9fb2d4457..80ea5be20e 100644--- a/packages/renderer/src/stitcher.ts+++ b/packages/renderer/src/stitcher.ts@@ -1,4 +1,5 @@import execa from 'execa';+import fs from 'fs';import {OutputFormat, PixelFormat} from 'remotion';import {DEFAULT_IMAGE_FORMAT, ImageFormat} from './image-format';import {validateFfmpeg} from './validate-ffmpeg';@@ -16,6 +17,17 @@ export const stitchFramesToVideo = async (options: {}): Promise<void> => {const format = options.imageFormat ?? DEFAULT_IMAGE_FORMAT;await validateFfmpeg();+ const files = await fs.promises.readdir(options.dir);+ const biggestNumber = Math.max(+ ...files+ .filter((f) => f.match(/element-([0-9]+)/))+ .map((f) => {+ return f.match(/element-([0-9]+)/)?.[1] as string;+ })+ .map((f) => Number(f))+ );+ const numberLength = String(biggestNumber).length;+await execa('ffmpeg',[@@ -25,10 +37,8 @@ export const stitchFramesToVideo = async (options: {'image2','-s',`${options.width}x${options.height}`,- '-pattern_type',- 'glob','-i',- `element-*.${format}`,+ `element-%0${numberLength}d.${format}`,options.outputFormat === 'mp4' ? '-vcodec' : '-c:v',options.outputFormat === 'mp4'? 'libx264'