Laravel FFmpeg 9: HLS, DASH &amp; Video Encoding | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://msaied.com) - [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [About](https://msaied.com#about)

           [  Contact](https://msaied.com#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://msaied.com)
- [ProjectsCase studies](https://msaied.com/projects)
- [ArticlesEngineering notes](https://msaied.com/articles)
- [CertificatesCredentials](https://msaied.com/certificates)
- [AboutHow I work](https://msaied.com#about)
- [ContactGet in touch](https://msaied.com#contact)

  [Start a conversation](https://msaied.com#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://msaied.com)
2. /
3. [Articles](https://msaied.com/articles)
4. /
5. [Laravel](https://msaied.com/articles?category=laravel)
6. /
7. Laravel FFmpeg 9: Encode Video, Stream HLS and DASH in Laravel

   [Laravel](https://msaied.com/articles?category=laravel) [Composer Pacakge](https://msaied.com/articles?category=composer-pacakge) 

 Laravel FFmpeg 9: Encode Video, Stream HLS and DASH in Laravel
===============================================================

 Laravel FFmpeg 9 is a full rewrite that drops the php-ffmpeg dependency and integrates directly with Laravel's Process, Storage, Queue, and Http features to encode video and stream adaptive HLS and DASH.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://msaied.com#person) Published 29 Nov 2026 · Updated 6 Dec 2026 · 4 min read

ShareCopy linkCopied

 ![Laravel FFmpeg 9: Encode Video, Stream HLS and DASH in Laravel](https://cdn.msaied.com/845/6100dcc33d70e163e109517e11d527ac.png) 

  On this page +1. [What Changed in Laravel FFmpeg 9](#what-changed-in-laravel-ffmpeg-9)
2. [Adaptive HLS With AES-128 Encryption](#adaptive-hls-with-aes-128-encryption)
3. [Serving Protected HLS Streams](#serving-protected-hls-streams)
4. [Queued and Parallel Encoding](#queued-and-parallel-encoding)
5. [The ffmpeg:doctor Command](#the-ffmpegdoctor-command)
6. [Installation and Requirements](#installation-and-requirements)
7. [Key Takeaways](#key-takeaways)

 What Changed in Laravel FFmpeg 9
--------------------------------

[Laravel FFmpeg](https://github.com/protonemedia/laravel-ffmpeg) 9, created by Pascal Baljet, is a complete rewrite of the package he originally released in 2016. Previous versions wrapped the `php-ffmpeg` library. Version 9 drops that dependency entirely and runs FFmpeg through Laravel's own **Process**, **Storage**, **Http**, and **Queue** primitives — meaning exports use the disks and queue connections your application already configures.

The API is also new. Format objects and filter factories are gone. You pass FFmpeg settings as named arguments, and `save()` returns a result object that lists every file the export produced.

```php
use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;

$result = FFMpeg::disk('uploads')
    ->open('webinars/raw-recording.mov')
    ->export()
    ->resize(width: 854)
    ->video('libx264', crf: 26)
    ->audio('aac', bitrate: '96k')
    ->toDisk('videos')
    ->save('webinars/480p.mp4');

```

Version 9 also ships builders for storyboards, GIF previews, and background music.

Adaptive HLS With AES-128 Encryption
------------------------------------

The `hls()` method creates an adaptive stream. Each quality level is a variant, and `encrypt()` stores AES-128 keys on a separate disk. The example below writes keys to the `hls-keys` disk and rotates to a new key every five segments:

```php
use ProtoneMedia\LaravelFFMpeg\HlsVariant;

$result = FFMpeg::disk('uploads')
    ->open('webinars/raw-recording.mov')
    ->hls(segmentDuration: 6)
    ->variant('480p', fn (HlsVariant $v) => $v->resize(height: 480)->video('libx264', bitrate: '1200k'))
    ->variant('1080p', fn (HlsVariant $v) => $v->resize(height: 1080)->video('libx264', bitrate: '5000k'))
    ->encrypt('hls-keys', fn (string $keyPath) => route('webinars.key', ['key' => basename($keyPath)], absolute: false), rotateEvery: 5)
    ->toDisk('streams')
    ->save('webinars/17/master.m3u8');

```

**DASH is new in version 9.** The `dash()` builder groups representations into adaptation sets. Calling `sharedHls()` reuses the same segments for HLS players, so you store media only once.

Serving Protected HLS Streams
-----------------------------

The `Hls` facade registers signed routes for playback. After an export, persist the playback inventory on your model, then define a route with an `authorize` callback:

```php
Hls::define('webinar',
    resolve: fn (Webinar $webinar) => HlsPresentation::fromArray($webinar->hls_playback),
    authorize: fn (Webinar $webinar) => Gate::authorize('view', $webinar),
);

Hls::routes('/webinars/{webinar}/hls', name: 'webinars.hls', playback: 'webinar');

// Generate a signed URL valid for 15 minutes
$url = Hls::url('webinars.hls', ['webinar' => $webinar], expires: now()->addMinutes(15));

```

The package signs every playlist, segment, and key URL, and re-runs your `authorize` callback on each request. Pascal notes that signed URLs and AES-128 are **not** DRM.

Queued and Parallel Encoding
----------------------------

Call `queued()` before `save()` to push the export to a queue worker. Pass `parallel: true` on an HLS export to encode independent variants in separate workers inside a Laravel batch. A final job writes the master playlist:

```php
FFMpeg::disk('uploads')
    ->open('webinars/raw-recording.mov')
    ->hls(segmentDuration: 6)
    ->variant('sd', fn ($v) => $v->resize(width: 854)->video(bitrate: '1200k'))
    ->variant('hd', fn ($v) => $v->resize(width: 1920)->video(bitrate: '5000k'))
    ->queued(queue: 'video', parallel: true)
    ->save('webinars/17/master.m3u8');

```

Progress is available via `onProgress()`, which receives a `Progress` object with a nullable `percentage`. Failures throw a `MediaException` with a `category` (`launch`, `encoder`, `permission`) and `diagnostics` containing FFmpeg's raw error output.

The ffmpeg:doctor Command
-------------------------

The new `ffmpeg:doctor` Artisan command checks that PHP can locate and start the FFmpeg binary, that FFmpeg and FFprobe report the same version, and that the temp directory is writable. You can verify specific encoders, muxers, and filters:

```bash
php artisan ffmpeg:doctor --encoder=libx264 --encoder=aac --muxer=hls

```

The command exits with an error if any requested capability is missing from your FFmpeg build.

Installation and Requirements
-----------------------------

Version 9 requires **PHP 8.4**, **Laravel 13.44.1**, and **FFmpeg/FFprobe 9.0 or later**. Install via Composer:

```bash
composer require pbmedia/laravel-ffmpeg

```

Apps on Laravel 9–12 can remain on version 8. If you are upgrading, consult the [upgrade guide](https://github.com/protonemedia/laravel-ffmpeg/blob/main/UPGRADE.md), which shows version 8 and version 9 code side by side.

Key Takeaways
-------------

- Version 9 is a full rewrite; the `php-ffmpeg` dependency is removed.
- Named-argument API replaces format objects and filter factories.
- Adaptive HLS with AES-128 key rotation and new DASH support.
- Signed, authorized playback routes via the `Hls` facade.
- Queued and parallel variant encoding using Laravel batches.
- `ffmpeg:doctor` command diagnoses binary and capability issues.
- Requires PHP 8.4, Laravel 13.44.1, and FFmpeg 9.0+.

---

*Source: [Laravel FFmpeg 9: Encode Video and Stream HLS and DASH — Laravel News](https://laravel-news.com/laravel-ffmpeg-9)*

- [Laravel](https://msaied.com/articles?search=Laravel)
- [FFmpeg](https://msaied.com/articles?search=FFmpeg)
- [HLS](https://msaied.com/articles?search=HLS)
- [DASH](https://msaied.com/articles?search=DASH)
- [Video Encoding](https://msaied.com/articles?search=Video%20Encoding)
- [Composer Package](https://msaied.com/articles?search=Composer%20Package)

 Frequently asked questions 
---------------------------

  What are the minimum requirements to use Laravel FFmpeg 9?Laravel FFmpeg 9 requires PHP 8.4, Laravel 13.44.1, and FFmpeg and FFprobe version 9.0 or later. Apps running Laravel 9 through 12 should stay on version 8.

   Does Laravel FFmpeg 9 provide true DRM for HLS streams?No. Pascal Baljet explicitly notes that the signed URL system and AES-128 encryption are not DRM. They add a meaningful layer of access control, but they do not replace a dedicated DRM solution.

   How do I encode HLS variants in parallel using Laravel FFmpeg 9?Call `queued(queue: 'video', parallel: true)` before `save()` on an HLS export. Independent variants are dispatched as separate jobs inside a Laravel batch, and a final job assembles the master playlist once all variants finish.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

[Mohamed Said](https://msaied.com#person)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

[About](https://msaied.com#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleLaravel AutoBuilder: Build Visual Automation Workflows in Your Laravel App](https://msaied.com/articles/laravel-autobuilder-build-visual-automation-workflows-in-your-laravel-app) [Next articleHow Laravel News Cut Its Laravel Cloud Bill Nearly in Half](https://msaied.com/articles/how-laravel-news-cut-its-laravel-cloud-bill-nearly-in-half)  

   On this page
-------------

1. [What Changed in Laravel FFmpeg 9](#what-changed-in-laravel-ffmpeg-9)
2. [Adaptive HLS With AES-128 Encryption](#adaptive-hls-with-aes-128-encryption)
3. [Serving Protected HLS Streams](#serving-protected-hls-streams)
4. [Queued and Parallel Encoding](#queued-and-parallel-encoding)
5. [The ffmpeg:doctor Command](#the-ffmpegdoctor-command)
6. [Installation and Requirements](#installation-and-requirements)
7. [Key Takeaways](#key-takeaways)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://msaied.com#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/843/4b47e60127e1da7f55c7f483ae7352d4.png) Laravel · 4 min read### Migration Durations and Job Memory Usage in Laravel 13.45

1 Dec 2026 ](https://msaied.com/articles/migration-durations-and-job-memory-usage-in-laravel-1345) [ ![](https://cdn.msaied.com/842/f1f2dcfcc09498d0833e073d339309c7.png) Laravel · 3 min read### Laravel Rust Benchmarked: 18× the Throughput of Laravel PHP

1 Dec 2026 ](https://msaied.com/articles/laravel-rust-benchmarked-18-the-throughput-of-laravel-php) [ ![](https://cdn.msaied.com/844/4158c4af5d46d8babe0650b18493231c.png) Laravel · 3 min read### Introducing Laravel Cloud Model Gateway: One Key for Every AI Model

1 Dec 2026 ](https://msaied.com/articles/introducing-laravel-cloud-model-gateway-one-key-for-every-ai-model) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://msaied.com#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://msaied.com)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://msaied.com/sitemap.xml)
