本帖最后由 napoleonjk 于 2014-11-16 16:40:50 编辑

解决方案 »

  1.   

    怎么,没人回帖啊,以下是我在stackoverflow搜的资料,使用了别人的代码,感觉代码导出视频效率低!
    http://stackoverflow.com/questions/9334062/recommended-java-library-for-creating-a-video-programmatically
    http://www.randelshofer.ch/blog/2010/10/writing-quicktime-movies-in-pure-java/Question:
    Can anyone recommend a Java library that would allow me to create a video programmatically? Specifically, it would do the following:
    take a series of BufferedImages as the frames
    allow a background WAV/MP3 to be added
    allow 'incidental' WAV/MP3s to be added at arbitrarily, programmatically specified points
    output the video in a common format (MPEG etc)
    Can anybody recommend anything? For the picture/sound mixing, I'd even live with something that took a series of frames, and for each frame I had to supply the raw bytes of uncompressed sound data associated with that frame.
    P.S. It doesn't even have to be a "third party library" as such if the Java Media Framework has the calls to achieve the above, but from my sketchy memory I have a feeling it doesn't.Answer:
    I've used the code mentioned below to successfully perform items 1, 2, and 4 on your requirements list in pure Java. It's worth a look and you could probably figure out how to include #3.
    http://www.randelshofer.ch/blog/2010/10/writing-quicktime-movies-in-pure-java/I found a tool called ffmpeg which can convert multimedia files form one format to another. There is a filter called libavfilter in ffmpeg which is the substitute for vhook which allows the video/audio to be modified or examined between the decoder and the encoder. I think it should be possible to input raw frames and generate video. I researched on any java implementation of ffmpeg and found the page titled"Getting Started with FFMPEG-JAVA" which is a JAVA wrapper around FFMPEG using JNA.
    Why not use FFMPEG?
    There seems to be a Java wrapper for it:
    http://fmj-sf.net/ffmpeg-java/getting_started.php
    Here is an example of how to compile various media sources into one video with FFMPEG:
    http://howto-pages.org/ffmpeg/#multiple
    And, finally, the docs:
    http://ffmpeg.org/ffmpeg.html
      

  2.   

    从视频导出的效率来讲,我决定放弃使用别人普通类库或者FMJ类库开发,我看看能不能试试开发adobe premiere的插件来完成这个任务。