goncziakos / sonata-media-provider-video-bundle
此包扩展了Sonata Media Bundle,创建了一个新的视频上传提供商,并使用FFmpeg
v2.1.0
2024-07-17 14:57 UTC
Requires
- php: >=8.0
- ext-fileinfo: *
- doctrine/doctrine-bundle: ^2.7
- doctrine/orm: ^2.16
- php-ffmpeg/php-ffmpeg: ^1.2
- sonata-project/admin-bundle: ^4.28
- sonata-project/media-bundle: ^4.10
- symfony/framework-bundle: ^5.4 || ^6.4
This package is not auto-updated.
Last update: 2024-09-25 15:48:41 UTC
README
SonataMediaProviderVideoBundle
扩展了 SonataMediaBundle 提供商,创建了一个新的视频 提供商
用于上传视频,生成缩略图并使用FFmpeg。
此包基于 xmon/SonataMediaProviderVideoBundle,从 Grand-Central/SonataMediaProviderVideoBundle Grand-Central/SonataMediaProviderVideoBundle 分支而来,似乎已被遗弃,我进行了许多修改,因此决定创建一个新的功能齐全且文档完善的工程。
需求
您需要在服务器上安装 ffmpeg。
安装
安装此包
$ composer require xmon/sonata-media-provider-video-bundle
将VideoBundle添加到您的应用内核
// config/bundles.php <?php return [ // ... Xmon\SonataMediaProviderVideoBundle\XmonSonataMediaProviderVideoBundle::class => ['all' => true], ];
配置示例
安装包后,请确保配置以下参数
xmon_sonata_media_provider_video: ffmpeg_binary: "/usr/bin/ffmpeg" # Required, ffmpeg binary path ffprobe_binary: "/usr/bin/ffprobe" # Required, ffprobe binary path binary_timeout: 60 # Optional, default 60 threads_count: 4 # Optional, default 4 config: image_frame: 0 # Optional, default 10, Can not be empty. Where the second image capture video_width: 640 # Optional, default 640, Can not be empty. Video proportionally scaled to this width formats: mp4: true # Optional, default true, generate MP4 format ogg: true # Optional, default true, generate OGG format webm: true # Optional, default true, generate WEBM format
Twig使用
为了打印已保存到元数据字段的转换视频的URL,我创建了3个twig过滤器
{{ media|video_mp4 }} {{ media|video_ogg }} {{ media|video_webm }}
致谢
- 感谢所有参与此项目初始分支的贡献者。特别感谢主要分支 (maerianne/MaesboxVideoBundle) 和分支 (sergeym/VideoBundle),我从中继续我的开发。
- 感谢其他依赖的项目
- 在管理界面中使用了 videojs 插件,如视频播放器