foxws/laravel-media
| Install | |
|---|---|
composer require foxws/laravel-media |
|
| Latest Version: | 0.4.2 |
| PHP: | ^8.4 |
| Laravel: | 13 |
| License: | MIT |
| Last Updated: | Oct 31, 2026 |
| Links: | GitHub · Packagist |
Laravel Media
Probe, encode, package and stream audio and video in Laravel with ffprobe and ffmpeg, on any Laravel disk.
- Probe files into typed streams, chapters and formats, and validate uploads by what they really contain.
- Encode with presets, filters, watermarks, HDR to SDR tone mapping, several outputs in one run, and rendition ladders with optional GPU encoding.
- Process clips, frames, subtitles, scene detection, reels and seek-preview thumbnail sprites.
- Stream HLS (CMAF or MPEG-TS) and DASH straight from the stored files, cutting segments on request like nginx-vod-module, with per-request encryption, subtitles, thumbnails, chapters, trick play and multiple audio languages.
- Package renditions into static HLS and DASH with ClearKey encryption, and serve private manifests with signed URLs.
- Export to local or S3 disks with concurrent multipart uploads, and follow progress, events and retryable failures from queued jobs.
- Test without ffmpeg using
Media::fake().
It builds ffmpeg commands directly, without php-ffmpeg underneath, so any ffmpeg option is available without waiting on a package release.
See the full documentation: Installation, Opening and probing, Encoding, Streaming, Packaging, Queues, progress and errors, Testing, Configuration, Extending.
Requirements
- PHP 8.4 or higher, with the OpenSSL extension
- Laravel 13
- ffmpeg and ffprobe
league/flysystem-aws-s3-v3for S3 disks
Installation
composer require foxws/laravel-media
php artisan vendor:publish --tag="media-config"
Check that ffmpeg and ffprobe are found:
php artisan media:info
See Installation for the scheduled commands and queue setup.
[!TIP] Let your AI agent do the hard parts. This package ships a Laravel Boost skill,
laravel-media-development, that teaches your agent how to install, configure and use Laravel Media. Install Boost and select the skill when prompted:composer require laravel/boost --dev php artisan boost:installAlready using Boost? Run
php artisan boost:update --discoverto pick up the skill. Then just ask, for example: "Transcode uploaded videos from S3 to 720p H.264 on a queue."
Quick start
Probe a file and encode a clip of it to another disk:
use Foxws\Media\Encoding\Format;
use Foxws\Media\Facades\Media;
$media = Media::fromDisk('s3')->open('videos/clip.mp4');
$media->probe()->duration(); // 93.4
$media->probe()->videoStream()?->height; // 1080
$media->ffmpeg()
->clip(from: 12.5, to: 40)
->inFormat(Format::h264(crf: 22))
->toDisk('clips')
->save('intro.mp4');
Encode renditions once, then stream them as HLS and DASH without packaging them first:
use Foxws\Media\Encoding\Ladder;
use Foxws\Media\Facades\MediaStream;
// in a queued job
$result = Media::fromDisk('uploads')->open($upload)
->ladder(Ladder::standard(), "videos/{$video->id}/{height}p.mp4")
->toDisk('videos')
->save();
// AppServiceProvider::boot()
MediaStream::define('videos', fn (Video $video) => Media::fromDisk('videos')->open($video->renditions)
->stream()
->withChapters()
->withTrickPlay());
// routes/web.php
Route::middleware('auth')->group(fn () => Route::mediaStream('videos/{video}', 'videos'));
// the URL to give the player
MediaStream::url('videos', ['video' => $video]);
See Streaming for subtitles, thumbnails, encryption and the segment cache.
Testing
composer test
Links
Credits
This package started from ideas in Laravel FFMpeg and nginx-vod-module.
Used by Stry, a self-hosted video streaming app.
AI, specifically Claude, was used to help build this package. All AI-assisted output is reviewed by me, and I retain final say over everything that is implemented and released.
License
MIT. See License File.
Related Packages
Package video and audio into HLS and DASH with Shaka Packager, on top of foxws/l...
Encode video into several qualities and package it into HLS and DASH with Shaka...
Encode video to AV1 at a target quality with ab-av1, on top of foxws/laravel-med...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 0.4.2 | ^8.4 | ^13.0 | MIT | |
| 0.4.1 | ^8.4 | ^13.0 | MIT | |
| 0.4.0 | ^8.4 | ^13.0 | MIT | |
| 0.3.9 | ^8.4 | ^13.0 | MIT | |
| 0.3.8 | ^8.4 | ^13.0 | MIT | |
| 0.3.7 | ^8.4 | ^13.0 | MIT | |
| 0.3.6 | ^8.4 | ^13.0 | MIT | |
| 0.3.5 | ^8.4 | ^13.0 | MIT | |
| 0.3.4 | ^8.4 | ^13.0 | MIT | |
| 0.3.3 | ^8.4 | ^13.0 | MIT | |
| 0.3.2 | ^8.4 | ^13.0 | MIT | |
| 0.3.1 | ^8.4 | ^13.0 | MIT | |
| 0.3.0 | ^8.4 | ^13.0 | MIT | |
| 0.2.0 | ^8.4 | ^13.0 | MIT | |
| 0.1.2 | ^8.4 | ^13.0 | MIT | |
| 0.1.1 | ^8.4 | ^13.0 | MIT | |
| 0.1.0 | ^8.4 | ^13.0 | MIT |