How can I extract meta data from various video file formats?

后端 未结 2 674
北海茫月
北海茫月 2021-01-02 22:04

How can I extract meta data from various video file formats, especially the Resolution and the type of codec used. (But also all other stuff like author). I was not able to

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 22:33

    The vikiiii solutions works, but I found :

    • It still required a bit of work to get everything running on my desktop. (download the dll, extract the code, browse files...)
    • We have no clue of the constants (like "BitRate") available

    As a consequence I installed the Windows MediaInfo application and search which are the Keys available to create some java Enum and ease usage.

    I created a repository on github https://github.com/clun/movies-metadata to have everything in the same place. Just run mvn:test on the sample project to get informations on samples MP4, OGG, AVI, FLV, WEBM and MKV.

    Here the sample code of the test :

      MovieMetadata movieMedataData = new MovieMetadata("./src/test/resources/small.mkv");
        movieMedataData.get(General.FORMAT);
        movieMedataData.get(Video.DURATION_STRING);
        movieMedataData.get(Video.WIDTH_STRING);
        movieMedataData.get(Video.HEIGHT_STRING);
        movieMedataData.get(Video.BITRATE_STRING);
        movieMedataData.get(Audio.COMPRESSION_RATIO);
        //...
    

提交回复
热议问题