pawlox / video-thumbnail
Video thumbnails
Fund package maintenance!
paypal.me/pawlox
Installs: 142 468
Dependents: 1
Suggesters: 0
Security: 0
Stars: 22
Watchers: 1
Forks: 16
Open Issues: 4
Requires
- php: >=8.0
- ext-gd: *
- illuminate/support: ^10.0|^11
- php-ffmpeg/php-ffmpeg: ^1.1.0
Requires (Dev)
- orchestra/testbench: ~7.0
- phpunit/phpunit: ^10
This package is auto-updated.
Last update: 2024-10-28 13:42:15 UTC
README
Simple package for generating video thumbnail in Laravel using FFMpeg.
Support my work
If you want to support my work in other way than contributing the code itself, you can always pass me some small donation 🍺 at https://paypal.me/pawlox :)
Installation
Composer install:
composer require pawlox/video-thumbnail
After package installation, add the ServiceProvider to the providers array in config/app.php
Pawlox\VideoThumbnail\VideoThumbnailServiceProvider::class
And to the aliases array
'VideoThumbnail' => Pawlox\VideoThumbnail\Facade\VideoThumbnail::class
Also you can publish package config file with:
php artisan vendor:publish --tag=video-thumbnail
and set ffmpeg and ffprobe paths in .env file:
FFMPEG="/usr/bin/ffmpeg"
FFPROBE="/usr/bin/ffprobe"
Versions
Usage
VideoThumbnail::createThumbnail(
$videoUrl,
$storageUrl,
$fileName,
$second,
$width = 640,
$height = 480
);
$videoUrl - absolute path to video file,
$storageUrl - absolute path where the thumbnail should be save,
$fileName - name of thumbnail file,
$second - from which second of the movie thumbnail should be created,
$width [Optional] - width (in pixels) of the thumbnail (default 640),
$height [Optional] - height (in pixels) of the thumbnail (default 480).
Example
VideoThumbnail::createThumbnail(
public_path('files/movie.mp4'),
public_path('files/thumbs/'),
'movie.jpg',
2,
1920,
1080
);