0

Can anyone tell me why I get

Error: Class "FFMpeg\Format\video\X264" not found in"

even with the dependency installed and binary installed.

Below is my implementation.

I have the dependency in vendor and the binary in the container installed



<?php

namespace App\Services;
 
use App\Http\Traits\UploadFiles;
use App\Models\OtherVideoFormat;
use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;

class VideoServiceSecond
{
    use UploadFiles, SetPath;

    protected $otherVideoFormat, $data;

    public function __construct(array $data, $method = 'create')
    {
        $this->otherVideoFormat = app(OtherVideoFormat::class);
        $this->data = $data;

        if ($method == 'create')
            $this->convertFormatVideoFirst();
        else
            $this->convertFormatVideoFirstUpdate();
    }

    public function convertFormatVideoFirst()
    {
        FFMpeg::openUrl($this->data['url_signed'])
            ->export()
            ->toDisk('public')
            ->inFormat(new \FFMpeg\Format\video\X264)
            ->resize(config('dimensions-videos.second-width'), config('dimensions-videos.second-height'))
            ->save('video-resize-' . config('dimensions-videos.second-width') . 'x'
                . config('dimensions-videos.second-height') . config('files-extensions.video'));

        $response = $this->uploadFileConvert(
            Storage::disk('public')
                ->get("video-resize-" . config('dimensions-videos.second-width') . 'x'
                    . config('dimensions-videos.second-height') . config('files-extensions.video')),
            "video-resize-" . config('dimensions-videos.second-width') . 'x'
                . config('dimensions-videos.second-height') . '-' . Str::uuid() . config('files-extensions.video')
        );

        $this->data['url'] = $response;
        $this->data['url_signed'] = $this->getAuthorizationToDownloadFile($this->data['url']);
        $this->data['created_at'] = Carbon::now()->toDateString();
        $this->data['updated_at'] = Carbon::now()->toDateString();
        $this->data['video_id'] = $this->data['video_id'];
        $this->data['format'] = config('dimensions-videos.second-width') . 'x'
            . config('dimensions-videos.second-height');

        FFMpeg::openUrl($this->data['url_signed'])
            ->getFrameFromSeconds(config('time-capture-thumb.seconds'))
            ->export()
            ->toDisk('public')
            ->save("video-thumb-" . config('dimensions-thumb.second-width') . 'x'
                . config('dimensions-thumb.second-height') . config('files-extensions.thumb'));

        $url_file = $this->uploadPublicFileCompress(
            Storage::disk('public')
                ->get("video-thumb-" . config('dimensions-thumb.second-width') . 'x'
                    . config('dimensions-thumb.second-height') . config('files-extensions.thumb')),
            "video-thumb-" . config('dimensions-thumb.second-width') . 'x'
                . config('dimensions-thumb.second-height') . '-' . Str::uuid() . config('files-extensions.thumb')
        );

        $this->removeImagePublicDisk("video-thumb-" . config('dimensions-thumb.second-width') . 'x'
            . config('dimensions-thumb.second-height') . config('files-extensions.thumb'));
        $this->removeImagePublicDisk("video-resize-" . config('dimensions-videos.second-width') . 'x'
            . config('dimensions-videos.second-height') . config('files-extensions.video'));

        $this->data['thumbnail_url'] = $url_file;

        $this->otherVideoFormat->create($this->data);
    }


?>

I've tried several options, and I can't find the reason for the problem

  • Because PHP couldn't find the class `FFMpeg\Format\video\X264`? How/where are you including the class in your code? Btw, what dependency are you referring to? Some PHP extension/library? Please read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and [how to ask](https://stackoverflow.com/help/how-to-ask). You should also [take the tour](https://stackoverflow.com/tour) that was recommended to you when you registered. – M. Eriksson Sep 21 '22 at 15:09
  • @M.Eriksson import of use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg; – Despossivel Sep 21 '22 at 15:13
  • Please edit the question with your implementation. It's literally impossible for us to know what's going on with absolutely no reference. – M. Eriksson Sep 21 '22 at 15:15
  • @M.Eriksson Sorry for my slip, but I already updated the question – Despossivel Sep 21 '22 at 15:24

0 Answers0