bluemoehre / flac-php

该软件包最新版本(v1.0.2)没有提供许可证信息。

PHP类,用于本地读取FLAC的元数据和Vorbis注释

v1.0.2 2017-02-12 23:16 UTC

This package is not auto-updated.

Last update: 2024-09-15 01:36:16 UTC


README

PHP类,用于本地读取FLAC的元数据。直接访问Vorbis注释(艺术家、标题、专辑等),以获取所有所需信息。

安装

可以通过Composer轻松安装此类
composer require bluemoehre/flac-php

或者您也可以通过以下旧式方法下载并添加它:
require 'Flac.php'

用法

<?php

use bluemoehre\Flac;

header('Content-Type: text/plain;charset=utf-8');

// benchmark start
$t = microtime(true);

$flac = new Flac('mySong.flac');

// benchmark end
$t = microtime(true) - $t;

echo 'Benchmark: ' . $t .'s' . "\n\n";
echo 'Filename: ' . $flac->getFilename() . "\n";
echo 'File size: ' . $flac->getFileSize() . " Bytes\n";
echo 'Meta-Blocks: '; print_r($flac->getMetadataBlockCounts()); echo "\n";
echo 'Sample Rate: ' . $flac->getSampleRate() . "\n";
echo 'Channels: ' . $flac->getChannels() . "\n";
echo 'Bits per sample: ' . $flac->getBitsPerSample() . "\n";
echo 'Total samples: ' . $flac->getTotalSamples() . "\n";
echo 'Duration: ' . $flac->getDuration() . "s\n";
echo 'MD5 checksum (audio data): ' . $flac->getAudioMd5() . "\n";
echo 'Vorbis-Comment: '; nl2br(print_r($flac->getVorbisComment())); echo "\n";

待办事项

  • 添加图片获取器

技术信息

FLAC:https://xiph.org/flac/format.html
Vorbis注释:https://www.xiph.org/vorbis/doc/v-comment.html