ac / media-info-bundle
为 mediainfo 命令行工具提供包装。
1.3.0
2015-01-10 03:21 UTC
Requires
- symfony/framework-bundle: >=2.1
- symfony/process: >=2.1
- symfony/yaml: >=2.1
This package is not auto-updated.
Last update: 2024-09-14 13:38:46 UTC
README
此捆绑包围绕命令行工具 mediainfo 提供包装。此工具允许您获取各种多媒体格式的元数据。
当然,为了使此捆绑包工作,您必须在您的系统上安装 mediainfo
。
安装
在 composer.json
中要求:
{ "require": { "ac/media-info-bundle": "~1.2.0" } }
添加到您的 AppKernel.php
;
//app/AppKernel.php public function registerBundles() { return array( //... new AC\MediaInfoBundle\ACMediaInfoBundle(), //... ); }
配置
配置非常简单,您只需提供 mediainfo
可执行文件的路径即可。
ac_media_info: path: /usr/bin/mediainfo
使用方法
使用方法同样简单
$mediainfo = $container->get('ac.mediainfo'); //will return a structured php array with the mediainfo results $array = $mediainfo->scan('/path/to/file.mp4');
需要注意的是,$array['file']
下的键包含数组作为值,因为 mediainfo 以多种表示形式报告许多值。下面是一个示例。
mediainfo
返回的所有键都转换为小写。例如,如果您使用 mediainfo:scan
命令以 yaml 格式导出数据,您将看到
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