|
| 1 | +[English](./README.md) | [简体中文](./README.zh-CN.md) |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <img src="https://tnfe.github.io/FFCreator/_media/logo/logo2.png" /> |
| 5 | +</p> |
| 6 | + |
| 7 | +<div align="center"> |
| 8 | +<a href="https://www.npmjs.com/ffcreatorlite" target="_blank"><img src="https://img.shields.io/npm/v/ffcreatorlite.svg" alt="NPM Version" /></a> |
| 9 | +<a href="https://www.npmjs.com/ffcreatorlite" target="_blank"><img src="https://img.shields.io/npm/l/ffcreatorlite.svg" alt="Package License" /></a> |
| 10 | +<a href="https://travis-ci.org/github/tnfe/FFCreatorLite" target="_blank"><img src="https://travis-ci.org/tnfe/FFCreatorLite.svg?branch=master" alt="Travis CI" /></a> |
| 11 | +<a href="https://github.com/prettier/prettier" target="_blank"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" alt="Code Style"></a> |
| 12 | +<a href="https://github.com/tnfe/FFCreatorLite/pulls" target="_blank"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs"/></a> |
| 13 | +<a href="https://nodejs.org" target="_blank"><img src="https://img.shields.io/badge/node-%3E%3D%208.0.0-brightgreen.svg" alt="Node Version" /></a> |
| 14 | +</div> |
| 15 | + |
| 16 | +## Overview |
| 17 | + |
| 18 | +FFCreatorLite is a lightweight and flexible short video processing library based on <a href="http://nodejs.org" target="_blank">Node.js</a>. You only need to add some pictures, music or video clips, you can use it to quickly create a very exciting video album. |
| 19 | + |
| 20 | +Nowadays, short video is an increasingly popular form of media communication. Like [_weishi_](https://weishi.qq.com/) and _tiktok_ is full of all kinds of wonderful short videos. So how to make users visually create video clips on the web easily and quickly. Or based on pictures Text content, dynamic batch generation of short videos is a technical problem. |
| 21 | + |
| 22 | +`FFCreatorLite` is developed based on the famous video processing library `FFmpeg`, and splicing the complicated and tedious command line parameters of `FFmpeg` (this is not so easy), using `FFmpeg` various filters and features to realize animation And video clips and generate the final movie. So its processing speed is beyond your imagination, even faster than [`FFCreator`](https://github.com/tnfe/FFCreator). |
| 23 | + |
| 24 | +#### For more introduction, please see [here](https://tnfe.github.io/FFCreator/#/guide/lite) |
| 25 | + |
| 26 | +### Features |
| 27 | + |
| 28 | +- Based on node.js development, it is very simple to use and easy to expand and develop. |
| 29 | +- Only rely on `FFmpeg`, easy to install, cross-platform, and low requirements for machine configuration. |
| 30 | +- The video processing speed is extremely fast, a 5-7 minute video only takes 1 minute. |
| 31 | +- Supports multiple elements such as pictures, sounds, video clips, and text. |
| 32 | +- Contains 70% animation effects of ʻanimate.css`, which can convert css animation to video. |
| 33 | + |
| 34 | +## Useage |
| 35 | + |
| 36 | +### Install npm Package |
| 37 | + |
| 38 | +```javascript |
| 39 | +npm install ffcreatorlite --save |
| 40 | +``` |
| 41 | + |
| 42 | +Note: To run the preceding commands, Node.js and npm must be installed. |
| 43 | + |
| 44 | +#### Node.js |
| 45 | + |
| 46 | +```javascript |
| 47 | +const {FFCreatorCenter, FFScene, FFImage, FFText, FFCreator} = require('ffcreatorlite'); |
| 48 | + |
| 49 | +// create creator instance |
| 50 | +const creator = new FFCreator({ |
| 51 | + cacheDir, |
| 52 | + outputDir, |
| 53 | + width: 600, |
| 54 | + height: 400, |
| 55 | + log: true, |
| 56 | +}); |
| 57 | + |
| 58 | +// create FFScene |
| 59 | +const scene1 = new FFScene(); |
| 60 | +const scene2 = new FFScene(); |
| 61 | +scene1.setBgColor('#ff0000'); |
| 62 | +scene2.setBgColor('#b33771'); |
| 63 | + |
| 64 | +// scene1 |
| 65 | +const fbg = new FFImage({path: bg1}); |
| 66 | +scene1.addChild(fbg); |
| 67 | + |
| 68 | +const fimg1 = new FFImage({path: img1, x: 300, y: 60}); |
| 69 | +fimg1.addEffect('moveInRight', 1.5, 1.2); |
| 70 | +scene1.addChild(fimg1); |
| 71 | + |
| 72 | +const text = new FFText({text: '这是第一屏', font, x: 100, y: 100}); |
| 73 | +text.setColor('#ffffff'); |
| 74 | +text.setBackgroundColor('#000000'); |
| 75 | +text.addEffect('fadeIn', 1, 1); |
| 76 | +scene1.addChild(text); |
| 77 | + |
| 78 | +scene1.setDuration(8); |
| 79 | +creator.addChild(scene1); |
| 80 | + |
| 81 | +// scene2 |
| 82 | +const fbg2 = new FFImage({path: bg2}); |
| 83 | +scene2.addChild(fbg2); |
| 84 | +// logo |
| 85 | +const flogo = new FFImage({path: logo, x: 100, y: 100}); |
| 86 | +flogo.addEffect('moveInUpBack', 1.2, 0.3); |
| 87 | +scene2.addChild(flogo); |
| 88 | + |
| 89 | +scene2.setDuration(4); |
| 90 | +creator.addChild(scene2); |
| 91 | + |
| 92 | +creator.addAudio(audio); |
| 93 | +creator.start(); |
| 94 | + |
| 95 | +creator.on('progress', e => { |
| 96 | + console.log(colors.yellow(`FFCreatorLite progress: ${(e.percent * 100) >> 0}%`)); |
| 97 | +}); |
| 98 | + |
| 99 | +creator.on('complete', e => { |
| 100 | + console.log( |
| 101 | + colors.magenta(`FFCreatorLite completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `), |
| 102 | + ); |
| 103 | +}); |
| 104 | +``` |
| 105 | + |
| 106 | +## About `FFCreator` |
| 107 | + |
| 108 | +[`FFCreator`](https://github.com/tnfe/FFCreator) is not an enhanced version of `FFCreatorLite`, in fact the two implementation principles are completely different. When you need to process a lot of video without special cool transition animation, `FFCreatorLite` may be a better choice. |
| 109 | + |
| 110 | +#### Principle difference |
| 111 | +- `FFCreator` uses `opengl` to process graphics rendering and `shader` post-processing to generate transition effects, and finally uses `FFmpeg` to synthesize the video. |
| 112 | +- `FFCreatorLite` completely uses `FFmpeg` filters and other effects, splicing `FFmpeg` commands to generate animations and videos. |
| 113 | + |
| 114 | +`FFCreatorLite` has 70% of the functions of [`FFCreator`](https://github.com/tnfe/FFCreator), but in some cases the processing speed is faster and the installation is extremely simple. So please choose which version of the library to use according to the actual usage. |
| 115 | + |
| 116 | +#### The difference between registration points |
| 117 | + |
| 118 | +The default registration point of `FFCreatorLite` is the upper left corner and cannot be modified, while the default registration point of `FFCreator` is the center and can be modified. |
| 119 | + |
| 120 | +#### For a more detailed tutorial, please check [here](https://tnfe.github.io/FFCreator/#/guide/lite) |
| 121 | + |
| 122 | +## Installation |
| 123 | + |
| 124 | +#### Since `FFCreatorLite` only depends on `FFmpeg`, you need to install the regular version of `FFmpeg` |
| 125 | + |
| 126 | +- How to Install and Use FFmpeg on CentOS [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-7/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-7/) |
| 127 | +- How to Install FFmpeg on Debian [https://linuxize.com/post/how-to-install-ffmpeg-on-debian-9/](https://linuxize.com/post/how-to-install-ffmpeg-on-debian-9/) |
| 128 | +- How to Install FFmpeg on Windows [http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/](http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/) |
| 129 | +- How to Install FFmpeg on Mac OSX [https://trac.ffmpeg.org/wiki/CompilationGuide/macOS](https://trac.ffmpeg.org/wiki/CompilationGuide/macOS) |
| 130 | + |
| 131 | +## Contribute |
| 132 | + |
| 133 | +You are very welcome to join us in developing `FFCreatorLite`, if you want to contribute code, please read [here](./CONTRIBUTING.md). |
| 134 | + |
| 135 | +## License |
| 136 | + |
| 137 | +[MIT](./LICENSE) |
0 commit comments