Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
ffcreator
Advanced tools
FFCreator is a lightweight and flexible short video production library based on Node.js. You only need to add some pictures, music or video clips, you can use it to quickly create a very exciting video album.
Nowadays, short video is an increasingly popular form of media communication. Like weishi 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.
We know that most video processing is often inseparable from ffmpeg, but pure ffmpeg is not so easy to use and convenient in terms of fine animation effects. It is different from the fixed template of After Effects
(aerender.exe
depends on the windos server) to generate video. FFCreator uses ffmpeg, headless-webgl and other technologies, which can support various animation effects very flexibly, such as 100% Restore the animation effect of animate.css, you can easily realize various animations on the web side
npm install ffcreator --save
Note: To run the preceding commands, Node.js and npm must be installed.
const { FFScene, FFText, FFVideo, FFAlbum, FFImage, FFCreator } = require("ffcreator");
// Create FFCreator instance
const creator = new FFCreator({
outputDir,
width: 800,
height: 450
});
// Create scene
const scene = new FFScene();
scene.setBgColor("#ffcc22");
scene.setDuration(6);
scene.setTransition("GridFlip", 2);
creator.addChild(scene);
// Create Image and add animation effect
const image = new FFImage({ path: path.join(__dirname, "../assets/01.jpg") });
image.addEffect("moveInUp", 1, 1);
image.addEffect("fadeOutDown", 1, 4);
scene.addChild(image);
// Create Text
const text = new FFText({ text: "hello 你好", x: 400, y: 300 });
text.setColor("#ffffff");
text.setBackgroundColor("#000000");
text.addEffect("fadeIn", 1, 1);
scene.addChild(text);
// Create a multi-photo Album
const album = new FFAlbum({ list: [p1, p2, p3], x: 10, y: 10, width: 600, height: 300 });
album.setTransition("random");
album.setDuration(1.5);
scene.addChild(album);
// Create Video
const video = new FFVideo({ path: mini, x: 300, y: 50, width: 300, height: 200, resetXY: true });
video.addEffect("zoomIn", 1, 0);
scene.addChild(video);
creator.output(path.join(__dirname, "../output/example.mp4"););
creator.start();
// Add ffcreator event handler
creator.on("start", () => {
console.log(`[FFCreator] ${id} start`);
});
creator.on("error", err => {
console.log(`[FFCreator] ${id} error: ${err}`);
});
creator.on("complete", () => {
console.log(`[FFCreator] ${id} complete`);
});
Sound is the soul of a video. FFCreator supports multiple ways to add audio. You can not only add global background music, but also set your own voice or soundtrack for each individual scene.
const video = new FFVideo({ path, x: 100, y: 150, width: 500, height: 350 });
video.setTimes("00:00:18", "00:00:33");
video.setAudio(true); // Turn on
const creator = new FFCreator({
cacheDir,
outputDir,
audio: path // background audio
});
// or
creator.addAudio({ path, loop, start });
scene.addAudio(path);
// or
scene.addAudio({ path, loop, start });
node-webgl
sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++
sudo yum install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel
FFmpeg
, you need to install a regular version of FFmpeg
Xvfb is a lightweight X11 server which provides a back buffer for displaying X11 application offscreen and reading back the pixels which were drawn offscreen. It is typically used in Continuous Integration systems. It can be installed on CentOS with yum install -y Xvfb, and comes preinstalled on Ubuntu.
Mesa is the reference open source software implementation of OpenGL. It can be installed on CentOS with yum install -y mesa-dri-drivers, or apt-get install libgl1-mesa-dev. Since a cloud Linux instance will typically run on a machine that does not have a GPU, a software implementation of OpenGL will be required.
yum install -y mesa-dri-drivers
// or apt-get install libgl1-mesa-dev
yum install -y Xvfb
yum install -y libXi-devel libXinerama-devel libX11-devel
xvfb-run
script command to start the program to use webgl under the Linux serverxvfb-run more detailed command parameters http://manpages.ubuntu.com/manpages/xenial/man1/xvfb-run.1.html
xvfb-run -s "-ac -screen 0 1280x1024x24" npm start
No package 'xi'
foundgyp: Call to 'pkg-config --libs-only-l x11 xi xext' returned exit status 1 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
yum install libXi-devel libXinerama-devel libX11-devel
doesn't support WebGL....
The node app should be started as follows.
xvfb-run -s "-ac -screen 0 1280x1024x24" npm start
FAQs
FFCreator is a lightweight and flexible short video production library
The npm package ffcreator receives a total of 510 weekly downloads. As such, ffcreator popularity was classified as not popular.
We found that ffcreator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.