承接 madbob/silly-videos 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

madbob/silly-videos

最新稳定版本:0.1.1

Composer 安装命令:

composer require madbob/silly-videos

包简介

Generates videos with texts from a custom configuration

README 文档

README

Silly Videos is a PHP library used to obtain videos starting from a JSON configuration describing simple elements like texts and images.

It generates the required frames, one by one, and collect them into a video using ffmpeg.

This project has been initially implemented to generate social contents (like: YouTube and Instagram) for TrendingOnWiki.

Install

composer require madbob/silly-videos

It is required the PHP gd extension and, of course, ffmpeg.

Usage

use MadBob\SillyVideos\SillyVideos;

// Use by JSON configuration file
SillyVideos::runFromFile($file, '/tmp/out.mp4');

// Use by in memory (eventually, dynamically generated) configuration
SillyVideos::run($config, '/tmp/out.mp4');

// Multi-process modes: forks multiple times to parallelize frames generation
SillyVideos::runFromFile($file, '/tmp/out.mp4', 4);
SillyVideos::run($config, '/tmp/out.mp4', 4);

Configuration

{
    "width": "300",
    "height": "300",
    "framerate": 30,
    "duration": 10,
    "background": "FFF",

    "elements": [
        {
            "type": "text",
            "text": "Test Text",
            "fontfile": "/path/to/your/font.ttf"

            "actions": [
                {
                    "duration": 3,
                    "delay": 0,

                    "start": {
                        "size": 30,
                        "x": 150,
                        "y": 400
                    },
                    "end": {
                        "y": 150
                    }
                },
                {
                    "duration": 3,
                    "delay": 3,

                    "start": {
                        "size": 30,
                        "x": 150,
                        "y": 150
                    },
                    "end": {
                        "size": 50,
                    }
                },
                {
                    "duration": 3,
                    "delay": 6,

                    "start": {
                        "rotate": 0,
                        "x": 150,
                        "y": 150
                    },
                    "end": {
                        "rotate": 360
                    }
                }
            ]
        }
    ]
}

License

This code is free software, licensed under the MIT License. See the LICENSE.txt file for more details.

Copyright (C) 2024 Roberto Guido info@madbob.org

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-21