尝试使用laravel ffmpeg

时间:2018-10-07 05:01:30

标签: laravel

我正在尝试使用laravel ffmpeg转换我的视频,但出现错误消息

  

“无法探测5bb990e27207cislands2.mp4”

我不知道为什么。我成功下载了吗?有人可以帮我吗?

这是我的代码

$user_id = Auth::user()->id;
$pro = User::find($user_id);
$pro->nickname=$request->nickname;

if($request->video) {
    $vid = $request->file('video');
    $filename = uniqid().$vid->getClientOriginalName();
    $vid = $request->file('video');
    // $filename = uniqid().$vid->getClientOriginalName();
    // $path = $vid->storeAs('introvideo', $filename);

    $ffmpeg = FFMpeg\FFMpeg::create([
        'ffmpeg.binaries'  => "C:/Users/Riche/Desktop/ffmpeg/ffmpeg/bin/ffmpeg.exe",
        'ffprobe.binaries' => "C:/Users/Riche/Desktop/ffmpeg/ffmpeg/bin/ffprobe.exe"
    ]);

    $video = $ffmpeg->open($filename)->export()
        ->toDisk('s3')
        ->inFormat(new \FFMpeg\Format\Video\X264)
        ->save('myvideo.mp4');

    $t = Storage::disk('s3')->put($filename, file_get_contents($vid), 'public');
    $imageName = Storage::disk('s3')->url($filename);
    // $vid->move($location);
    $pro->intro_video = $video;

}

$pro->save();

0 个答案:

没有答案