GithubHelp home page GithubHelp logo

aloisdeniel / footage Goto Github PK

View Code? Open in Web Editor NEW
142.0 5.0 12.0 2.68 MB

Write videos in Flutter.

License: MIT License

Dart 61.78% Kotlin 0.10% Ruby 2.22% Swift 0.96% Objective-C 0.03% CMake 14.97% C++ 17.27% C 1.18% HTML 1.50%
flutter video

footage's Introduction

logo

Use your Flutter knowledge to generate videos, animations and slideshows!

Automate your video production with server-side rendering.

preview editor

Footage is still in early stage! Use it at your own risks, and APIs are subject to change.

Quickstart

Install footage with pub.

dart pub global activate footage

Create a directory for your project, like my_video, and from this directory, run the footage init command.

mkdir my_video
cd my_video
footage init

This will initialize a flutter project, with footage default pre-configured template.

To start the preview mode, simply run the lib/main.dart like any regular Flutter app.

flutter run lib/main.dart -d macOS

Code your animations

Composition

The composition root object describes your video general properties.

Composition(
    fps: 30,
    duration: const Time.frames(90),
    width: 1920,
    height: 1080,
    child: const MyScene(),
);

Current frame and configuration

Any Composition descendant can then access the current frame and video properties through the context.video extension.

@override
Widget build(BuildContext context) {
    final frame = context.video.currentFrame;
    final fps = context.video.config.fps;
    final videoWidth = context.video.config.width;
    // ...
}

Sequence

Sequences are small sections in finite time that make up your video clip. By using a sequence, you can time-shift the animations of your children.

Sequence(
    name: 'Circle', // For preview editor
    from: Time.frames(10),
    duration: Time.frames(20),
    child: Builder(
        builder: (context) {
            final frame = context.video.frame; // From 0 to 20 (since sequence starts at 10 and ends at 30)
            // ...
        },
    ),
);

Loop

Repeats all children animations during the given duration.

Loop(
    name: 'Repeated circles', // For preview editor
    duration: Time.frames(20),
    child: Builder(
        builder: (context) {
            final frame = context.video.frame; // From 0 to 20, every 20 frames
            // ...
        },
    ),
);

Render your video

As png frames

Form your project directory, run the

footage render

You will find the output frame images in your build/video/frames.

Under the hood, the rendering process uses flutter_test to render each frame as an individual image, thanks to golden tests. This allows rendering without the need to run the app.

As a video

To render a video you first need to install ffmpeg command line tool.

Basic

Bring a -f format option to the render command.

They are simply shorcuts for ffmpeg commands :

  • webm : ffmpeg -i build/video/frames/%d.png -pix_fmt yuva420p -filter:v fps=<fps> build/video/out.webm
footage render -f webm

The resulting video is build/video/out.webm.

Advanced

Use the ffmpeg tool from your frame files.

footage render
ffmpeg -i build/video/frames/%d.png -pix_fmt yuva420p -filter:v fps=30 build/video/out.webm

Examples

Basic

screenshot

Hello Waves

screenshot

Slidedeck

screenshot

Roadmap

  • Asset management when rendering
  • Asynchronous frame rendering
  • More default ffmpeg video rendering options
  • Embeddable player for Flutter apps
  • Audio support
  • Preview speed (x0.25, x0.5, x2)
  • Slideshow preview mode for presentation
  • More examples
  • Website

Thanks

Massive thanks to the Remotion project which inspired me a lot of concepts.

footage's People

Contributors

aloisdeniel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

footage's Issues

not an issue,

Very good library, I hope you continue to develop this library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.