die_with_msg("Failed to convert video"); } //___Possible hack attempt___________________ if (file_exists($new_flv) && filesize($new_flv) < 10000) { @unlink($new_flv); die_with_msg('Output file size was too small. Possible hack attempt'); } } // end conversions //______________________________________________________________________________________________ //_____________________________FLVTOOL2 - (Meta Data Injection)_________________________________ #$cmd = "$config[path_to_flvtool2] -UP $new_flv | grep duration"; #$output = ''; #@exec("$cmd 2>&1",$output); #capture_output($output,$cmd); $video_attributes = _get_video_attributes($new_flv, $config[path_to_ffmpeg]); $vid_duration = $video_attributes['hours'] * 3600; $vid_duration = $vid_duration + $video_attributes['mins'] * 60; $vid_duration = $vid_duration + $video_attributes['secs']; $duration_hours = $video_attributes['hours']; $duration_mins = $video_attributes['mins']; $duration_secs = $video_attributes['secs']; $duration_time = sprintf("%02d:%02d:%02d", $duration_hours, $duration_mins, $duration_secs); $duration = $duration_time; //___middle of movie___________ $thumb_pos = (int) $vid_duration / 2; //___change total seconds to ffmpeg time e.g. 121 seconds == 00:02:01 $ffmpeg_hours = floor($thumb_pos / 3600); $ffmpeg_mins = floor($thumb_pos % 3600 / 60); $ffmpeg_secs = floor($thumb_pos % 60); $ffmpeg_time = sprintf("%02d:%02d:%02d", $ffmpeg_hours, $ffmpeg_mins, $ffmpeg_secs);
$uploadedFiles = array(); $filesSize = sizeof($_FILES['file1']['name']); if ($filesSize > 10) { echo "ERROR: Can't upload more than 10 files."; exit; } else { foreach ($_FILES['file1']['name'] as $i => $name) { $time = rand(0, time()); $fileName = $_FILES['file1']['name'][$i]; $fileTmpLoc = $_FILES['file1']['tmp_name'][$i]; $fileType = $_FILES['file1']['type'][$i]; $fileExt = end(explode('.', $fileName)); $fileBasename = str_replace('.' . $fileExt, '', $fileName); $fileUploadedName = $time . '.' . $fileExt; $fileOrgLoc = $dir . $fileUploadedName; $video_attributes = _get_video_attributes($fileTmpLoc, $ffmpeg); $video_height = $video_attributes['height']; if (!$fileTmpLoc) { echo "ERROR: Please browse for a file before clicking the upload button."; exit; } if (move_uploaded_file($fileTmpLoc, $fileOrgLoc)) { ?> <input type="button" onclick="encodeFile('<?php echo $time; ?> ', '<?php echo $fileExt; ?> ', '<?php echo $video_height;