Skip to content

🎥 Make videos programmatically with React

add example

Hunain Ahmedc4f228c366f3
diff --git a/packages/example/public/long-video.mp4 b/packages/example/public/long-video.mp4
new file mode 100644
index 0000000000..775a650bd5
Binary files /dev/null and b/packages/example/public/long-video.mp4 differ
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index 69c9c41f84..f253e73c51 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -124,6 +124,7 @@ import {
} from './Compose/WhatIsRemotion';
import {EdgeBlur} from './EdgeBlur/EdgeBlur';
import {Empty} from './Empty';
+import {LongVideo} from './longVideoNoFlicker/longVideo';
import {LoopedOffthreadRemoteVideo} from './OffthreadRemoteVideo/LoopedOffthreadRemoteVideo';
import {OffthreadRemoteSeries} from './OffthreadRemoteVideo/OffthreadRemoteSeries';
import {ParseAndDownloadMedia} from './ParseAndDownloadMedia';
@@ -698,7 +699,15 @@ export const Index: React.FC = () => {
fps={30}
height={1080}
width={1080}
- durationInFrames={100}
+ durationInFrames={30}
+ />
+ <Composition
+ id="longVideo"
+ component={LongVideo}
+ fps={30}
+ height={720}
+ width={1280}
+ durationInFrames={30 * 25}
/>
<Composition
id="video-testing-webm"
diff --git a/packages/example/src/VideoTesting/index.tsx b/packages/example/src/VideoTesting/index.tsx
index 1e0afd87db..4d88073575 100644
--- a/packages/example/src/VideoTesting/index.tsx
+++ b/packages/example/src/VideoTesting/index.tsx
@@ -1,4 +1,3 @@
-import { NewVideo } from '../../../new-video/dist';
import {
OffthreadVideo,
Sequence,
@@ -6,22 +5,23 @@ import {
useVideoConfig,
Video,
} from 'remotion';
+import {NewVideo} from '../../../new-video/dist';
export const VideoTesting: React.FC<{
codec: 'mp4' | 'webm';
- type?: 'normal' | 'offthread' | 'codec'
-}> = ({codec, type = "normal"}) => {
+ type?: 'normal' | 'offthread' | 'codec';
+}> = ({codec, type = 'normal'}) => {
const {durationInFrames} = useVideoConfig();
const videoMp4 = staticFile('framermp4withoutfileextension');
const videoWebm = staticFile('framer.webm');
let Comp;
- if (type === 'codec'){
- Comp = NewVideo
- }else if(type === 'offthread'){
- Comp = OffthreadVideo
- }else{
- Comp = Video
+ if (type === 'codec') {
+ Comp = NewVideo;
+ } else if (type === 'offthread') {
+ Comp = OffthreadVideo;
+ } else {
+ Comp = Video;
}
return (
diff --git a/packages/example/src/longVideoNoFlicker/longVideo.tsx b/packages/example/src/longVideoNoFlicker/longVideo.tsx
new file mode 100644
index 0000000000..1f5549925e
--- /dev/null
+++ b/packages/example/src/longVideoNoFlicker/longVideo.tsx
@@ -0,0 +1,31 @@
+import {NewVideo} from '@remotion/video';
+import {AbsoluteFill, staticFile} from 'remotion';
+
+export const LongVideo: React.FC = () => {
+ return (
+ <>
+ <AbsoluteFill>
+ <div
+ style={{
+ position: 'absolute',
+ fontSize: 70,
+ fontWeight: 900,
+ left: 20,
+ height: 'fit-content',
+ bottom: 20,
+ color: 'white',
+ }}
+ >
+ <h1
+ style={{
+ textShadow: '0px 5px 10px black',
+ }}
+ >
+ No Flickering
+ </h1>
+ </div>
+ <NewVideo src={staticFile('long-video.mp4')} />
+ </AbsoluteFill>
+ </>
+ );
+};