WhoBuilt

Remotion and Animations in React Native

Jan 31, 2023· 49 min· 1.6K views·Watch on YouTube

Speaker

Jonny Burger, creator of Remotion, joins the React Native Show podcast from Callstack to explain how React code can generate video and compare animation approaches in React Native.

Remotion’s origins and core idea

Burger describes his work as a React Native developer and how the idea for Remotion came while he was making a promotional video for an app. Remotion uses the `useCurrentFrame` hook to expose a frame number to a React component, which can render different visuals for each frame. It uses the standard web React reconciler rather than a special video reconciler.

Programmatic video use cases

Remotion is useful for data-driven videos and generating many videos from a dataset or template. Burger gives examples including a cinema’s daily Instagram Story and stock tickers posted to Twitter. Developers can connect APIs and GitHub Actions to automate video creation and posting.

Rendering workflow and tradeoffs

A project starts with `npm init video`, then developers build a React component and preview it in a timeline editor. Remotion opens a headless browser, captures each frame as a screenshot, and uses FFmpeg to encode the images into an MP4; a 30-second video takes around 1,000 screenshots. Burger says audio was a frequently requested addition, and notes that Remotion suits React developers, while simple trimming or joining is easier in a tool like iMovie.

React Native animation tools

Burger contrasts Remotion, which can render frames slowly before encoding them into a video, with React Native, where animations need to run smoothly during app use. Animated can avoid React re-renders, while its native driver supports only some view properties. LayoutAnimation offers a simple way to animate layout changes, and Reanimated 2 lets developers write regular JavaScript worklets that run on another thread.

Choosing an animation workflow

Burger describes a range of options, from high-level libraries such as Moti to Reanimated, native APIs, and React Native Skia, with different levels of control and performance. Lottie uses predefined JSON animations created in tools such as After Effects, making designer handoff easier. Because Lottie animations are predefined, they cannot respond to runtime input such as gestures or scrolling.

Takeaways

  • Use Remotion when you need to generate many videos from data or a reusable template.
  • Automate video production by connecting Remotion to APIs and deployment workflows such as GitHub Actions.
  • Expect Remotion rendering to capture each frame in a headless browser before encoding it with FFmpeg.
  • Choose React Native animation tools based on the needed control, performance, and complexity.
  • Use Lottie when designers need to create complex predefined animations for developer handoff.

Mentioned in this talk

Search inside this talk

What was claimed 8

  • built
    “Jonny is the creator of Remotion”
    YouTube
    Unverified1 source· Talk
  • feature
    Remotion: Creates videos by rendering React components frame by frame
    “based on that frame number, you can render anything”
    YouTube
    Unverified1 source· Talk
  • feature
    Remotion: Can render data-driven and automatically generated batches of videos
    “render many videos from it”
    YouTube
    Unverified1 source· Talk
  • integrates with
    Remotion integrates with Lambda
    “We also have integrations for AWS Lambda”
    YouTube
    Unverified1 source· Talk
  • uses
    “we use FFmpeg to encode this series of images into an MP4”
    YouTube
    Unverified1 source· Talk
  • uses
    React Native animation functions inspired Remotion
    “the interpolate function and the spring function were copied straight from Reanimated”
    YouTube
    Unverified1 source· Talk
  • feature
    Reanimated: Runs animations on a different thread to improve performance
    “outsources these animations to a different thread”
    YouTube
    Unverified1 source· Talk
  • feature
    Lottie: Plays predefined animations expressed in JSON and cannot react to runtime user gestures
    “we can't make it react to user gestures or to a scroll view”
    YouTube
    Unverified1 source· Talk

Related talks

Remotion and Animations in React Native, Jonny Burger · WhoBuilt