Get mp4 info. Width, height....

btbb

Member
Licensed User
Longtime User
Hello all!

I'm currently working on a app that streams mp4 files. But i need some info about it before loading it.

Is it possible to get width and height of a video file (in this case mp4) from a file that is on the web?

/btbb
 

btbb

Member
Licensed User
Longtime User
There seems to be a way, but how do i do this in B4A?

---------------------------->--------------------
MetadataRetriever metaRetriever = new MetadataRetriever();
metaRetriever.setDatasource(/* file descriptor or file path goes here */);
String height = metaRetriever.extractMetadata(METADATA_KEY_VIDEO_HEIGHT);
String width = metaRetriever.extractMetadata(METADATA_KEY_VIDEO_WIDTH);
--------------------------->---------------------

/btbb
 
Upvote 0

btbb

Member
Licensed User
Longtime User
No, i'm not streaming from my own site. Then it would have been easy. I see that it is possible to get playing videowidth and videoheight with vitamio but i can't use it in my app.

I need to know width and height to be able to center the video image when playing. (on screen) Don't know if it is possible without knowing width and height of videostream.

/btbb
 
Upvote 0

JdV

Active Member
Licensed User
Longtime User
Hi

Was a solution found for this?

Is it possible to read a video file's resolution by using any of the file methods?

Regards

Joe
 
Upvote 0

JdV

Active Member
Licensed User
Longtime User
Further to my comment above a solution was found in this thread:

I have written the attached program which allows a user to navigate to a video file and display its height and width in a MsgBox. (Requires the Reflection and Dialogs libraries).

More details on the info that can be retrieved using the Android MediaMetadataRetriever class can be found here:

The MediaBrowser library by Informatix does much the same thing:

Regards

Joe
 

Attachments

  • VideoResolution.zip
    6.7 KB · Views: 302
Upvote 0
Top