承接 vimqu/php-sdk 相关项目开发

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

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

vimqu/php-sdk

Composer 安装命令:

composer require vimqu/php-sdk

包简介

Cloud Video Transcoding. Create HLS, Mpeg Dash, Thumbnails and AI Generated Subtitle from video files

README 文档

README

VimQu PHP-SDK

With this SDK you can change the container (mp4, mkv, mov, webm), codec (h264, h265, vp8, vp9, prores) and bitrate of video files. You can create Adaptive Bitrate videos. While doing this, you can resize, crop, clip operations on the video. You can create thumbnails from video file. Create subtitle files (WebVTT, SRT) in 94 languages (AI generated). Uploads the output files to the storage service of your choice.

Currently, VimQu is integrated with the following storage services:

  • AWS S3
  • Google Cloud Storage
  • Azure Storage
  • FTP
  • Any S3 Compatible Service like Vultr Object Storage, DigitalOcean Object Storage, Wasabi, Backblaze ...

See Full documentation.

Requirements

  • PHP 8.1+
  • VimQu Account. Create account
  • VimQu Token.
  • Storage Service (you have to save it in VimQu). You can create it in this page and you can find how to add storage in this page

Installation

composer require vimqu/php-sdk

Quick Start

To create a Task we need a TaskManager instance.

use Vimqu\Vimqu\Task\TaskManager;
use Vimqu\Vimqu\Outputs\VideoOutput;

$task = TaskManager::withToken('your_access_token')
    ->setInputFromStorage('your_storage_id', '/birds.mp4');
	// or
    ->setInputFromUrl('https://<your_file>.mp4');

$video = (new VideoOutput('h264', 'mp4'))
    ->setStorage('your_storage_id', '/outputs/videos')
    ->setReferenceId('your_reference_id')
    ->subtitle(true)
    ->resize(300, null)
    ->clip(2, duration: 45)
    ->crop(300, 300, 15, 15);

$task->addOutput($video);
$result = $task->send();

You can add more than one output. If there is no error, the result will be the Vimqu\Vimqu\Dto\TaskDto instance.

$status = $result->getStatus(); // the status will be "active".
$id = $result->getId(); 

We will send you a request (webhook) when the task is complete. However, you can get the task result at any time.

use Vimqu\Vimqu\Task\Search;

// This query will give you the "TaskDto" instance again.
$task = Search::withToken('xxxx xxxx')->getById($id);

Task

API Document

Create HLS

use Vimqu\Vimqu\Outputs\HlsOutput;

$hls = (new HlsOutput)
    ->setStorage('your_storage_id', '/outputs/hls')
    ->setReferenceId('your_reference_id')
    ->subtitle(true)
    ->clip(2, 45)
    ->crop(300, 300, 15, 15)
    ->overlayImage('https://your_overlay_image.png', 50, 50, 0, 20)
    ->addVariant('240p')
    ->addVariant('480p')
    ->addVariant('720p')
    ->addVariant('1080p');

// $task is instance of TaskManager, we created it before.
$task->addOutput($hls);
$task->send();
  • Available variants: 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p
  • Available filters: clip, crop, subtitle, overlayImage

Create Mpeg DASH

use Vimqu\Vimqu\Outputs\DashOutput;

$dash = (new DashOutput)
    ->setStorage('your_storage_id', '/outputs/dash')
    ->setReferenceId('your_reference_id')
    ->subtitle(true)
    ->clip(2, 45)
    ->crop(300, 300, 15, 15)
    ->addVariant('720p')
    ->addVariant('1080p');

$task->addOutput($dash);
$task->send();
  • Available variants: 240p, 360p 480p, 720p, 1080p, 1440p, 2160p
  • Available filters: clip, crop, subtitle, overlayImage

Create Video Output

use Vimqu\Vimqu\Outputs\VideoOutput;

