Protone Media logo

Laravel FFMpeg now supports watermarks out-of-the-box

Today a new version of Laravel FFMpeg has been released: version 7.3. It now has support for watermark built-in! You can add watermarks from your local or remote storage or even from the web. Positioning is easy. You can position it in a CSS-way, or you can use the built-in position constants. Let's take a look at both.

After opening your video file, you can call a new addWatermark method to open a watermark file. Like positioning elements with CSS, there are top, right, bottom, and left methods that also support offset values.

    ->addWatermark(function(WatermarkFactory $watermark) {

Another way to position your watermark is by using the horizontalAlignment and verticalAlignment methods. Both require a constant and support an optional offset as well.

    ->addWatermark(function(WatermarkFactory $watermark) {
            ->horizontalAlignment(WatermarkFactory::LEFT, 25)
            ->verticalAlignment(WatermarkFactory::TOP, 25);

You can read the full documentation at the GitHub repository.

I built this feature during a live coding session on YouTube. You can rewatch the whole process if you've missed it, and might even want to subscribe to my new YouTube channel for future sessions and lessons!

Update 26 oct: As of version 7.4, the package supports manipulating watermarks as well.

Related posts

Want to stay up-to-date on Laravel news and packages?

Pascal Baljet on Twitter

Follow me on Twitter: @pascalbaljet

Pascal Baljet on Twitter

Subscribe to my YouTube channel

© 2013-2024 Protone Media B.V. Hosted with Eddy Server Management.