简体   繁体   中英

PHP ffmpeg fetch metadata missing title, author, comment, artist

I've been trying to fetch remote mp3 (and other format) meta data using the php5-ffmpeg extension.

It is working although I am always missing the title, author, comment, artist details.

I've been scouring the web for an answer but not found any solution.

I did find this patch http://cvs.pld-linux.org/cgi-bin/viewvc.cgi/cvs/packages/php-ffmpeg/tests-metadata-api.patch which I thought may solve the problem, but I've been unable to compile php-ffmpeg even without the patch so haven't been able to work out if it will fix the problem.

It seems this extension was abandoned a couple of years ago so I'm not holding out much hope of getting this working.

Does anyone have any ideas of how to get remote meta data from audio video files using other tools?

I am thinking of just parsing the output of ffmpeg itelf using the '-i' option as this does return the correct meta data. Just a bit wary of calling exec in PHP for security reasons.

I found a solution to this problem after trying out a few other old bits of code lying around the web.

Check out https://github.com/char0n/ffmpeg-php for an OO PHP based solution that wraps ffmpeg. It removes the need for php-ffmpeg and it has been working for me.

I am only interested in retrieving remote file information and had to make a very minor modification for it to work with remote files, but it is working well and can now do the following and it returns correct info!

$movie = new FFmpegMovie('URI');
$title = $movie->getTitle();
$author = $movie->getAuthor();

If you want to fetch remote info check out my fork here: https://github.com/chrismacp/ffmpeg-php

I did add namespaces to my fork, and remove the autoloader and old php-ffmpeg adapters, just in case you need that functionality or are running < 5.3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM