FFCreator

repository·master·Indexed 25 days ago

https://github.com/tnfe/ffcreator

A lightweight and flexible Node.js library for programmatically creating short videos. FFCreator allows developers to assemble images, text, video clips, and audio into dynamic video albums using CSS-like animation effects. It includes specialized classes such as FFScene, FFImage, FFText, FFVideo, FFAlbum, FFSubtitle, and FFVtuber to manage video elements and transitions.

Tokens
33K
Snippets
85
Records
231
Agent score
84%

What's inside ffcreator

  1. Overview of FFCreator

    master
    FFCreator is a lightweight and flexible short video processing library built on Node.js. It allows developers to quickly create video albums by combining pictures, music, video clips, and text. It is designed to simulate web-based animation effects (similar to animate.css) and convert them into video files. It is particularly useful for automated batch video synthesis, building visualization platforms, or powering video album applications.
  2. Compare FFCreator and FFCreatorLite

    master

    Choose between FFCreator and FFCreatorLite based on your animation and performance requirements:

    • FFCreator: Best for high-quality, complex animations. It uses opengl and shader for fine-grained rendering and supports nearly a hundred transition effects, subtitles, and photo albums. It has more complex installation dependencies (e.g., cairo, libjpeg, g++).
    • FFCreatorLite: Best for high-speed video processing and simple dynamic photo albums. It is built entirely on FFmpeg command splicing, making it 2-3 times faster than FFCreator. It supports pictures, videos, text, and background music with animate.css style animations, but lacks complex transition effects, subtitles, and photo albums. It only requires FFmpeg as a dependency.

    Key Technical Differences:

    • Registration Point: FFCreatorLite uses the upper-left corner (fixed); FFCreator uses the center (customizable).
    • Fonts: In FFCreatorLite, FFText must be provided with a font file path; in FFCreator, it is not required.
  3. Key features of FFCreator

    master

    FFCreator provides the following capabilities:

    • Node.js based: Easy to use, extend, and develop.
    • Low overhead: Minimal dependencies and low machine configuration requirements.
    • High speed: Can produce a 5-minute video in approximately 1-2 minutes.
    • Rich animations: Supports nearly 100 types of transition effects and 90% of animate.css animations.
    • Element support: Supports images, audio, video clips, and text.
    • Advanced components: Includes subtitle components (can be combined with TTS for news synthesis) and simple, extensible virtual anchors.
    • Lite Version: FFCreatorLite is available for even faster synthesis speeds.
  4. Compare FFCreator with alternative video rendering solutions

    master

    When choosing a video rendering solution, consider the following comparison between FFCreator, aerender.exe (After Effects), and MLT Framework:

    FFCreator

    FFCreator uses opengl for graphics rendering and shader post-processing for transition effects, with FFmpeg for final video synthesis. For simpler requirements with fewer dependencies and faster processing, use FFCreatorLite.

    • Pros: Cross-platform (Linux and Windows); extremely fast synthesis (e.g., a 5-7 minute video in ~1.5 minutes); low barrier to entry for frontend engineers via node.js; supports both template-based and dynamic, data-driven animation composition.
    • Cons: Lacks the professional visual effects/plugins of After Effects; lacks a visual GUI for template creation (requires coding).

    aerender.exe (After Effects Automation)

    An automated rendering solution based on Adobe After Effects templates.

    • Pros: High customization; rich commercial templates; access to professional AE effects and plugins.
    • Cons: Windows-only (aerender.exe), making it incompatible with Linux-based DevOps workflows; slow rendering speeds (3-5x slower than FFCreator); limited to fixed templates and cannot support dynamic, non-customized video assembly.

    MLT (Multimedia Framework)

    An open-source multimedia framework designed for broadcast television.

    • Pros: Supports command-line calls; encapsulates libraries like FFmpeg, JACK, Movit, SOX, and libvorbis; supports template-based video generation.
    • Cons: High complexity for template creation (AE effects must be converted to MLT XML format); slower processing than FFCreator; steep learning curve and complex installation/setup; heavy for small-to-medium projects.
  5. FFCreator architecture and principles

    master

    Unlike traditional methods that rely solely on FFmpeg (which is difficult to use for fine-grained animations) or After Effects (which can be heavy and complex), FFCreator uses a hybrid approach:

    1. Graphics Rendering: Uses opengl for high-efficiency graphics and animation.
    2. Post-processing: Uses shader for generating transition effects.
    3. Video Synthesis: Uses FFmpeg to compile the final video output.
  6. Compare FFCreator with other video rendering solutions

    master

    When choosing a video production technology, consider the following comparison between FFCreator and other common methods:

    FFCreator

    • Mechanism: Uses opengl for graphics rendering and shader post-processing for transitions, with FFmpeg for final video synthesis.
    • Pros: Cross-platform (Linux and Windows), high synthesis speed (e.g., a 5-7 minute video in ~1.5 minutes), low barrier to entry for Node.js/frontend engineers, and supports dynamic animation combinations based on real-time data.
    • Cons: Lacks a visual interface (like AE or PR) for template creation and does not have the massive library of professional special effect plugins found in dedicated video software.
    • Note: For simpler requirements with fewer dependencies and even faster speeds, use FFCreatorLite.

    aerender.exe (After Effects based)

    • Mechanism: Uses Adobe After Effects' aerender.exe for automated batch processing of templates.
    • Pros: Extremely high customization and professional quality due to AE's rich plugin ecosystem and designer-friendly templates.
    • Cons: Windows-only (cannot run on Linux servers), slower rendering speed (3-5x slower than FFCreator), and limited to fixed templates.

    MLT (MLT Multimedia Framework)

    • Mechanism: An open-source multimedia framework using XML editing components and extensible plugins.
    • Pros: Supports command-line calls and encapsulates libraries like FFmpeg, JACK, Movit, SOX, and libvorbis.
    • Cons: Complex template production (AE templates must be converted to MLT XML), slower processing than FFCreator, and a steeper learning curve with complex installation/build processes.
  7. Create data visualization videos with FFChart

    master

    FFCreator 6.0 introduces the FFChart component, which supports most echarts.js demos. This allows you to create high-quality data visualization videos.

    Note: To ensure stability, FFCreator uses echarts.js version v5.1.2. Because video rendering differs from web rendering, you should manually adjust margins, font sizes, and other layout options to achieve the best visual result.

  8. Create a video animation template with FFCreatorCenter

    master

    Use FFCreatorCenter.createTemplate to define a reusable video animation template. This is typically done once in a service layer. The callback provides an object (e.g., containing an image path) that you use to instantiate FFCreator, FFScene, and other elements like FFImage with specific effects and animations.

    // This can be implemented in a service and executed once
    FFCreatorCenter.createTemplate(tempid, ({ image }) => {
        const creator = new FFCreator({...});
        const scene = new FFScene();
        scene.setBgColor('#b33771');
        creator.addChild(scene);
    
        const fimg = new FFImage({ path: image, x: 100, y: 200 });
        fimg.addEffect('fadeInLeft', 1, 1); 
        scene.addChild(fimg);
        // Add more elements and animations...
        
        creator.start();
        return creator;
    });
  9. Run FFCreator on headless Linux servers

    master

    If your server does not have a display device (no GPU/monitor attached), you must use xvfb-run to simulate a display environment for WebGL to work. Use the following command to start your application:

    xvfb-run -s "-ac -screen 0 1280x1024x24" npm start
  10. Build a video album mini-program using FFCreator and Lottie

    master

    You can use FFCreator's Lottie rendering capabilities to build video album mini-programs (similar to popular apps like 'Xiao Nian Gao'). This workflow allows you to convert animated designs into high-speed server-side video synthesis.

    Workflow Steps:

    1. Design: Create album templates using Adobe After Effects (AE).
    2. Export: Use the Bodymovin plugin to export your AE animations as Lottie JSON data files.
    3. Prepare Assets: Identify which images in the Lottie files need to be replaced (using FFCreator's image replacement method), number the Lottie files, and upload them to your server.
    4. Backend Setup: Build a Node.js server to handle user image uploads, template selection, and work browsing.
    5. Video Synthesis: Use FFCreator to perform the synthesis by replacing placeholders in the Lottie files with user-provided images and adding background music. FFCreator is optimized for high-speed synthesis.