问题
I'm using laravel ffmpeg to create a thumnail fot the video, but when i run the code, it return me
Call to undefined method FFMpeg\FFMpeg::fromDisk()
I don't know what happen to this error, i'm follow the instruction in github. here is my code.
use FFMpeg\FFMpeg;
use FFMpeg\FFProbe;
$thumbnail_name = md5($request->video_name).'_thumbnail.jpg';
$thumbnail_path = '/assets/' . $request->video_name;
FFMpeg::fromDisk('videos')
->open($export_as)
->getFrameFromSeconds(10)
->export()
->toDisk('thumnails')
->save($thumbnail_path);
i tried the fromFilesystem
method, but it is not working, i also change the value in fromDisk()
to public/assets
even from c drive like C:\xampp\htdocs\vidpuz\public\assets
but also not working, it keep return undefined method error.
回答1:
You could use this:
use Pbmedia\LaravelFFMpeg\FFMpeg;
but you are using:
use FFMpeg\FFMpeg;
So you are not using the Laravel package but FFMpeg directly...
If you installed the package correctly. You can even omit the use Pbmedia\LaravelFFMpeg\FFMpeg;
and use the facade directly.
来源:https://stackoverflow.com/questions/45660168/laravel-ffmpeg-error-call-to-undefined-method-ffmpeg-ffmpegfromdisk