简体   繁体   English

PHP ffmpeg获取元数据缺少标题,作者,评论,艺术家

[英]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. 我一直在尝试使用php5-ffmpeg扩展名获取远程mp3(和其他格式)元数据。

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. 我确实找到了该补丁http://cvs.pld-linux.org/cgi-bin/viewvc.cgi/cvs/packages/php-ffmpeg/tests-metadata-api.patch ,我认为可以解决此问题,但是我即使没有补丁也无法编译php-ffmpeg,因此无法解决是否可以解决问题。

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. 我正在考虑仅使用'-i'选项解析ffmpeg itelf的输出,因为这确实会返回正确的元数据。 Just a bit wary of calling exec in PHP for security reasons. 出于安全原因,在PHP中调用exec时要谨慎。

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. 请查看https://github.com/char0n/ffmpeg-php,获取基于OO PHP的包装ffmpeg的解决方案。 It removes the need for php-ffmpeg and it has been working for me. 它消除了对php-ffmpeg的需求,并且一直为我服务。

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 如果您想获取远程信息,请在此处查看我的叉子: 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. 我确实在我的fork中添加了名称空间,并删除了自动加载器和旧的php-ffmpeg适配器,以防万一您需要该功能或正在运行<5.3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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