Skip to content

pnstack/template-remotion

 
 

Repository files navigation

Template Remotion - News Stories & Quote Videos

A Remotion template for creating vertical (9:16 aspect ratio) videos with animations, similar to Instagram/Facebook Stories format. Includes both News Stories and Quote modules.

📚 Documentation

General

Quote Module (New!)

Features

News Stories Module

  • Vertical format (9:16): Optimized for social media stories
  • Background images with animations: Support for zoom-in, zoom-out, and fade effects
  • Animated text segments: Multiple text animations (fade, slide, typing)
  • Publication date display: Shows date in top-left corner
  • Tags support: Display multiple tags with animations
  • Copyright line: Configurable copyright text
  • Zod schema validation: Runtime type checking with clear error messages
  • Story factory: Fluent builder API for creating stories
  • Multi-story support: Combine multiple stories with transitions
  • Fully configurable: All aspects can be customized via props

Quote Module (New!)

  • Quote videos: Create beautiful short quote videos
  • Flexible backgrounds: Support for both images and videos
  • Audio support: Add background music or narration
  • Friendly animations: Smooth fade-in, zoom, and pan effects
  • Stories/Tags: Display related categories
  • Builder pattern: Fluent API for easy configuration
  • Type-safe: Full TypeScript support with Zod validation
  • Pre-built examples: 7 ready-to-use quote templates

Installation

npm install

Usage

Development Mode

Start the Remotion Studio to preview and edit your video:

npm run dev

Build Video

Render the video to an MP4 file:

npm run build

The video will be saved to out/video.mp4.

Configuration

The NewsStory component accepts the following props:

Props Interface

interface NewsStoryProps {
  backgroundImages: BackgroundImage[];
  textSegments: TextSegment[];
  publishDate: string;
  tags: string[];
  copyright: string;
}

interface BackgroundImage {
  url: string;
  animation?: 'zoom-in' | 'zoom-out' | 'fade' | 'none';
}

interface TextSegment {
  text: string;
  startFrame: number;
  durationInFrames: number;
  animation?: 'fade' | 'slide' | 'typing' | 'none';
}

Example Configuration

<Composition
  id="NewsStory"
  component={NewsStory}
  durationInFrames={300}
  fps={30}
  width={1080}
  height={1920}
  defaultProps={{
    backgroundImages: [
      {
        url: 'https://example.com/image.jpg',
        animation: 'zoom-in',
      },
    ],
    textSegments: [
      {
        text: 'Breaking News: Important announcement',
        startFrame: 30,
        durationInFrames: 90,
        animation: 'fade',
      },
      {
        text: 'More details about this story',
        startFrame: 130,
        durationInFrames: 90,
        animation: 'slide',
      },
    ],
    publishDate: '2024-03-15',
    tags: ['#News', '#Breaking', '#World'],
    copyright: '© 2024 Your Company. All rights reserved.',
  }}
/>

Story Factory (New!)

The story factory provides a fluent builder API for creating news stories with automatic validation.

Basic Usage

import { createStory } from './storiesFactory';

const story = createStory()
  .withBackgroundImage(
    'https://example.com/image.jpg',
    'zoom-in'
  )
  .withTextSegment('Breaking News', 30, 90, 'fade')
  .withTextSegment('More details', 130, 90, 'slide')
  .withPublishDate('2024-03-15')
  .withTags('#News', '#Breaking')
  .withCopyright('© 2024 News Agency')
  .build();

Benefits

  • Type-safe: Full TypeScript support
  • Validated: Automatic Zod validation
  • Readable: Clear, fluent API
  • Flexible: Easy to modify and extend

Multi-Story Videos (New!)

Combine multiple stories into one video with smooth transitions.

Usage

import { MultiStory } from './components/MultiStory';
import { createStory } from './storiesFactory';

const stories = [
  {
    story: createStory()
      .withBackgroundImage(url1, 'zoom-in')
      .withTextSegment('First story', 30, 180, 'fade')
      .withPublishDate('2024-03-15')
      .withTags('#News')
      .withCopyright('© 2024')
      .build(),
    durationInFrames: 240,
    transition: 'fade',
    transitionDuration: 20,
  },
  {
    story: createStory()
      .withBackgroundImage(url2, 'zoom-out')
      .withTextSegment('Second story', 30, 180, 'slide')
      .withPublishDate('2024-03-15')
      .withTags('#News')
      .withCopyright('© 2024')
      .build(),
    durationInFrames: 240,
    transition: 'slide-left',
    transitionDuration: 25,
  },
];

<MultiStory stories={stories} />

Transition Types

  • fade: Smooth fade in/out
  • slide-left: Slide from right to left
  • slide-right: Slide from left to right
  • zoom: Zoom in on entry, zoom out on exit
  • none: Instant cut (no transition)

Animation Options

Background Animations

  • zoom-in: Gradually zooms into the background image
  • zoom-out: Gradually zooms out from the background image
  • fade: Fades in and out
  • none: No animation

Text Animations

  • fade: Smooth fade in and out effect
  • slide: Slides in from bottom with spring animation
  • typing: Typewriter effect
  • none: No animation

Customization

Video Duration

The default video duration is 300 frames (10 seconds at 30 fps). You can adjust this in src/index.tsx:

durationInFrames={300}  // 10 seconds at 30 fps
fps={30}

Video Dimensions

The video is set to 1080x1920 (9:16 aspect ratio) for vertical stories:

width={1080}
height={1920}

Text Timing

