How can I apply a color filter effect in my video using laravel-ffmpeg package and what is the proper way to do it?
The package have a custom filters but i dont know how to translate the ffmpeg command for color filter to laravel-ffmpeg.
From FFMPEG cmd
"eq=brightness=0.3:saturation=1.3:contrast=1.1"
To LARAVEL-FFMPEG package
->addFilter('eq=brightness=0.3:saturation=1.3:contrast=1.1')
And I saw that there are -vf
in custom Filter in laravel-ffmpeg package, so i try to use the ffmpeg cmd command for color filter, I dont know the proper way to use it in laravel.
Here are my code with EncodingException
error
FFMpeg::fromDisk('videos-temp')
->open('buck.mp4')
->export()
->toDisk('videos-temp')
->addFilter('eq=brightness=0.3:saturation=1.3:contrast=1.1')
->inFormat(new \FFMpeg\Format\Video\X264)
->save('sample.mp4');
CodePudding user response:
Maybe you should try to use the custom
method.
Try something like:
use FFMpeg\Filters\Video\VideoFilters;
///
->addFilter(function (VideoFilters $filters) {
$filters->custom('eq=brightness=0.3:saturation=1.3:contrast=1.1');
})
or maybe:
->addFilter('eq', 'brightness=0.3:saturation=1.3:contrast=1.1')
I haven't tried it, I'll let you reply in comments if it doesn't work.