We're releasing the next major version of Laravel FFMpeg: a full rewrite with new features and many improvements
In the Laravel 5.1 days, we got involved in completing the development of a video platform. It already had a lot of custom FFMpeg code, but there was no abstraction or testing, and it wasn't developer-friendly. We learned a lot, however. There was a great PHP-FFMpeg package out there, and the FFMpeg community was tremendous.
To boost the platform's development, we worked hard to replace all the custom code with testable, object-oriented code. We found out there was room for a Laravel package that combined the power of FFMpeg with the elegance of Laravel. Funnily enough, we're now researching the possibility of building such a video platform once again, more on that later.
We released the first version in August 2016. It took a few months to gain traction, and at the start of 2017, the first issues and PR's rolled in. We figured most issues were kind of 'beginner' issues. As the underlying package does most of the interaction with the FFMpeg binaries, most questions were about getting started and Laravel related topics as facades and it's filesystem.
Install statistics of pbmedia/laravel-ffmpeg from packagist.org
So I wrote a blog post about the package, and that's when it took off. The blog post is still the most popular of all, and almost four years later, the package has more than 310.000 downloads. It supported every new Laravel and PHP version, and it got a lot of new great features. We've built-in support for HLS exports, opening media from remote sources like Amazon S3 and custom filters.
A full rewrite
To overcome some of the long-standing issues and feature requests, we had to rewrite the whole thing. Backward compatibility was essential but not mandatory for every piece of functionality. We're happy there are only a few breaking changes which you can solve in maybe 5-10 minutes. Let's explore some of the most important new features:
- Support for multiple inputs, even from different (remote) sources. You can map multiple inputs to multiple outputs, and it supports complex filters.
- Improved HLS export: one job for multiple formats, custom playlist/segment naming patterns, playlists with bitrate/framerate/resolution data.
- Support for concatenation, with and without transcoding.
- Support for image sequences (timelapse).
- Much better handling of remote disks.
- Easier and more reliable progress monitoring.
- Supports PHP 7.2 and higher + Laravel 6.0 and higher.
Upgrading is straightforward. Bump the dependency in your
composer.json file to
^7.0 and run
composer update. In the README, there is a small section that lists all breaking changes. It also includes examples of all new features. During its development, some have already been using it in production for some time.
New features and improvements
One of my favorite new features is support for multiple inputs. This feature makes it easy to combine videos in stacks, or to replace the audio track of a video with something else. We got several feature requests for image sequences, storing frames (stills) to a variable instead of into a file, and better handling of remote sources. You can, for example, open a video from an S3 bucket, combine it with the audio from an FTP-server, and export it to Dropbox.
->addFormatOutputMapping(new X264, Media::make('dropbox', 'combined.mp4'), ['0:v', '1:a'])
It also comes with improvements like better HLS playlists. They now contain additional data (bitrate, framerate, and resolution). Also, previously every format of an HLS export was processed separately. After the rewrite, this is just one job. The progress listener is more reliable than before, and now there's a unified way to add it to your export.
As I mentioned before, we're researching the possibility of rolling out a video platform or offering the tools to build one. This product could be a Laravel package or a one-click installer like Wordpress. It might even end up as a service for those of you who don't want to build or spend time setting up such a platform. Here is an overview of some of the features we're thinking about:
- Series, chapters, topics
- Monetize your content (built-in payment system)
- Set up courses
- Video upload handling
- Video player event tracking (pause/resume/completed/skipped/etc...)
- Transcoding in different formats for different devices
- Profile pages for your customers
- Thumbnail builder/generator
- Comments, likes, favorites
- Encrypted video stream to prevent ripping
- Subdomain or a custom domain (service-based only)
We're still debating the feature set and final form, but you could help us out by spreading the word and check out the poll on our website. It has only 1 question and 3 options to choose from, so it'll probably take you just a few seconds. Thanks in advance!
We sincerely hope you'll enjoy this new release! Let us know what you build with it and how the package helps you. You'll find this new release on the GitHub repository, reach out on Twitter, and don't forget to vote at videocoursebuilder.com!