$video = (new VideoOutput('h264', 'mp4'))
    ->setStorage('your_storage_id', '/outputs/videos')
    ->setReferenceId('your_reference_id')
    ->subtitle(true)
    ->resize(300, null)
    ->clip(2, duration: 45)
    ->crop(300, 300, 15, 15);

$task->addOutput($video);
$task->send();
  • Available containers: mp4, webm, mov, mkv
  • Available video codecs: h264, h265, vp8, vp9, prores
  • Available filters: resize, clip, crop, subtitle, overlayImage

Create Thumbnail with Exact Seconds

use Vimqu\Vimqu\Outputs\ThumbnailBySeconds;

$thumbnailBySeconds = (new ThumbnailBySeconds([4, 22, 400, 650]))
    ->setStorage('your_storage_id', '/outputs/thumbnails/seconds')
    ->setReferenceId('your_reference_id')
    ->resize(300, null);

$task->addOutput($thumbnailBySeconds);
$task->send();
  • Available containers: jpg, png, webp
  • Available filters: resize

Create Thumbnail with Number

use Vimqu\Vimqu\Outputs\ThumbnailByNumber;

$thumbnailByNumber = (new ThumbnailByNumber(5, 'jpg'))
    ->setStorage('your_storage_id', '/outputs/thumbnails/number')
    ->setReferenceId('your_reference_id')
    ->resize(300, 500, true);

$task->addOutput($thumbnailByNumber);
$task->send();
  • Available containers: jpg, png, webp
  • Available filters: resize

Create Thumbnail with Interval

use Vimqu\Vimqu\Outputs\ThumbnailByInterval;

$thumbnailByInterval = (new ThumbnailByInterval(10, 'png'))
    ->setStorage('your_storage_id', '/outputs/thumbnails/interval')
    ->setReferenceId('your_reference_id')
    ->resize(null, 150);

$task->addOutput($thumbnailByInterval);
$task->send();
  • Available containers: jpg, png, webp
  • Available filters: resize

Storage

You can fetch all storages. Details

use Vimqu\Vimqu\Storage;

$storages = Storage::withToken($token)->all();
// [
//    [
//         'name' => 'my_storage',
//         'id' => 'xxxx xxxx xxxx',
//         'driver' => 's3' // it can be ftp, gcs, azure
//    ]
// ]

Search Task

This method will get you all your tasks. The result is an array of TaskDto.

use Vimqu\Vimqu\Task\Search;

$tasks = Search::withToken($token)->search();

You can apply these filters:

$tasks = Search::withToken($token)->search(
	['hls', 'thumbnail', 'dash'],
	'your_reference_id',
	'completed'
);

Result of the Search (the TaskDto)

foreach($tasks as $task) {

    $taskStatus = $task->getStatus();
    $id = $task->getId();

    foreach($task->getOutputs() as $output) {

        $reference = $output->getReferenceId();

        foreach($output->getFiles() as $file){
            $filePath = $file->getPath();
        }
    }
}

Filters Reference

resize

You can use it to rescale the video.

Parameter Nullable Type Default Value
width YES int null
height YES int null
aspectRatio YES bool null

clip

You can create clips from any time in the video.

Parameter Nullable Type Default Value
from YES int null
duration YES int null
to YES bool null

overlayImage

You can use it to burn pictures on video.

Parameter Nullable Type Default Value
url YES int null
coordinateX YES int null
coordinateY YES int null
firstSecond YES int null
lastSecond YES int null

crop

You can cut the video at specific points.

Parameter Nullable Type Default Value
width NO int null
height NO int null
coordinate_x NO int null
coordinate_y NO int null

subtitle

You can use it to create a transcript. Your vtt and srt files will be in targetPath root directory. You gave this directory in the setStorage method.

Parameter Nullable Type Default Value
subtitle NO bool false

vimqu/php-sdk 适用场景与选型建议

vimqu/php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「thumbnail」 「transcoding」 「subtitle」 「dash」 「hls」 「video transcode」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 vimqu/php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vimqu/php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 vimqu/php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-30