PHP Video Library [duplicate]

0

Is there any library of videos in PHP? To get data like time the video was watched, paused, etc.

    
asked by anonymous 24.03.2016 / 19:10

1 answer

0

You can try getID3 , download it at link

require_once '<pasta aonde salvou o getid3>/getid3/getid3.php';

$filename = '<pasta aonde esta o video>/video.mp4';

$getID3 = new getID3;
$file = $getID3->analyze($filename);

echo 'Duração: ', $file['playtime_string'], PHP_EOL,
     'Resolução: ', $file['video']['resolution_x'], 'x', $file['video']['resolution_y'], PHP_EOL,
     'Bytes: ', $file['filesize'];

Or install ffmpeg and use combined with shell_exec() of PHP, example based on this response link :

function getDuration($path) {
     $response = shell_exec('ffmpeg -i ' . escapeshellarg($path) . ' 2>&1', $output);

     $parseduration = '/duration.*?([0-9]{1,})/';

     if (preg_match($parseduration, $response, $matches, PREG_OFFSET_CAPTURE, 3) > 0) {
         return $matches[1][0];
     }
}

echo 'Duração: ', getDuration('pasta/video.flv');
    
03.10.2016 / 22:03