Skip to content

🎥 Make videos programmatically with React

add sample composition for testing long audio

Jonny Burgerda51a10480c6
diff --git a/.gitignore b/.gitignore
index b92513cc84..f20eeb24a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ packages/cloudrun/remotion-lambda-gcp.code-workspace
.terraform*
packages/example/sa-key.json
packages/example/public/pts-framermp4withoutfileextension.mp4
+packages/example/public/long-audio.wav
packages/it-tests/packages/example/out/element-2.png
packages/cloudrun/src/gcpInstaller/terraform*
packages/cloudrun/src/gcpInstaller/*.tfplan
diff --git a/packages/example/src/LongAudio.tsx b/packages/example/src/LongAudio.tsx
new file mode 100644
index 0000000000..9724726931
--- /dev/null
+++ b/packages/example/src/LongAudio.tsx
@@ -0,0 +1,46 @@
+import {Audio} from '@remotion/media';
+import {getStaticFiles} from '@remotion/studio';
+import {AbsoluteFill} from 'remotion';
+
+const FILE_NAME = 'long-audio.wav';
+
+const FFMPEG_COMMAND = `bunx remotion ffmpeg -f lavfi -i "sine=frequency=440:duration=3600" -c:a pcm_s16le public/${FILE_NAME}`;
+
+export const LongAudio: React.FC = () => {
+ const file = getStaticFiles().find((f) => f.name === FILE_NAME);
+
+ if (!file) {
+ return (
+ <AbsoluteFill
+ style={{
+ backgroundColor: '#111',
+ color: '#eee',
+ fontFamily: 'monospace',
+ padding: 60,
+ justifyContent: 'center',
+ }}
+ >
+ <div style={{fontSize: 32, marginBottom: 24}}>
+ Missing <code>public/{FILE_NAME}</code>
+ </div>
+ <div style={{fontSize: 20, marginBottom: 16, opacity: 0.8}}>
+ Generate a 1h test audio with:
+ </div>
+ <pre
+ style={{
+ fontSize: 22,
+ background: '#222',
+ padding: 24,
+ borderRadius: 8,
+ whiteSpace: 'pre-wrap',
+ wordBreak: 'break-all',
+ }}
+ >
+ {FFMPEG_COMMAND}
+ </pre>
+ </AbsoluteFill>
+ );
+ }
+
+ return <Audio src={file.src} />;
+};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index b87e15daa7..8ac7cd0be1 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -41,6 +41,7 @@ import {HlsDemo} from './Hls/HlsDemo';
import {HugeImage} from './HugeImage';
import {HugePayload, hugePayloadSchema} from './HugePayload';
import {Layers} from './Layers';
+import {LongAudio} from './LongAudio';
import {ManyAudio} from './ManyAudio';
import {HandleAudioRenderError} from './MediaErrorHandling/HandleAudioRenderError';
import {InfiniteAudio} from './MediaErrorHandling/InfiniteAudio';
@@ -711,6 +712,14 @@ export const Index: React.FC = () => {
/>
</Folder>
<Folder name="new-media-tags">
+ <Composition
+ id="long-audio"
+ component={LongAudio}
+ width={1280}
+ height={720}
+ fps={30}
+ durationInFrames={60 * 60 * 30}
+ />
<Composition
id="new-audio"
component={NewAudioExample}