Is there a JAVA API for extract MP4 Metadata

人盡茶涼 提交于 2019-11-29 05:18:15
Churk

I actually found what I was looking for using Mp4Parser

here is a simple lines of code to get what I wanted using Mp4Parser

FileChannel fc = new FileInputStream("content/Video_720p_Madagascar-3.mp4").getChannel();
IsoFile isoFile = new IsoFile(fc);
MovieBox moov = isoFile.getMovieBox();
for(Box b : moov.getBoxes()) {
    System.out.println(b);
}

b contains all the info I needed, now I just have to parse b to get exactly what I want.

At present (2015), Android SDK provides MediaMetadataRetriever class for extracting metadata:

        MediaMetadataRetriever m = new MediaMetadataRetriever();
        m.setDataSource(mInputFile);
        String extractedHeight = m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT);
        String extractedWidth = m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!