我将Laravel与protonemedia / laravel-ffmpeg软件包https://github.com/protonemedia/laravel-ffmpeg一起使用 我创建了一个作业来处理视频转换和串联,并且出现此错误:
TypeError:传递给App \ Jobs \ VideoConversion :: App \ Jobs {closure}()的参数1必须是FFMpeg \ Filters \ Video \ VideoFilters的实例,是/ Users中提供的FFMpeg \ Filters \ AdvancedMedia \ ComplexFilters的实例/fab/Sites/add-intro/app/Jobs/VideoConversion.php:43
这是工作的代码:
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\Video;
use Storage, Str, ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;
use FFMpeg\Filters\Video\VideoFilters;
class VideoConversion implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $video;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Video $video)
{
$this->video = $video;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$filename = Str::uuid().'.mp4';
FFMpeg::fromDisk('public')
->open(['intro.mp4', $this->video->path])
->addFilter(function (VideoFilters $filters) {
$filters->resize(new \FFMpeg\Coordinate\Dimension(640, 480));
})
->export()
->toDisk('public')
->inFormat(new \FFMpeg\Format\Video\X264)
->concatWithTranscoding($hasVideo = true, $hasAudio = true)
->save($filename);
}
public function failed(Throwable $exception)
{
FFMpeg::cleanupTemporaryFiles();
dd($exception);
}
}
我做错了什么? 感谢您的帮助