Is there a way a video can be encoded on its own when uploaded into server

Hema-Sama

New Member
Below is my code where it uploads a file into a server and stores the names of each uploaded file into the db:\[code\]<?php // connect to the database include('connect.php'); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); die(); } if ($_FILES['fileVideo']['error'] === UPLOAD_ERR_OK) { $result = 0;if( file_exists("VideoFiles/".$_FILES['fileVideo']['name'])) { $parts = explode(".",$_FILES['fileVideo']['name']); $ext = array_pop($parts); $base = implode(".",$parts); $n = 2; while( file_exists("VideoFiles/".$base."_".$n.".".$ext)) $n++; $_FILES['fileVideo']['name'] = $base."_".$n.".".$ext; move_uploaded_file($_FILES["fileVideo"]["tmp_name"], "VideoFiles/" . $_FILES["fileVideo"]["name"]); $result = 1;} else { move_uploaded_file($_FILES["fileVideo"]["tmp_name"], "VideoFiles/" . $_FILES["fileVideo"]["name"]); $result = 1; } $videosql = "INSERT INTO Video (VideoFile) VALUES (?)"; if (!$insert = $mysqli->prepare($videosql)) { // Handle errors with prepare operation here } //Assign the variable$vid = 'VideoFiles/'.$_FILES['fileVideo']['name']; //Dont pass data directly to bind_param store it in a variable$insert->bind_param("s",$vid); $insert->execute(); $id = $mysqli->insert_id; if ($insert->errno) { // Handle query error here } $insert->close(); }else{ echo "Upload was not successful"; }?> <script language="javascript" type="text/javascript"> window.top.stopVideoUpload(<?php echo $result; ?>,'<?php echo $id; ?>', '<?php echo $_FILES['fileVideo']['name']; ?>'); </script> </body></html>\[/code\]Now I am using a jwplayer and it requires video files to match video formats on this page:http://www.longtailvideo.com/suppor...h-v5/12539/supported-video-and-audio-formats/So I need to be able to encode files automatically on the server when the file is uploaded into the server. I do not want the user to try and encode a video file manually by themseleves, I want it done automatically. But my question is how can I get automatic server side file encoding to work?I have a demo showing how a video file is uploaded: DEMOTo use Demo:[*]Click on \[code\]Add Question\[/code\] button and file input will appear in table[*]Click on upload straightaway and you will see a simple validation stating which video file format are allowed (this is simply done by checking video file extension)[*]Browse for a video file, select and then click on \[code\]Upload\[/code\] and wait for upload to finish (I recommend a short video file for saving time). When file is uploaded it will display success message and video file is uploaded into server,
 
Back
Top