selective / video-type
Video type detection
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 3
Open Issues: 0
pkg:composer/selective/video-type
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-11-07 15:15:38 UTC
README
Video type detection library for PHP.
Features
- Detection of the video type based on its header
- No dependencies
- Very fast
Supported formats
- AVI (Audio Video Interleave)
- MKV
- MP4
- MPEG-1 Part 2
- MPEG-2 Part 2
- OGG OGV
- 3G2 3GPP2
- 3GP 3GPP
- WEBM
- QuickTime
- RealMedia
- WMV (Windows Media Video)
- FLV (Adobe Flash Video)
- MXF (Material Exchange Format)
Requirements
- PHP 8.1 - 8.5
Installation
composer require selective/video-type
Usage
Detect the video type of file
use Selective\VideoType\VideoTypeDetector; use Selective\VideoType\Provider\DefaultVideoProvider; use SplFileObject; $file = new SplFileObject('example.mp4'); $detector = new VideoTypeDetector(); // Add video detectors $detector->addProvider(new DefaultVideoProvider()); $videoType = $detector->getVideoTypeFromFile($file); // Get the video format echo $videoType->getFormat(); // mp4 // Get the mime type echo $videoType->getMimeType(); // video/mp4
Detect the video type of in-memory object
$video = new SplTempFileObject(); $video->fwrite('my file content'); $detector = new VideoTypeDetector(); // Add video detectors $detector->addProvider(new DefaultVideoProvider()); echo $detector->getVideoTypeFromFile($file)->getFormat();
License
The MIT License (MIT). Please see License File for more information.