How to read information from .3gp and .mp4 using ffmpeg-php?

I have a problem with ffmpeg-php. I'm trying to get some information from video files and it works fine with file formats like .avi, .mpg, or .flv, but when I try to use .3gp or .mp4 in:

$movie = new ffmpeg_movie('path/to/file/test.3gp');

      

I get an error:

ffmpeg_movie::__construct() []: ISO: File Type Major Brand: 3gp5 

      

or

ffmpeg_movie::__construct() []: ISO: File Type Major Brand: mp42 

      

I installed ffmpeg-php on WAMP using the instructions found here: How to install FFMpeg in WampServer 2.0 (Windows XP)

I need this information to send them to ffmpeg using exec (). Can anyone help me?

+2


a source to share


2 answers


You can also take a pure php approach using PHP reader



+1


a source


When installing the ffmpeg plugin on the server, we basically have the "ffprobe" library. Using ffprobe we can get the details / metadata about the video.



$ffprobe_path="ffprobe"; //path to installation of ffprobe
$video_file="/home/testsite/public_html/videos/mytest_video.mp4"; //path to the specific video file

$ffprobe_cmd=$ffprobe_path." -v quiet -print_format json -show_format -show_streams ".$video_file;  
$outputprobe = shell_exec($ffprobe_cmd);  
$result_video_meta = json_decode($outputprobe);
echo "<pre>";
print_r($result_video_meta);
echo "</pre>";

      

0


a source







All Articles