簡體   English   中英

使用ffmpeg在laravel上創建縮略圖

[英]create thumbnails on laravel with ffmpeg

我想在上傳的視頻上創建縮略圖,我一直在使用mmpeg,我一直在嘗試此代碼,但目前還無法正常工作

這是我在控制器上的代碼

use ffmpeg\FFMPEG;

    public function store(Request $request)
{

    $news = new News;

    $filename = $request->file('attachment')->getClientOriginalName();
    $request->file('attachment')->storeAs('attachment', $filename);

    $thumbnails = new FFMPEG;
    $thumbnails->getThumbnails($filename, 'thumbnails', 5);
}   

我也一直在這樣設置config / app.php

LinkThrow\Ffmpeg\Provider\FfmpegServiceProvider::class, //providers

'FFMPEG' => LinkThrow\\Ffmpeg\\Facade\\FfmpegFacade::class, //aliases

錯誤是

找不到類別'ffmpeg \\ FFMPEG'

是否也需要在config / ffmpeg.php上進行設置?

按照我的use FFMPEG\\FFMPEG; ,有兩種可能性:一種是use FFMPEG\\FFMPEG;另一種是use FFMPEG\\FFMPEG; 您正在使用小寫字母。 更新s如下

use FFMPEG\FFMPEG;

public function store(Request $request)
{

    $news = new News;

    $filename = $request->file('attachment')->getClientOriginalName();
    $request->file('attachment')->storeAs('attachment', $filename);

    $thumbnails = new FFMPEG;
    $thumbnails->getThumbnails($filename, 'thumbnails', 5);
}   

第二個是你有使用代替

$thumbnails = new FFMPEG;
$thumbnails->getThumbnails($filename, 'thumbnails', 5);

FFMPEG::getThumbnails($filename, 'thumbnails', 5);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM