Muhammad Umair
Muhammad Umair

Reputation: 1

how to get video duration in laravel 8

$data = new Video;
            $data->video_name = $request->video_name;
            $data->video_description = $request->video_description;

            $imageName = time().'.'.$request->video_file->getClientOriginalExtension();
            // echo "<pre>";
            // print_r($imageName);
            // die();
            $request->video_file->move(public_path('video'),$imageName);
            $data->video_file = !empty($imageName) ? URL::to('video/'.$imageName) : 'empty';

            $data->lession_id=$request->lession_id;
            $data->is_free=$request->is_free;
            $data->course_id=$request->course_id;
            $data->subject_id=$request->subject_id;
            $data->module_id=$request->module_id;
            $data->lecture_type="video";
            $query = $data->save();

            // return $data->video_file;
            $getID3 = new \getID3;
            $file = $getID3->analyze('$data->video_file');
            return $file;

butt i got this error "GETID3_VERSION": "1.9.21-202109171300", "error": [ "Remote files are not supported - please copy the file locally first" ]

Upvotes: 0

Views: 379

Answers (1)

Rachna Gajjar
Rachna Gajjar

Reputation: 108

maybe your answer is here Years ago I used PHP-FFmpeg

For More updates https://github.com/PHP-FFMpeg/PHP-FFMpeg#ffprobe

$ffprobe = FFMpeg\FFProbe::create();
$ffprobe
    ->format('/path/to/video/mp4') // extracts file informations
    ->get('duration');

Upvotes: 1

Related Questions