定制 emgag/video-thumbnail-sprite 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

emgag/video-thumbnail-sprite

最新稳定版本:v1.0.3

Composer 安装命令:

composer require emgag/video-thumbnail-sprite

包简介

PHP library for generating video thumbnail sprites

README 文档

README

Software License Packagist Version

WARNING: This library is no longer maintained /WARNING

PHP library for generating video thumbnail sprites to be used for thumbnails in JWPlayer's seek bar.

System requirements

PHP 7.x (see release 0.2 for the latest version supporting PHP 5.5/5.6).

Following binaries need to be installed

Installation

composer require emgag/video-thumbnail-sprite

Usage

use Emgag\Video\ThumbnailSprite\ThumbnailSprite;

$sprite = new ThumbnailSprite();
$ret = $sprite->setSource('path-to-source-video.mp4')
       ->setOutputDirectory('dir-to-store-sprite-and-vtt')
       // filename prefix for image sprite and WebVTT file (defaults to "sprite", resulting in "sprite.jpg" and "sprite.vtt")
       ->setPrefix('sprite') 
       // absolute URL of sprite image or relative to where the WebVTT file is stored
       ->setUrlPrefix('http://example.org/sprites')
       // sampling rate in seconds 
       ->setRate(10) 
       // minimum number of images (will modify sampling rate accordingly if it would result in fewer images than this)
       ->setMinThumbs(20)
       // width of a single thumbnail in px 
       ->setWidth(120) 
       ->generate();
       
// $ret = ['vttFile' => 'path-to-vtt-file', 'sprite' => 'path-to-sprite-file'] 

There are two different thumbnailing methods available, ffmpeg (default) or ffmpegthumbnailer.

// default, is set implicitly if not provided
$sprite->setThumbnailer(new Thumbnailer\Ffmpeg());
// change thumbnailer to ffmpegthumbnailer
$sprite->setThumbnailer(new Thumbnailer\FfmpegThumbnailer());

To keep individual source images of the sprite instead of removing it after assembling the sprite into a single image:

$sprite->setOutputImageDirectory('dir-to-store-images');

Acknowledgments

Uses:

License

video-thumbnail-sprite is licensed under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 26
  • Watchers: 4
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-19