Get ID3 information from m4a file in PHP

I wrote some PHP code to pull ID3 tags from mp3 files. The next step is to do the same with .m4a files. From the research that I did, it looks like most m4a files do not use ID3, but instead use the โ€œatomsโ€ format.

Are there any PHP libraries that can parse these "atoms"? I saw some C # / C ++, but havent been able to find any PHP. Any other manuals or documentation would also be great.

thanks

+6
source share
2 answers

This project processes many audio file formats, including AAC (M4A - AAC): http://getid3.sourceforge.net/

hope this helps

+1
source

I encountered a similar problem not so long ago and looked around. The simplest and most effective method (in my opinion) is to use the exec command for additional information about multimedia.

I based my code on a forum post on longtailvideo http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/9448/how-to-get-video-duration-with- ffmpeg-and-php

<?php $videofile="/var/video/user_videos/partofvideo.avi"; ob_start(); passthru("/usr/bin/ffmpeg -i \"{$videofile}\" 2>&1"); $duration = ob_get_contents(); ob_end_clean(); $search='/Duration: (.*?),/'; $duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3); echo $matches[1][0]; <-- Duration ?> 

This script can handle everything that ffmpeg is ready to handle (that's a lot!). I know that the above example illustrates a video file, but it works great with audio as well

-1
source

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


All Articles