Java中的视频缩略图

时间:2020-03-05 18:48:54  来源:igfitidea点击:

我想用Java生成视频的缩略图预览。我主要是JMF,并且视频操作已经疏远了。

  • 有简单的方法吗?
  • 那编解码器呢?我需要处理吗?
  • 支持任何视频类型吗? (包括Quicktime)

解决方案

回答

我们确定JMF适合我们吗?不幸的是,它的形状不是特别好。除非我们已经致力于JMF,否则我们很可能需要研究替代方案。 Wikipedia在en.wikipedia.org/wiki/Java_Media_Framework上有不错的概述

Many JMF developers have complained that it supports few codecs and formats in modern use. Its all-Java version, for example, cannot play MPEG-2, MPEG-4, Windows Media, RealMedia, most QuickTime movies, Flash content newer than Flash 2, and needs a plug-in to play the ubiquitous MP3 format.  While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. Furthermore, Windows-based JMF developers can unwittingly think JMF provides support for more formats than it does, and be surprised when their application is unable to play those formats on other platforms.
  
  Another knock against JMF is Sun's seeming abandonment of it. The API has not been touched since 1999, and the last news item on JMF's home page was posted in November 2004.
  
  While JMF is built for extensibility, there are few such third-party extensions.
  
  Furthermore, editing functionality in JMF is effectively non-existent, which makes a wide range of potential applications impractical.

回答

似乎有一些例子比我要发送给例子要好得多。

参见http://krishnabhargav.blogspot.com/2008/02/processing-videos-in-java.html。

我同意斯图。如果我们可以找到一种方法来使用某些命令行工具(并使用Commons-Exec运行它们)来获取所需的内容,那么与依赖于本质上Java扩展的梵文相比,我们可能有更好的总体解决方案。

回答

@marcio我自己的服务器端应用程序使用FFmpeg进行编码。我98.42%的人肯定FFmpeg也会做快照。 (这是一个程序中的全部唱歌,全部跳舞的野兽。仅命令行选项就可以填充一本书。)

签出:ffmpeg.mplayerhq.hu

回答

好吧,由于我们不拘泥于JMF,我们是否考虑过Xuggler? Xuggler是一个Java API,在后台使用FFmpeg进行所有视频解码和编码。它是免费的,并获得LGPL许可。

实际上,我们有一个教程显示如何制作现有文件的缩略图