1

Alright, I am currently working on a php page that can stream any video on the fly. As a part of its continued development, I decided to add the MIME type to the source tag, but ran into a bit of an issue.

I know how to get the MIME type of a file, at its most basic level.

echo 'type=\''.finfo_file(finfo_open(FILEINFO_MIME_TYPE),$videofolder.$file).'\'';

This works fine, and displays the proper MIME type without issue.

type='video/mp4'

But I wanted to take this to the next level, displaying the codec as well, like this:

type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'

So I tried this:

echo 'type=\''.finfo_file(finfo_open(FILEINFO_MIME_TYPE),$videofolder.$file).'; codecs="'.exec('mediainfo --Output="Video;%Format%" "'.$videofolder.$file.'"').', '.exec('mediainfo --Output="Audio;%Format%" "'.$videofolder.$file.'"').'"\'';

And it resulted in this:

type='video/mp4; codecs="AVC, AAC"'

Not what I wanted, obviously. What I need is to fetch the codec information in the proper MIME format, which it doesn't seem mediainfo is capable of doing. In fact, I can't find a single application that can.

Apparently, many formats, specifically those in the mp4 container, use unique strings that define not only the format, but the profile. And I have no way to find out what that string is!

There has to be a way to do this. It doesn't seem like it should be this complicated. Surely if the MIME type is used anywhere, it should be possible to find out what the MIME type is! Can someone out there help? In any way!?

0 Answers0