FFCreatorは、ノードに基づいて軽量で柔軟な短いビデオ処理ライブラリです.js

24366 ワード

English | 简体中文







概要


FFCreatorは、軽量で柔軟な短いビデオ処理ライブラリNode.js . あなたは、いくつかの写真、音楽やビデオクリップを追加する必要があります、あなたはすぐに非常にエキサイティングなビデオアルバムを作成するためにそれを使用することができます.
近頃、短いビデオはメディアコミュニケーションのますます人気のある形です.ライクweishi Tiktokは素晴らしい短いビデオのすべての種類の完全です.それで、ユーザーを視覚的に簡単に、そして、速くウェブ上でビデオクリップを作成させる方法.または写真のテキストコンテンツに基づいて、短いビデオの動的なバッチ生成は、技術的な問題です.FFCreator いくつかの依存関係と低マシン構成を迅速に動作を開始する必要が軽量で柔軟なソリューションです.そしてそれは90 %のアニメーション効果をシミュレート animate.css . 簡単に動画にWebページ側にアニメーション効果を変換することができます.
ときに特別なクールな移行アニメーションなしで多くのビデオを処理する必要があります.FFCreatorLite より良い選択ですhere 詳細は

より多くの導入のために


機能

  • に基づいてnode.js 開発は、それを使用して簡単に展開し、開発は簡単です.
  • 非常にいくつかの依存関係は、簡単にインストールするには、クロスプラットフォームは、一般的な設定Linuxサーバーです.
  • ビデオ処理速度は非常に高速です、5分のビデオだけ1 - 2分が必要です.
  • ほぼ100種類のシーン遷移アニメーション効果.
  • サポート画像、サウンド、ビデオクリップ、テキストやその他の要素.
  • が含まれます animate.css , CSSアニメーションはビデオに変換されます.
  • サポート字幕のコンポーネントは、オーディオのニュースを生成する字幕を音声に結合することができます.
  • 簡単にサポートするVTuber , を追加することができますYouTuber シーケンスフレームに基づきます.
  • FFCreatorLite 速度が速いので、時にはそれよりもあなたに適していますFFCreator .
  • デモ







    用途


    パッケージのインストール


    npm install ffcreator --save
    
    注意:前のコマンド、ノードを実行します.JSとNPMをインストールしなければなりません.

    ノード。js


    const { FFScene, FFText, FFVideo, FFAlbum, FFImage, FFCreator } = require("ffcreator");
    
    // Create FFCreator instance
    const creator = new FFCreator({
        cacheDir,
        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: [img1, img2, img3, img4],   // Picture collection for album
        x: 250,
        y: 300,
        width: 500,
        height: 300,
    });
    album.setTransition('zoomIn');      // Set album switching animation
    album.setDuration(2.5);             // Set the stay time of a single sheet
    album.setTransTime(1.5);            // Set the duration of a single animation
    scene.addChild(album);
    
    // Create Video
    const video = new FFVideo({ path, x: 300, y: 50, width: 300, height: 200 });
    video.addEffect("zoomIn", 1, 0);
    scene.addChild(video);
    
    creator.output(path.join(__dirname, "../output/example.mp4"););
    creator.start();        // Start processing
    creator.closeLog();     // Close log (including perf)
    
    creator.on('start', () => {
        console.log(`FFCreator start`);
    });
    creator.on('error', e => {
        console.log(`FFCreator error: ${JSON.stringify(e)}`);
    });
    creator.on('progress', e => {
        console.log(colors.yellow(`FFCreator progress: ${e.state} ${(e.percent * 100) >> 0}%`));
    });
    creator.on('complete', e => {
        console.log(colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `));
    });
    

    より詳細なチュートリアルでは


    オーディオについて


    音は、ビデオの魂です.FFCreatorは、オーディオを追加する複数の方法をサポートしています.あなただけのグローバルバックグラウンドミュージックを追加することはできませんが、また、個々のシーンの独自の声やサウンドトラックを設定します.
  • FFVideoで-ビデオバックグラウンドミュージックをオンにします.
  • 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});
    

    インストール


    & dquot ;ノード& gt ;をインストールします


    If it is a computer with a display device, such as a personal pc computer with windows, Mac OSX system, or a server server with a graphics card or display device, you can skip this step without installing this dependency.

    あなたが使っているならばCentos , Redhat , Fedora システムを使用することができますyum インストールする.
    sudo yum install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel
    
    インストール Xvfb and Mesa
    sudo yum install mesa-dri-drivers Xvfb libXi-devel libXinerama-devel libX11-devel
    
    あなたが使っているならばDebian , 張宇文system, you can use ʻapt インストールする.
    sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++
    sudo apt-get install libgl1-mesa-dev xvfb libxi-dev libx11-dev
    

    FFCreator ffffpegに依存するので、ffmpegの正規版をインストールする必要があります

  • Fonmpegをインストールして、使う方法https://linuxize.com/post/how-to-install-ffmpeg-on-centos-7/
  • DebianにDebianをインストールする方法https://linuxize.com/post/how-to-install-ffmpeg-on-debian-9/
  • より詳細なチュートリアルでは


    起動する


    If it is a computer with a display device, such as a personal pc computer or a server server with a graphics card or display device, start normally npm start


    さもなければ、Linuxサーバの下でWebGLを使用するプログラムを起動するために、xvfb run scriptコマンドを使わなければなりません


    xvfb詳細なコマンドパラメータを実行する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....
  • 解決策


    ノードのアプリは次のように開始する必要があります.
    xvfb-run -s "-ac -screen 0 1280x1024x24" npm start
    
  • インストールエラーERR! command sh -c node-pre-gyp install --fallback-to-build
  • 解決策


    それはあなたのノードバージョンに起因するかもしれません.NODEV 15ならば、この問題があります.https://github.com/Automattic/node-canvas/issues/1645 . ノードV 14にダウングレードしてください.

    貢献する


    あなたは、我々が開発に加わるのをとても歓迎しますFFCreator , コードを投稿したい場合はhere .

    許可


    MIT