Question

Does anybody know a ready-made, reliable way to tell the dimensions (width x height) of a MP4 encoded using the H.264 codec without ffmpeg or similar extensions, in pure PHP?

Thanks for all the answers folks. The bounty is running out and I will not have time to check the offered solutions before it does. I will accept the solution that I feel has the greatest likelihood to work.

Was it helpful?

Solution

It sounds like http://code.google.com/p/php-mp4info/ might be your answer. It reads MP4's but it doesn't mention anything about H.264.

also, what OS are you using?

OTHER TIPS

getID3 is pure php and extracts an amazing amount of information from media files of all sorts. It will depend on what encoded your file in the first place as to what metadata is available and how reliable it is. getID3 has a nice demo page with lots of different file types. I tried to post more links but as a newbie I only get one.

What comes to mind:

  • mediainfo a huge project with GUI, but also has a CLI
  • mp4info (part of the seemingly defunct mp4mpeg project) is almost perfect for this
  • ffmpeg although this is overkill for the task. then again, you very well may need it for other tasks

php-reader is a full implementation of the ISO 14496 done in pure PHP. You can use this library to read all of the boxes which the mp4 consist of, like the moov atom containing metadata about the file.

Native PHP does not support anything like this, ffmpeg is only one library that come on my mind.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top