PHPVideoToolkit getFFmpegInfo () returns an array with empty codecs

I have ffmpeg and ffmpeg -codecs returns a huge list of codecs. But the output of the following code:

  $ffmpeg = $toolkit->getFFmpegInfo(FALSE); print_r($ffmpeg); 

:

  ... [codecs] => Array ( [video] => Array ( ) [audio] => Array ( ) [subtitle] => Array ( ) ) 

He does not find the codec. Any suggestion? (I installed ffmpeg from source)

+4
source share
2 answers

You may not have configured (or incorrectly configured) the constant PHPVIDEOTOOLKIT_FFMPEG_BINARY ; it must be installed on the full path of the ffmpeg command. For instance:

 define('PHPVIDEOTOOLKIT_FFMPEG_BINARY', '/usr/bin/ffmpeg'); 

To determine the correct path, run the command which ffmpeg .
If you are using PHP5, you can find an example using the getFFmpegInfo() function in the examples / php5 / example09.php script.
Before running the example scripts, you need to edit the configuration file examples / example-config.php and configure various define using the correct paths for your system.
See the DEMOS file for a description of what each example does.

+1
source

I found that the version of FFMPEG used was displaying codecs in a different format, in the getFFmpegInfo method I had to change the following regular expression:

Original:

 / ((?:[DEVAST ]{6})|(?:[DEVASTFB ]{8})|(?:[DEVASIL\.]{6})) ([A-Za-z0-9\_]+) (.+)/ 

For my server:

 /([DEVASI\.]{4}) ([A-Za-z0-9\_]+) (.+)/ 
0
source

Source: https://habr.com/ru/post/1443647/


All Articles