Get mime type for MediaSource.isTypeSupported

How do I get the Mime type Do I need to pass MediaSource.isTypeSupported using ffprobe / ffmpeg?

For example, true returned on my computer:

 MediaSource.isTypeSupported('video/mp4; codecs="avc1.64000d,mp4a.40.2"') 

whereas

 MediaSource.isTypeSupported('video/mp4') 

I am not sure how to get what will correspond to the avc1.64000d,mp4a.40.2 for this video. Here is a larger list of how this piece might look.

ffprobe -show_streams -i video.mp4 returns a number of interesting information, including

 codec_type=video codec_time_base=1/40 codec_tag_string=avc1 codec_tag=0x31637661 

and

 codec_type=audio codec_time_base=1/48000 codec_tag_string=mp4a codec_tag=0x6134706d 

I'm not sure if I need to go with 'video/mp4; codecs="avc1.0x31637661,mp4a.0x6134706d"' 'video/mp4; codecs="avc1.0x31637661,mp4a.0x6134706d"' , since it returns false , and I don’t know if this is due to the fact that this is not an excluded argument or because the video is really not supported.

+6
source share
2 answers

Using Bento4 , I can get the Mime type with

 mp4info video.mp4 | grep Codec 

This will return something like

 Codecs String: avc1.64001F Codecs String: mp4a.40.2 

And then do

 MediaSource.isTypeSupported('video/mp4; codecs="avc1.64001F,mp4a.40.2"') 

which returns true :)

Bento4 focuses on mp4 , so I'm not sure how it will work in other formats

+5
source

Any other way to convert part 0x31637661 to avc1.64001F ?

EDIT: since I did not install Apple Xcode and do not intend to - I found the javascript MP4Box project the best way to find codec information in the right format:

http://download.tsi.telecom-paristech.fr/gpac/mp4box.js/filereader.html

+1
source

All Articles