Laravel FFmpeg错误调用未定义的方法FFMpeg \ FFMpeg :: fromDisk() [英] Laravel FFmpeg error Call to undefined method FFMpeg\FFMpeg::fromDisk()

查看:335
本文介绍了Laravel FFmpeg错误调用未定义的方法FFMpeg \ FFMpeg :: fromDisk()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用laravel ffmpeg在视频中创建缩略图,但是当我运行代码时,它会返回我

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()

我不知道会发生什么错误,我正在按照github中的说明进行操作. 这是我的代码.

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);

我尝试了fromFilesystem方法,但它不起作用,即使从c驱动器(如C:\xampp\htdocs\vidpuz\public\assets),我也将fromDisk()中的值更改为public/assets,但也无法工作,它会一直返回未定义的方法错误.

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.

推荐答案

您可以使用:

use Pbmedia\LaravelFFMpeg\FFMpeg;

但是您正在使用:

use FFMpeg\FFMpeg;

所以您不是在使用Laravel软件包,而是直接使用FFMpeg ...

So you are not using the Laravel package but FFMpeg directly...

如果正确安装了软件包.您甚至可以省略use Pbmedia\LaravelFFMpeg\FFMpeg;并直接使用外观.

If you installed the package correctly. You can even omit the use Pbmedia\LaravelFFMpeg\FFMpeg; and use the facade directly.

这篇关于Laravel FFmpeg错误调用未定义的方法FFMpeg \ FFMpeg :: fromDisk()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