Control when text appears and how long it stays on screen:

{
  text: 'Your text here',
  startFrame: 30,        // Appears at 1 second (30 frames / 30 fps)
  durationInFrames: 90,  // Stays for 3 seconds
  animation: 'fade',
}

Styling

You can customize the styling by modifying the components in src/components/NewsStory.tsx:

  • Text size, color, and font
  • Tag colors and styling
  • Date display format and position
  • Copyright text appearance
  • Background overlay gradients

Quote Module

The Quote Module is a complete solution for creating short quote videos. See QUOTE_MODULE.md for full documentation.

Quick Example

import { createQuote } from './quote';

const myQuote = createQuote()
  .withQuote('The only way to do great work is to love what you do.')
  .withAuthor('Steve Jobs')
  .withBackgroundImage('https://example.com/image.jpg', 'zoom-in')
  .withStories('Motivation', 'Success')
  .build();

Pre-built Quote Examples

The module includes 7 ready-to-use quotes:

  • Motivational Quote (Steve Jobs)
  • Wisdom Quote (Robert Frost)
  • Success Quote (Winston Churchill)
  • Inspiration Quote (Theodore Roosevelt)
  • Happiness Quote (Dalai Lama)
  • Simple Quote (Oscar Wilde)
  • Quote with Audio (Henry Wadsworth Longfellow)

All are available in the Remotion Studio when you run npm run dev.

Quote Module Features

  • Builder Pattern: Fluent API for creating quotes
  • Background Support: Both images and videos
  • Audio Support: Add background music
  • Animations: zoom-in, zoom-out, fade, pan
  • Automatic Duration: Calculates optimal video length
  • Stories/Tags: Add categories to quotes
  • Validation: Zod schema validation

For more details, see QUOTE_QUICKSTART.md.

Scripts

  • npm run dev - Start Remotion Studio for development
  • npm run build - Render video to MP4
  • npm run preview - Preview the video
  • npm run format - Format code with Prettier
  • npm run type-check - Check TypeScript types

GitHub Actions - Automated Video Generation

This repository includes GitHub Actions workflows that allow you to generate videos directly from GitHub without setting up a local environment.

Generate Video (Simple)

Workflow: .github/workflows/generate-video.yml

This workflow allows you to render any pre-configured composition with a simple click.

How to use:

  1. Go to the "Actions" tab in your GitHub repository
  2. Select "Generate Video" workflow
  3. Click "Run workflow"
  4. Choose your options:
    • Composition ID: Select from available compositions (NewsStory, BreakingNews, MotivationalQuote, etc.)
    • Output filename: Name for your video file (default: video.mp4)
    • Video quality: CRF value for quality (18 is default, lower = better quality)
  5. Click "Run workflow" button
  6. Wait for the workflow to complete (usually 1-3 minutes)
  7. Download the generated video from the workflow artifacts

Available Compositions:

  • NewsStory - Original news story template
  • BreakingNews - Breaking news with factory pattern
  • TechNews - Technology news story
  • SportsNews - Sports news story
  • MultiSegmentTest - Multi-segment news story
  • MultiStory - Multiple stories with transitions
  • QuickNews - Quick news compilation
  • MotivationalQuote - Motivational quote by Steve Jobs
  • WisdomQuote - Wisdom quote by Robert Frost
  • SuccessQuote - Success quote by Winston Churchill
  • InspirationQuote - Inspiration quote by Theodore Roosevelt
  • HappinessQuote - Happiness quote by Dalai Lama
  • SimpleQuote - Simple quote by Oscar Wilde
  • QuoteWithAudio - Quote with background audio

Generate Custom Video (Advanced)

Workflow: .github/workflows/generate-custom-video.yml

This workflow allows you to render videos with custom properties passed as JSON.

How to use:

  1. Go to the "Actions" tab in your GitHub repository
  2. Select "Generate Custom Video" workflow
  3. Click "Run workflow"
  4. Choose your options:
    • Composition type: news or quote
    • Custom props JSON: Provide custom properties (optional, see examples below)
    • Output filename: Name for your video file
    • Duration frames: Video duration in frames (300 = 10 seconds at 30fps)
  5. Click "Run workflow" button
  6. Wait for the workflow to complete
  7. Download the generated video from the workflow artifacts

Example Custom Props for News:

{
  "backgroundImages": [{"url": "https://example.com/image.jpg", "animation": "zoom-in"}],
  "textSegments": [{"text": "Your custom text", "startFrame": 30, "durationInFrames": 90, "animation": "fade"}],
  "publishDate": "2024-12-25",
  "tags": ["#Custom", "#News"],
  "copyright": "© 2024 Your Company"
}

Example Custom Props for Quote:

{
  "quote": "Your custom quote text here",
  "author": "Author Name",
  "backgroundImage": {"url": "https://example.com/bg.jpg", "animation": "zoom-in"},
  "stories": ["Inspiration", "Motivation"]
}

Benefits of GitHub Actions

  • No local setup required - Generate videos without installing dependencies
  • Cloud rendering - Uses GitHub's infrastructure for rendering
  • Version control - All video configurations are version controlled
  • Automated workflow - Integrate video generation into your CI/CD pipeline
  • Team collaboration - Anyone with repository access can generate videos
  • Artifact storage - Videos are automatically stored as workflow artifacts

Technology Stack

  • Remotion: Video creation framework
  • React: UI library
  • TypeScript: Type-safe development
  • Prettier: Code formatting

License

ISC

About

remotion template build with love

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%