protonemedia / laravel-ffmpeg

This package provides an integration with FFmpeg for Laravel. Laravel's Filesystem handles the storage of the files.
https://protone.media/en/blog/how-to-use-ffmpeg-in-your-laravel-projects
MIT License
1.66k stars 194 forks source link

add a text as watermark instead of image #366

Closed develowper closed 2 years ago

develowper commented 2 years ago

hi . dear developer. can i add a text inside video as watermark? your example codes uses of images as watermark can u add a method to use text with a color as watermark?

Thank u

pascalbaljet commented 2 years ago

Use can use the drawtext filter:

FFMpeg::open('video.mp4')
    ->export()
    ->addFilter(["-vf", "drawtext=text='Watermark Text':x=10:y=10:fontsize=16:fontcolor=white"])
    ->inFormat(new \FFMpeg\Format\Video\X264)
    ->save('video_with_text.mp4');