本文介绍了Java中的视频播放(JMF,Fobs4JMF,Xuggler,FMJ)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用Java进行简单的视频播放。

I need simple video playback in Java.

这是我的要求:


  • 制作质量

  • PRODUCTION QUALITY

打开并解码我可以选择视频和音频编解码器的视频文件。 IE我可以选择表现良好的编解码器。

Open and decode video files whose video and audio codecs can be chosen by me. I.E I can pick well behaving codecs.

能够播放暂停 seekToFrame seekToTime 停止播放。基本上我希望能够以非线性方式播放单个视频文件的片段。例如,我可能想要播放段20.3秒到25.6秒,暂停10秒然后播放段340.3秒到350.5秒等等。

Be able to play, pause, seekToFrame OR seekToTime and stop playback. Essentially I wish to be able to play segments of a single video file in a non linear fashion. For example I may want to play the segment 20.3sec to 25.6sec, pause for 10 seconds and then play the segment 340.3sec to 350.5sec, etc.

在播放过程中,视频和音频必须同步。

During playback, video and audio must be in sync.

视频必须显示在Swing JComponent中。

The video must be displayed in a Swing JComponent.

必须能够在商业产品中使用而无需开源(IE LGPL或Comercial是好的)

Must be able to use in a commercial product without having to be open source (I.E. LGPL or Comercial is good)

我的研究使我得到以下解决方案:

My research has led me to the following solutions:


  • 使用Java Media Framework + Fobs4JMF

  • Use Java Media Framework + Fobs4JMFhttp://fobs.sourceforge.net/f4jmf_first.html

我已经实现了一个快速原型,这似乎做了我需要的。我可以使用以下方式播放视频片段:

I have implemented a quick prototype and this seems to do what I need. I can play a segment of video using:

player.setStopTime(new Time(end));
player.setMediaTime(new Time(start));
player.start();

虽然Fobs4JMF似乎有效,但我觉得代码质量很差,项目不再活性。有没有人知道任何使用Fobs4JMF的产品?

While Fobs4JMF seems to work, I feel the quality of the code is poor and the project is no longer active. Does anyone know of any products which use Fobs4JMF?


  • 写一个播放的Flash应用程序视频并使用JFlashPlayer将其带入我的Java Swing应用程序

与Java不同,Flash在播放视频方面非常出色。我可以使用以下方法编写一个小型Flash应用程序:

Unlike Java, Flash is brilliant at playing video. I could write a small Flash application with the methods:

open(String videoFile),
play(),
pause(),
seek(int duration),
stop()

然后使用JFlashPlayer将其带入Java,JFlashPlayer可以从Java调用Flash函数。

Then bring it into Java using JFlashPlayer which can call Flash functions from Java.

我喜欢这个解决方案的是Flash中的视频播放应该坚如磐石。有人用JFlashPlayer用Java播放视频吗?

What I like about this solution is that video playback in Flash should be rock solid. Has anyone used JFlashPlayer to play video in Java?


  • 在顶部写一个简单的媒体播放器Xuggler

Xuggler是Java的FFMpeg包装器,它似乎是一个非常活跃和高质量的项目。然而,实现要求中描述的简单视频回放并不是微不足道的(特别是寻求),但是一些工作已经在MediaTools MediaViewer中完成,它将成为构建的基础。

Xuggler is an FFMpeg wrapper for Java which seems to be a quite active and high quality project. However, implementing the simple video playback described in the requirements is not trivial (Seeking in particular) but some of the work has been done in the MediaTools MediaViewer which would be the base upon which to build from.


  • 使用FMJ

我试图让FMJ工作但到目前为止没有成功。

I have tried to get FMJ to work but have had no sucess so far.

我很感激你对我的问题的看法。

I would appreciate your opinions on my problem.

推荐答案

兄弟可以为?

这篇关于Java中的视频播放(JMF,Fobs4JMF,Xuggler,FMJ)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:46