npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ffcreatorlite-rootai

v1.0.2

Published

FFCreatorLite is a lightweight and flexible short video production library

Downloads

200

Readme

English | 简体中文

Overview

FFCreatorLite是一个基于node.js的轻量、灵活的短视频制作库。您只需要添加几张图片或视频片段再加一段背景音乐,就可以快速生成一个很酷的的视频短片。

今天,短视频已成为一种越来越流行的媒体传播形式。像微视和抖音这种 app,每天都会生产成千上万个精彩短视频。而这些视频也为产品带来了巨大的流量。 随之而来,如何让用户可以快速生产一个短视频;或者产品平台如何利用已有的图片、视频、音乐素材批量合成大量视频就成为一个技术难点。

FFCreatorLite是一种轻量又简单的解决方案,只需要很少的依赖和较低的机器配置就可以快速开始工作。并且它模拟实现了animate.css90%的动画效果,您可以轻松地把 web 页面端的动画效果转为视频。

FFCreatorLite基于著名的视频处理库FFmpeg开发, 并且对FFmpeg复杂繁琐的命令行参数进行拼接操作(这一点并不是那么容易), 利用FFmpeg各种滤镜和特性来实现动画和视频剪辑并生成最终影片。所以它的处理速度超乎你的想象, 甚至远快于FFCreator

更多介绍请查看这里

特性

  • 完全基于node.js开发,非常易于使用,并且易于扩展和开发。
  • 仅依赖FFmpeg、易于安装、跨平台,对机器配置要求较低。
  • 视频制作速度极快,一个 5 分钟的视频只需要不到 1 分钟。
  • 支持图片、声音、视频剪辑、文本等多种元素。
  • 支持对直播流加入音乐和动画再推出。
  • 视频处理能力极强, 可以对多个视频片段进行裁切、合成等操作。
  • 最新版本支持 30 多种场景过渡动画。
  • 包含animate.css70%的动画效果,可以将 css 动画转换为视频。

Demo

使用

Install npm Package

npm install ffcreatorlite --save

Note: To run the preceding commands, Node.js and npm must be installed.

Node.js

const { FFCreatorCenter, FFScene, FFImage, FFText, FFCreator } = require('ffcreatorlite');

// create creator instance
const creator = new FFCreator({
  cacheDir,
  outputDir,
  width: 600,
  height: 400,
  log: true,
});

// create FFScene
const scene1 = new FFScene();
const scene2 = new FFScene();
scene1.setBgColor('#ff0000');
scene2.setBgColor('#b33771');

// scene1
const fbg = new FFImage({ path: bg1 });
scene1.addChild(fbg);

const fimg1 = new FFImage({ path: img1, x: 300, y: 60 });
fimg1.addEffect('moveInRight', 1.5, 1.2);
scene1.addChild(fimg1);

const text = new FFText({ text: '这是第一屏', font, x: 100, y: 100 });
text.setColor('#ffffff');
text.setBackgroundColor('#000000');
text.addEffect('fadeIn', 1, 1);
scene1.addChild(text);

scene1.setDuration(8);
creator.addChild(scene1);

// scene2
const fbg2 = new FFImage({ path: bg2 });
scene2.addChild(fbg2);
// logo
const flogo = new FFImage({ path: logo, x: 100, y: 100 });
flogo.addEffect('moveInUpBack', 1.2, 0.3);
scene2.addChild(flogo);

scene2.setDuration(4);
creator.addChild(scene2);

creator.addAudio(audio);
creator.start();

creator.on('progress', e => {
  console.log(colors.yellow(`FFCreatorLite progress: ${(e.percent * 100) >> 0}%`));
});

creator.on('complete', e => {
  console.log(
    colors.magenta(`FFCreatorLite completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
  );
});

关于过渡动画

最新版本的ffcreatorlite已经支持场景过渡动画, 这意味着您可以像ffcreator一样用它制作炫酷效果。

当然您需要安装4.3.0以上版本的ffmpeg. 因为这里使用的是Xfade滤镜来实现的动画。

使用

// https://trac.ffmpeg.org/wiki/Xfade
scene.setTransition('diagtl', 1.5);

关于FFCreator

FFCreator并非是FFCreatorLite的加强版, 事实上这两者的实现原理完全不同。当您要大量处理视频同时又不需要特别酷炫的过渡动画时, FFCreatorLite也许是更好的选择。

实现原理区别

  • FFCreator使用opengl来处理图形渲染并使用shader后处理来生成转场效果,最后使用FFmpeg合成视频。
  • FFCreatorLite则完全使用FFmpeg滤镜等效果,拼接FFmpeg命令来生成动画和视频。

FFCreatorLite具备FFCreator70%的功能,但是某些情况下处理速度反而更快,并且安装异常简单。所以请您根据实际的使用情况,来选择具体使用哪个版本的库。

关于注册点的区别

FFCreatorLite的默认注册点是左上角且无法修改, 而FFCreator默认注册点是中心而且可以修改。

更详细的教程请查看这里

安装依赖

FFCreatorLite依赖于FFmpeg,因此您需要安装FFmpeg

FFCreatorLite 依赖于FFmpeg>=0.9以上版本。请设置 FFmpeg 为全局变量, 否则需要使用 setFFmpegPath 添加 FFmpeg 本机路径。(windows 用户的 ffmpeg 很可能不在您的%PATH中,因此您必须设置%FFMPEG_PATH)

FFCreator.setFFmpegPath('...');

当然您也可以在你的机器上编译 ffmpeg, 编译教程请看https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

安装教程

更多FFmpeg教程请查看https://trac.ffmpeg.org/wiki

贡献代码

非常欢迎您加入我们一起开发FFCreatorLite,如果想要贡献代码请先阅读这里

License

MIT