mabogdan1981

Untitled

Apr 12th, 2016
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  1. <?php
  2. require_once ( "acces_baza.php" );
  3.  
  4. $folder = "../filme/test test";
  5. $pattern = "/^.*\.(mkv)$/";
  6. $dir = new RecursiveDirectoryIterator( $folder );
  7. $ite = new RecursiveIteratorIterator( $dir );
  8. $files = new RegexIterator( $ite , $pattern , RegexIterator::GET_MATCH );
  9. $fileList = array();
  10. echo '<pre>';
  11. print_r ($files);
  12. foreach ($files as $file) {
  13.  
  14.     $fileList[] = $file[ 0 ];
  15.  
  16. }
  17.  
  18. $arrlength = count ( $fileList );
  19.  
  20. for ($x = 0; $x < $arrlength; $x++) {
  21.    
  22.     if (( stripos ( $fileList[ $x ] , "sample" ) == true ) || ( stripos ( $fileList[ $x ] , ".@__thumb" ) == true )) {
  23.  
  24.             $fileList[ $x ] = "";
  25.  
  26.     } else {
  27.  
  28.         $filename = pathinfo ( $fileList[ $x ] , PATHINFO_FILENAME );
  29.         $director = pathinfo ( $fileList[ $x ] , PATHINFO_DIRNAME );
  30.         $ext = pathinfo ( $fileList[ $x ] , PATHINFO_EXTENSION );
  31.        
  32.         $video = $director."/".$filename.'.'.$ext; echo $video."<br>";
  33.         $new_video = $director."/".$filename.".mp4";
  34.        
  35.         if (!file_exists($new_video)) {
  36.        
  37.             $ffmpeg_path = '/opt/Qffmpeg/bin/ffmpeg';      
  38.            
  39.             exec($ffmpeg_path.' -i '.$video.' -vcodec copy -acodec copy '.$new_video);
  40.            
  41.             //unlink ($video);
  42.        
  43.         }
  44.  
  45.     }
  46. }
Add Comment
Please, Sign In to add comment