Laravel FFmpeg error Call to undefined method FFMpeg\FFMpeg::fromDisk()

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 04:06:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!