try{
//mp4 is path string of your mp4 file
IsoBufferWrapper isoBufferWrapper = new IsoBufferWrapper(new File(mp4));
IsoFile isoFile = new IsoFile(isoBufferWrapper);
isoFile.parse();
//Get FileTypeBox
ArrayList
FileTypeBox ftb =(FileTypeBox) boxes.get(0);
String major =ftb.getMajorBrand().trim().toLowerCase();
//The list of ftyps http://www.ftyps.com/
if(major.equals("m4a") || //Apple iTunes AAC-LC (.M4A) Audio
major.equals("msnv")|| //MPEG-4 (.MP4) for SonyPSP
major.equals("ndas")|| //MP4 v2 [ISO 14496-14] Nero Digital AAC Audio
major.equals("da1a")|| //DMB MAF audio with ER-BSAC audio, JPG/PNG/MNG images
major.equals("f4a")|| //Audio for Adobe Flash Player 9+ (.F4A)
major.equals("f4b")|| //Audio Book for Adobe Flash Player 9+ (.F4B)
major.equals("m4b")|| //Apple iTunes AAC-LC (.M4B) Audio Book
major.equals("m4p")|| //Apple iTunes AAC-LC (.M4P) AES Protected Audio
major.equals("bsac")|| //MPEG-4 "Bit Sliced Arithmetic Coding" (audio)
major.equals("mot slides") //Digital Audio Broadcasting (DAB) MOT slideshow (ETSI DAB TR 101 497)
){
//AUDIO FILE
}else{
//VIDEO FILE
}
}catch(IOException ex){
ex.printStackTrace();
//ERROR
}
Không có nhận xét nào:
Đăng nhận xét