Initila Import
This commit is contained in:
		
				commit
				
					
						11345d6367
					
				
			
		
					 17 changed files with 773 additions and 0 deletions
				
			
		
							
								
								
									
										52
									
								
								src/FFMpeg/FFProbe.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/FFMpeg/FFProbe.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,52 @@ | |||
| <?php | ||||
| 
 | ||||
| namespace FFMpeg; | ||||
| 
 | ||||
| class FFProbe extends Binary | ||||
| { | ||||
| 
 | ||||
|     public function probeFormat($pathfile) | ||||
|     { | ||||
|         if ( ! is_file($pathfile)) | ||||
|         { | ||||
| 
 | ||||
|             throw new \RuntimeException($pathfile); | ||||
|         } | ||||
| 
 | ||||
|         $cmd = $this->binary . ' ' . $pathfile . ' -show_format'; | ||||
| 
 | ||||
|         return $this->executeProbe($cmd); | ||||
|     } | ||||
| 
 | ||||
|     public function probeStreams($pathfile) | ||||
|     { | ||||
|         if ( ! is_file($pathfile)) | ||||
|         { | ||||
|             throw new \RuntimeException($pathfile); | ||||
|         } | ||||
| 
 | ||||
|         $cmd = $this->binary . ' ' . $pathfile . ' -show_streams'; | ||||
| 
 | ||||
|         return $this->executeProbe($cmd); | ||||
|     } | ||||
| 
 | ||||
|     protected function executeProbe($command) | ||||
|     { | ||||
|         $process = new \Symfony\Component\Process\Process($command); | ||||
| 
 | ||||
|         $process->run(); | ||||
| 
 | ||||
|         if ( ! $process->isSuccessful()) | ||||
|         { | ||||
|             throw new \RuntimeException('Failed to probe'); | ||||
|         } | ||||
| 
 | ||||
|         return $process->getOutput(); | ||||
|     } | ||||
| 
 | ||||
|     protected static function getBinaryName() | ||||
|     { | ||||
|         return 'ffprobe'; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue