Call to undefined method FFMpeg\Media\Video::addWatermark()
P粉567281015
P粉567281015 2024-03-29 20:44:29
0
1
372

I'm trying to add a watermark to a video I own but I'm getting this error while applying the watermark

The library is installed and works with the commented code, but it doesn't work when trying to add a watermark

use FFMpeg\FFMpeg;
use ProtoneMedia\LaravelFFMpeg\Filters\WatermarkFactory;
    
$ffmpeg = FFMpeg::create();
$video = $ffmpeg->open(public_path('video-making-test/test1.mp4'));
//    $video
//        ->filters()
//        ->resize(new \FFMpeg\Coordinate\Dimension(320, 240))
//        ->synchronize();
//    $video
//        ->frame(\FFMpeg\Coordinate\TimeCode::fromSeconds(10))
//        ->save(public_path('video-making-test/results/frame.jpg'));
    $video->addWatermark(function(WatermarkFactory $watermark) {
    $watermark->fromDisk('public')
        ->open('video-making-test/logo.png')
        ->right(25)
        ->bottom(25);
});

P粉567281015
P粉567281015

reply all(1)
P粉011360903

Try using ProtoneMedia\LaravelFFMpeg\Support\FFMpeg instead of FFMpeg\FFMpeg.

use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;

$video = FFMpeg::open(public_path('video-making-test/test1.mp4'));
$video->addWatermark(...);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!