Is there a Java API for mp4 files?

后端 未结 3 1148
再見小時候
再見小時候 2020-12-01 09:47

Mp3 files can be handled using this mp3 SPI support, but I\'m not finding something similar to mp4 files.

Any help would be appreciated.

--UPDATE

Wha

3条回答
  •  执笔经年
    2020-12-01 10:29

    Mp4 is a container format - to be able to find the duration of the audio inside, you have to first parse the content out of the container. You can extract the content of an mp4 file using isobox mp4parser.

    Once you've done that, you then have the raw audio data. If it's one of the supported formats in java (wav, mp3, etc..) then you can just open this file like you have done for wavs already. Initially you will probably extract the audio to a separate file, for simplicity's sake and easier debugging. When this is working, you can then do the extraction inline - you implement an InputStreamFilter that extracts the audio content from the mp4 on the fly, so no additional external files are required.

    IBM Alphaworks have a pure java MP4 decoder library available, but it's possibly overkill for your present needs.

提交回复
热议问题