ac/media-info-bundle
Symfony bundle wrapping the mediainfo CLI to extract multimedia metadata. Configure the mediainfo binary path, then scan files to get a normalized, structured PHP array (keys lowercased). Includes a console command to export scan results (e.g., YAML).
Pros:
mediainfo), reducing dependency on reinventing metadata extraction logic.container->get()), fitting seamlessly into existing Symfony/Laravel ecosystems.Cons:
mediainfo CLI: Requires system-level installation of mediainfo, adding operational complexity (e.g., version management, OS-specific dependencies).mediainfo output (e.g., nested arrays for multi-value fields like count) may require custom normalization logic for downstream use cases.AppKernel.php registration. For Laravel 5.4+, requires manual kernel registration or a bridge package (e.g., symfony/bundle compatibility layer).ac.mediainfo as a service, but Laravel’s newer bind()/tag() patterns may require adapter code for DI containers (e.g., Pimple).mediainfo CLI must be pre-installed on all environments (dev/staging/prod). Docker/Kubernetes setups will need explicit mediainfo inclusion in base images.mediainfo binaries vary by OS (Linux/macOS/Windows) and architecture (x86/ARM). CI/CD pipelines must validate compatibility across targets.mediainfo output may include edge cases (e.g., malformed metadata, unsupported formats) requiring custom error handling.mediainfo in a sidecar or use a PHP port (e.g., php-mediainfo) to reduce OS dependencies.mediainfo be pre-installed in all target environments, or is a pure-PHP alternative (e.g., getid3) viable?mediainfo, corrupt files) be surfaced (exceptions, logs, retries)?mediainfo output?mediainfo versions?symfony/bundle) to register the bundle in Laravel’s service container. Example:
// config/app.php
'providers' => [
AC\MediaInfoBundle\ACMediaInfoBundle::class,
],
$app->bind('mediainfo', function ($app) {
return new AC\MediaInfoBundle\MediaInfo($app['config']['ac_media_info.path']);
});
ext-ctype and ext-json to composer.json (required by mediainfo CLI output parsing).return_type_declaration and strict_types polyfills if the bundle lacks PHP 8 support.mediainfo CLI in dev environment and test basic scans:
composer require ac/media-info-bundle:~1.2.0
/usr/local/bin/mediainfo).file.general.duration)..env):
MEDIAINFO_PATH=/usr/local/bin/mediainfo
// app/Services/MediaInfoService.php
class MediaInfoService {
public function scan(string $filePath): array {
return app('mediainfo')->scan($filePath);
}
}
mediainfo (e.g., Dockerfile):
FROM alpine:latest
RUN apk add --no-cache mediainfo
// app/Jobs/ScanMediaJob.php
class ScanMediaJob implements ShouldQueue {
public function handle() {
$metadata = app('mediainfo')->scan($this->filePath);
// Store/process metadata...
}
}
apt-get install mediainfo (Debian/Ubuntu) or yum install mediainfo (RHEL).brew install mediainfo.PATH.mediainfo is unmanageable, consider:
php-mediainfo (pure PHP, but slower).getid3 (supports more formats, but heavier).mediainfo CLI in all environments before deploying the bundle.mediainfo fails, implement a fallback (e.g., cache last-known metadata or use a secondary library).mediainfo CLI may not require bundle changes.mediainfo CLI updates may break output formats (e.g., new metadata fields). Monitor MediaArea releases.$mediainfo->setDebug(true); // If supported; otherwise, log raw command execution.
mediainfo not found → Verify PATH or config path.chmod +x /usr/bin/mediainfo).mediainfo supports the file type (e.g., check supported formats).mediainfo CLI documentation.How can I help you explore Laravel packages today?