🎥 Make videos programmatically with React
Warn about unsupported AAC output extensions
JonnyBurgerda7420d026f4
diff --git a/packages/docs/components/SupportedAudioCodec.tsx b/packages/docs/components/SupportedAudioCodec.tsxindex 9925ac0919..ed27edbe89 100644--- a/packages/docs/components/SupportedAudioCodec.tsx+++ b/packages/docs/components/SupportedAudioCodec.tsx@@ -26,6 +26,10 @@ export const SupportedAudioCodecTable = () => {default: FileExtension;};+ const documentedExtensions = possibleExtensions.possible.filter(+ (extension) => extension !== 'mpg' && extension !== 'mpeg',+ );+return (<tr key={audioCodec}><td>{i === 0 ? <code>{api}</code> : null}</td>@@ -40,7 +44,7 @@ export const SupportedAudioCodecTable = () => {<code>{audioCodec}</code></td><td>- {possibleExtensions.possible.map((p, index) => {+ {documentedExtensions.map((p, index) => {return (<span key={p}><code>.{p}</code>{' '}@@ -48,7 +52,7 @@ export const SupportedAudioCodecTable = () => {<em>(default)</em>) : null}{index ===- possibleExtensions.possible.length - 1 ? null : (+ documentedExtensions.length - 1 ? null : (<span>, </span>)}</span>@@ -67,7 +71,9 @@ export const SupportedAudioCodecTable = () => {};export const FileExtensionTable: React.FC = () => {- const extensions = Object.keys(BrowserSafeApis.defaultCodecsForFileExtension);+ const extensions = Object.keys(+ BrowserSafeApis.defaultCodecsForFileExtension,+ ).filter((extension) => extension !== 'mpg' && extension !== 'mpeg');return (<table>diff --git a/packages/docs/docs/5-0-migration.mdx b/packages/docs/docs/5-0-migration.mdxindex 23787e85d8..6d48b5e443 100644--- a/packages/docs/docs/5-0-migration.mdx+++ b/packages/docs/docs/5-0-migration.mdx@@ -208,6 +208,12 @@ The following packages stop receiving releases after the 4.x line:**Required action**: Migrate usages and remove these packages from your dependencies before upgrading. Existing 4.x versions remain available, but no 5.x versions will be published.+## AAC output no longer accepts `.mpg` and `.mpeg`++In Remotion 4.0, audio-only renders with `codec: "aac"` accepted `.mpg` and `.mpeg` filenames, but wrote raw ADTS AAC rather than an MPEG program stream. These extensions now emit a warning in v4 and throw an error in v5.++**Required action**: Change the output filename to `.aac` for raw ADTS AAC or `.m4a` for an MPEG-4 audio container. This applies to local, Lambda, and Cloud Run renders.+## License changesRemotion 5.0 has an updated license. View the [license](https://github.com/remotion-dev/remotion/blob/5-0-license/LICENSE.md) here or compare the [changes](https://github.com/remotion-dev/remotion/pull/3750).diff --git a/packages/renderer/src/file-extensions.ts b/packages/renderer/src/file-extensions.tsindex 2d50255b05..4fc91c5f21 100644--- a/packages/renderer/src/file-extensions.ts+++ b/packages/renderer/src/file-extensions.ts@@ -1,3 +1,4 @@+import {NoReactInternals} from 'remotion/no-react';import type {Codec} from './codec';import type {supportedAudioCodecs} from './options/audio-codec';@@ -48,7 +49,9 @@ export const defaultFileExtensionMap: {default: 'aac',forAudioCodec: {aac: {- possible: ['aac', '3gp', 'm4a', 'm4b', 'mpg', 'mpeg'],+ possible: NoReactInternals.ENABLE_V5_BREAKING_CHANGES+ ? ['aac', '3gp', 'm4a', 'm4b']+ : ['aac', '3gp', 'm4a', 'm4b', 'mpg', 'mpeg'],default: 'aac',},'pcm-16': {diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.tsindex 7ddda98b51..43db83eafe 100644--- a/packages/renderer/src/stitch-frames-to-video.ts+++ b/packages/renderer/src/stitch-frames-to-video.ts@@ -1,6 +1,7 @@import {cpSync, promises, rmSync} from 'node:fs';import path from 'node:path';import type {_InternalTypes} from 'remotion';+import {NoReactInternals} from 'remotion/no-react';import {getAacPrimingInputArgs} from './aac-priming';import type {RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';import type {RenderAssetInfo} from './assets/download-map';@@ -230,6 +231,22 @@ const innerStitchFramesToVideo = async (getExtensionOfFilename(outputLocation) ??getFileExtensionFromCodec(codec, resolvedAudioCodec)).toLowerCase();+ if (+ codec === 'aac' &&+ (outputExtension === 'mpg' || outputExtension === 'mpeg')+ ) {+ const message =+ 'AAC output with .mpg or .mpeg extensions is not supported. Use .aac for raw ADTS AAC or .m4a for an MPEG-4 audio container.';+ if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES) {+ throw new Error(message);+ }++ Log.warn(+ {indent, logLevel},+ `${message} Falling back to raw ADTS AAC while keeping the requested filename. This will throw an error in Remotion 5.0.`,+ );+ }+const fastStartMuxer = getFastStartMuxer(outputExtension);// Fast Start reopens its output for an in-place second pass. Keep that work// away from the public output path so Windows file observers cannot lock it.diff --git a/packages/renderer/src/validate-output-filename.ts b/packages/renderer/src/validate-output-filename.tsindex 09fcaea75b..e9282ec28e 100644--- a/packages/renderer/src/validate-output-filename.ts+++ b/packages/renderer/src/validate-output-filename.ts@@ -1,3 +1,4 @@+import {NoReactInternals} from 'remotion/no-react';import type {Codec} from './codec';import type {FileExtension} from './file-extensions';import {defaultFileExtensionMap} from './file-extensions';@@ -25,6 +26,16 @@ export const validateOutputFilename = <T extends Codec>({);}+ if (+ NoReactInternals.ENABLE_V5_BREAKING_CHANGES &&+ codec === 'aac' &&+ (extension.toLowerCase() === 'mpg' || extension.toLowerCase() === 'mpeg')+ ) {+ throw new Error(+ 'AAC output with .mpg or .mpeg extensions is not supported. Use .aac for raw ADTS AAC or .m4a for an MPEG-4 audio container.',+ );+ }+const map = defaultFileExtensionMap[codec];const resolvedAudioCodec = resolveAudioCodec({codec,