├── .gitignore ├── converted └── .gitkeep ├── index.php ├── original └── .gitkeep ├── process.php └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | converted/*.* 2 | original/*.* 3 | !.gitkeep 4 | 5 | .DS_Store 6 | .DS_Store? 7 | ._* 8 | .Spotlight-V100 9 | .Trashes 10 | ehthumbs.db 11 | Thumbs.db 12 | -------------------------------------------------------------------------------- /converted/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/perragnar/php-html5-video-converter/08341132951a35482051563808fd8709711b0236/converted/.gitkeep -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 |
5 | -------------------------------------------------------------------------------- /original/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/perragnar/php-html5-video-converter/08341132951a35482051563808fd8709711b0236/original/.gitkeep -------------------------------------------------------------------------------- /process.php: -------------------------------------------------------------------------------- 1 | 0, 'webm' => 0]; 7 | 8 | if(isset($_POST['submit'])) { 9 | if(move_uploaded_file($_FILES['file']['tmp_name'], $uploaded_file)) { 10 | // Make sure to get the correct path to ffmpeg 11 | // Run $ where ffmpeg to get the path 12 | $ffmpeg = '/usr/local/bin/ffmpeg'; 13 | 14 | // MP4 15 | $video_mp4 = $output_name . '.mp4'; 16 | exec($ffmpeg . ' -i "' . $uploaded_file . '" -c:v libx264 -an "./converted/' . $video_mp4 . '" -y 1>convert.txt 2>&1', $output, $convert_status['mp4']); 17 | 18 | // Debug 19 | // echo '' . print_r($output, 1) . ''; 20 | 21 | // WebM 22 | $video_webm = $output_name . '.webm'; 23 | exec($ffmpeg . ' -i "' . $uploaded_file . '" -c:v libvpx -c:a libvorbis -an "./converted/' . $video_webm . '" -y 1>convert.txt 2>&1', $output, $convert_status['webm']); 24 | 25 | // Debug 26 | // echo '
' . print_r($output, 1) . ''; 27 | } 28 | } 29 | ?> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |