I am using laravel famework and i am using ffmpeg PHP library. If have not found any good links for video compression using ffmpeg. There are two cases of compression.
1) Video Already exists in folder - this i have done already
2) Video Upload through Form - this i am not able to do :(
Lets i am sharing 1st case code:-
Suppose my video is 13Mb and below code compressed to 4.5Mb (running fine)
$inputVideo = public_path('input/airplane_flight_airport_panorama_1080.mp4');
$outputVideo = public_path('uploads/output.mp4');
exec("ffmpeg -i $inputVideo -b 1000000 $outputVideo"); // this compressing or resize the video
Now second case is uploading using form:-
<form method="post" action="{{url('/api/upload-test-video')}}" enctype="multipart/form-data">
<input name="video" type="file"><br>
<input type="submit" value="Submit">
</form>
Now when i go to function:-
public function uploadTestVideo(Request $request){
echo "<pre>"; print_r($_FILES);
// now in this function i wnat to compress the video
}
Note:- I don't want to upload video in some folder and after that get the video and compress the video. Please help how can i resolve this problem. Thanks in advance :)