Reputation: 15
This is my first time using ffmpeg. I don't know if there is a tutorial on how to use ffmpeg in laravel to compress videos. Can someone please help me please?
$pro=new User;
$pro->company_name=$request->Business_name;
$pro->cityandstate=$request->city;
$pro->zipcode=$request->zip_code;
$pro->phonenumber=$request->Phone_Number;
$pro->website=$request->Website;
$pro->tags=$request->tags;
$pro->category=$request->categories;
$pro->other=$request->other;
$vid = $request->file('video');
$filename = uniqid().$vid->getClientOriginalName();
$path = $vid->storeAs(
'introvideo',
$filename);
$location = public_path('/vids',$filename);
$vid->move($location);
$pro->intro_video= $filename;
$pro->save();
Upvotes: 1
Views: 9611
Reputation: 131
// Audio compress
$inputAudio = public_path('/audio/myaudio.mp3');
$outputAudio = public_path('/output/outputAudio.mp3');
exec("ffmpeg -i $inputAudio -ab 64 $outputAudio");
// Video compress
$inputVideo = public_path('/audio/myvideo.mp4');
$outputVideo = public_path('/output/outputVideo.mp4');
exec("ffmpeg -i $inputVideo -ab 64 $outputVideo");
Upvotes: 0
Reputation: 89
Well, ffmpg use terminal commands so if you can just it just like that. You have many options for that. Some example are: http://php.net/manual/ru/function.shell-exec.php http://symfony.com/doc/current/components/process.html
Or see this documentation for Laravel https://laravel.com/docs/5.6/artisan
Upvotes: 0
Reputation: 63
you can find the documentation here. its not dificult to understand.
ffmpeg documentation from laravel
if you have any thoughts just ask
Upvotes: 1