ac/media-info-bundle
Composer 安装命令:
composer require ac/media-info-bundle
包简介
Provides a wrapper for the mediainfo command line utility.
README 文档
README
This bundle provides a wrapper around the command line utility mediainfo. This utility lets you get metadata about various multimedia formats.
For this bundle to work you must, of course, have mediainfo installed on your system.
Installation
Require in your composer.json:
{
"require": {
"ac/media-info-bundle": "~1.2.0"
}
}
Add to your AppKernel.php;
//app/AppKernel.php public function registerBundles() { return array( //... new AC\MediaInfoBundle\ACMediaInfoBundle(), //... ); }
Configuration
Configuration is very simple, you only need to provide the path to the mediainfo executable:
ac_media_info: path: /usr/bin/mediainfo
Usage
Usage is equally simple:
$mediainfo = $container->get('ac.mediainfo'); //will return a structured php array with the mediainfo results $array = $mediainfo->scan('/path/to/file.mp4');
It's important to note that the keys under $array['file'] contain arrays as values, because mediainfo reports many values in a variety of representations. You can see an example below.
All keys returned by mediainfo are normalized to lower-case. For example, if you use the mediainfo:scan command to export the data in yaml, you would see:
app/console mediainfo:scan /path/to/example.webm version: 0.7.63 file: general: count: - '284' count_of_stream_of_this_kind: - '1' kind_of_stream: - General unique_id: - '94077224337973666327274415816295077565' - '94077224337973666327274415816295077565 (0x46C69D45A185A9294D3D0A2F750056BD)' count_of_video_streams: - '1' count_of_audio_streams: - '1' video_format_list: - VP8 video_format_withhint_list: - VP8 codecs_video: - V_VP8 video_language_list: - English audio_format_list: - Vorbis audio_format_withhint_list: - Vorbis audio_codecs: - Vorbis audio_language_list: - English complete_name: - /Users/evan/Desktop/trailer.webm folder_name: - /Users/evan/Desktop file_name: - trailer file_extension: - webm format: - WebM format_url: - 'http://www.webmproject.org/' format_extensions_usually_used: - webm commercial_name: - WebM format_version: - 'Version 1' internet_media_type: - video/webm codec: - WebM codec_url: - 'http://www.webmproject.org/' codec_extensions_usually_used: - webm file_size: - '2165175' - '2.06 MiB' - '2 MiB' - '2.1 MiB' - '2.065 MiB' duration: - '32480' - '32s 480ms' - '00:00:32.480' overall_bit_rate_mode: - VBR - Variable overall_bit_rate: - '533294' - '533 Kbps' stream_size: - '121714' - '119 KiB (6%)' - '119 KiB' - '118.9 KiB' proportion_of_this_stream: - '0.05621' encoded_date: - 'UTC 2010-05-20 08:21:12' file_last_modification_date: - 'UTC 2013-07-26 20:20:20' file_last_modification_date__local_: - '2013-07-26 16:20:20' writing_application: - 'Sorenson Squeeze' writing_library: - 'http://sourceforge.net/projects/yamka' video: '1': count: - '263' count_of_stream_of_this_kind: - '1' kind_of_stream: - Video streamorder: - '0' id: - '1' unique_id: - '38308775201223106' format: - VP8 format_url: - 'http://www.webmproject.org/' commercial_name: - VP8 codec_id: - V_VP8 codec_id_url: - 'http://www.webmproject.org/' codec: - V_VP8 duration: - '32480' - '32s 480ms' - '00:00:32.480' bit_rate: - '439316' - '439 Kbps' width: - '640' - '640 pixels' height: - '360' - '360 pixels' pixel_aspect_ratio: - '1.000' display_aspect_ratio: - '1.778' - '16:9' frame_rate_mode: - CFR - Constant frame_rate: - '25.000' - '25.000 fps' frame_count: - '812' compression_mode: - Lossy bits__pixel_frame_: - '0.076' delay: - '0' - '00:00:00.000' delay__origin: - Container stream_size: - '1783621' - '1.70 MiB (82%)' - '2 MiB' - '1.7 MiB' - '1.70 MiB' - '1.701 MiB' proportion_of_this_stream: - '0.82378' language: - en - English - eng default: - Yes forced: - No audio: '1': count: - '220' count_of_stream_of_this_kind: - '1' kind_of_stream: - Audio streamorder: - '1' id: - '2' unique_id: - '110618262945856186' format: - Vorbis format_url: - 'http://www.vorbis.com/' commercial_name: - Vorbis format_settings__floor: - '1' internet_media_type: - audio/vorbis codec_id: - A_VORBIS codec_id_url: - 'http://www.vorbis.com' codec: - Vorbis codec_family: - Vorbis codec_url: - 'http://www.vorbis.com' codec_settings__floor: - '1' duration: - '32480' - '32s 480ms' - '00:00:32.480' bit_rate_mode: - VBR - Variable bit_rate: - '64000' - '64.0 Kbps' channel_s_: - '1' - '1 channel' sampling_rate: - '44100' - '44.1 KHz' samples_count: - '1432368' compression_mode: - Lossy delay: - '0' - '00:00:00.000' delay__origin: - Container delay_relative_to_video: - '0' video0_delay: - '0' stream_size: - '259840' - '254 KiB (12%)' - '254 KiB' - '253.8 KiB' proportion_of_this_stream: - '0.12001' writing_library: - 'Xiph.Org libVorbis I 20100325 (Everywhere)' - 'libVorbis (Everywhere) (20100325 (Everywhere))' writing_library_name: - libVorbis writing_library_version: - (Everywhere) writing_library_date: - '20100325 (Everywhere)' language: - en - English - eng default: - Yes forced: - No
ac/media-info-bundle 适用场景与选型建议
ac/media-info-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 490 次下载、GitHub Stars 达 2, 最近一次更新时间为 2013 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「metadata」 「multimedia」 「mediainfo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ac/media-info-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ac/media-info-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ac/media-info-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP wrapper around the mediainfo command
FFMpeg video/audio/subs conversions, thumbnails, audio extraction, query...
SoMin API SDK is a PHP library for making calls to SoMin API.
Allows you to upload, manage, and display files from your server directories.
Symfony bundle to provide PHP-FFmpeg (https://github.com/PHP-FFmpeg/PHP-FFmpeg) as a Symfony service
Yii2 Component to manage SEO data and metadata
统计信息
- 总下载量: 490
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-07-26