Compressing videos and uploading in php -


hello have built web application allows users upload videos, trying compress videos before uploading them save bandwidth. please how go these? e.g, in pictures compression gd library in video searched post on youtube , stack overflow, none answers question these code. note:these code works trying compress video before upload in php. in advance..

i looked @ post server-side video conversion , compression not looking because have never worked ffmpeg

               <?php include "connect.php"; ?>   <?php  if ((isset($_post['videoname'])) && (isset($_post['aboutvideo'])) && (isset($_post['timestart'])) && (isset($_post['timestop'])) && (isset($_post['streamersid']))){  $videoname=$_post['videoname'];  $aboutvideo=$_post['aboutvideo']; $timestart=$_post['timestart']; $timestop=$_post['timestop']; $streamersid=$_post['streamersid']; $streamerstype=$_post['streamerstype']; $streamersname=$_post['streamersname']; $date=$_post['date'];   $filename = $_files["file1"]["name"]; //file name  $filetmploc = $_files["file1"]["tmp_name"]; //file in php tmp folder  $filetype = $_files["file1"]["type"];   //the type of file  $filesize = $_files["file1"]["size"]; //file size in bytes  $fileerrormsg = $_files["file1"]["error"];  //0 false , 1 true  $tex = pathinfo($filename, pathinfo_extension); //get video extension  if($tex=='mp4' || $tex=='avi' || $tex=='webm' || $tex=='flv' || $tex=='mp4' || $tex=='3gp') {  $rand = substr(md5(microtime()),rand(0, 26) , 26);  @$filez = $rand.$_files['file1']['name'];   $videoname= mysqli_real_escape_string($con, $videoname); $aboutvideo= mysqli_real_escape_string($con, $aboutvideo); $timestart = mysqli_real_escape_string($con, $timestart); $timestop = mysqli_real_escape_string($con, $timestop);   //compression script here video compressed before path being being saved database , moved folder  if(move_uploaded_file($filetmploc, "plays/$filez")){     $insert="insert `plays`(`streamers_id`, `file1`, `video_name`, `about_video`, `streamers_type`, `time_start`, `time_stop`, `date`, `streamers_name`) values ('$streamersid','$filez','$videoname','$aboutvideo','$streamerstype','$timestart','$timestop','$date','$streamersname')"; $run=mysqli_query($con, $insert); echo "upload complete "; } else {      echo "upload failed"; }  } else { echo "invalid video";    }    } ?> 

you looking compress before upload, must done using code running on client. php runs on server. therefore, must write sort of app user can download can compress , upload.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -