sonphoenix/laravel-video-tools 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sonphoenix/laravel-video-tools

Composer 安装命令:

composer require sonphoenix/laravel-video-tools

包简介

A Laravel package for video processing powered by FFmpeg

README 文档

README

A Laravel package for video processing powered by FFmpeg. It supports trimming, extracting audio, generating thumbnails, merging videos, resizing, and adding watermarks.

Installation

Install the package via Composer:

composer require sonphoenix/laravel-video-tools

Requirements

PHP 8.1 or higher

FFmpeg installed on your system

Laravel 9.x or higher

Usage/Examples

use SonPhoenix\VideoTools\Facades\VideoTools;

// Trim a video
VideoTools::trim('input.mp4', 'output.mp4', '0:01:30', '0:00:15');

// Extract a thumbnail
VideoTools::thumbnail('input.mp4', 'thumbnail.jpg', '0:00:05');

// Extract audio
VideoTools::extractAudio('input.mp4', 'output.mp3', 'mp3');

// Merge videos
VideoTools::merge(['video1.mp4', 'video2.mp4'], 'merged.mp4');

// Add watermark
VideoTools::addWatermark('input.mp4', 'output.mp4', 'watermark.png', 'bottom-right');

// Resize video
VideoTools::resize('input.mp4', 'output.mp4', 640, 480, true);

API Reference

trim or cut video

trim(input, output, start, duration)
Parameter Type Description
input string Path to input video
output string Path to save trimmed video
start string Start time (hh:mm:ss, mm:ss)
duration string Duration of clip (hh:mm:ss)

examples

VideoTools::trim('input.mp4', 'output.mp4', '0:01:30', '0:00:15');

get thumbnail from video

thumbnail(inputPath, outputPath, time)
Parameter Type Description
inputPath string Path to input video
outputPath string Path to save thumbnail
time string Time position (hh:mm:ss or seconds)

examples

VideoTools::thumbnail('input.mp4', 'thumbnail.jpg', '0:00:05');

get audio from video

extractAudio(input, output, format)
Parameter Type Description
inputPath string Path to input video
outputPath string Path to save thumbnail
time string Time position (hh:mm:ss or seconds)

examples

VideoTools::extractAudio('input.mp4', 'output.mp3', 'mp3');

add watermark to video

addWatermark(input, output, watermarkPath, position, x, y, width, height, opacity)
Parameter Type Description
input string Path to input video
output string Path to save watermarked video
watermarkPath string Path to watermark image
position string Position (top-left, top-right, bottom-left, bottom-right, center)
x int X offset in pixels
y int Y offset in pixels
width int Width to resize watermark (optional)
height int Height to resize watermark (optional)
opacity float Watermark opacity (0 = transparent, 1 = opaque)

examples

// Position watermark at bottom-right
VideoTools::addWatermark('input.mp4', 'output.mp4', 'watermark.png', 'bottom-right');

// Custom position and size
VideoTools::addWatermark(
    'input.mp4', 
    'output.mp4', 
    'watermark.png', 
    null, 
    50, 
    50, 
    100, 
    50, 
    0.7
);

merge or fusion a bunch of videos

merge(inputs, output)
Parameter Type Description
inputs array Array of input video paths
output string Path to save merged video

examples

VideoTools::merge(['video1.mp4', 'video2.mp4'], 'merged.mp4');

resize a video

resize(input, output, width, height, keepAspect)
Parameter Type Description
input string Path to input video
output string Path to save resized video
width int Target width
height int Target height
keepAspect bool Keep aspect ratio (true/false)

examples

VideoTools::resize('input.mp4', 'output.mp4', 1280, 720, true);

Authors

License

MIT

sonphoenix/laravel-video-tools 适用场景与选型建议

sonphoenix/laravel-video-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 sonphoenix/laravel-video-tools 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-18