Is there a Java API for mp4 files?

后端 未结 3 1145
再見小時候
再見小時候 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:26

    You don't specify what you want to do. If you just want to play the files, you can use MPlayer and control it remotely via the ProcessBuilder API and stdio.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-01 10:33

    Xuggler ( http://www.xuggle.com/xuggler/ ) provides about the best Java wrapper for FFMPEG that I've seen - it'll let you decode the images out of almost any file, and then do whatever you like with them.

    0 讨论(0)
提交回复
热议问题