Video playback in Java ( JMF, Fobs4JMF, Xuggler, FMJ )

后端 未结 6 565
一向
一向 2020-12-24 07:27

I need simple video playback in Java.

Here are my requirements:

  • PRODUCTION QUALITY

  • Open and decode video files whose video and audio

相关标签:
6条回答
  • 2020-12-24 07:33

    In my mind, VLCJ is the way forward for this type of thing. I love Xuggler for encoding / transcoding work, but unfortunately it's just so complicated to do simple playback and solve all the sync issues and suchlike - and it does very much feel like reinventing the wheel doing so.

    The only thing with VLCJ is that to get it to work reliably with multiple players I've had to resort to out of process players. The framework wasn't the simplest thing in the world to get in place, but when it's there it works beautifully. I'm currently running 3 out of process players in my app side by side with no problems whatsoever.

    The other caveat is that the embedded media player won't work with a swing component, just a heavyweight canvas - but that hasn't proven a problem for me at all. If it does, then you can use the direct media player to get a bufferedimage and display that on whatever you choose, but it will eat into your CPU a bit more (though no more than other players that take this approach.)

    0 讨论(0)
  • 2020-12-24 07:37

    haven't tried Xuggler (which i'm interested in) but I'm having a good time with VLCJ. The drawback I find in it is only that you have to have VLC installed prior to your application.

    0 讨论(0)
  • 2020-12-24 07:40

    I'd recommend using MPV. You can use it in combination with JavaFX quite easily, see this example.

    In short, you use a little JNA magic to use the MPV native libaries directly, and then let the video display on a JavaFX stage. If you use a child stage, you can even overlay JavaFX controls on top of the video (with full transparancy support).

    VLC (with VLCJ) can be used in a similar fashion, but I find that the MPV solution performs better (faster seek and start times).

    0 讨论(0)
  • 2020-12-24 07:44

    Can a brother get a shout out for Xuggler?

    0 讨论(0)
  • 2020-12-24 07:52

    JavaFX has a number of working video and audio codecs builtin. It's likely to be the solution with the broadest support at the moment.

    0 讨论(0)
  • 2020-12-24 07:59

    I've been using jffmpeg in the same way you use FOBS, it works pretty well, although I haven't compared them.

    I would also love to see an easy way to interface with native codecs the way that JavaFX does, but there doesn't seem to be real integration between JavaFX and Java.

    There has also been some work trying to get the VLC library libvlc into java. I haven't tried it yet and would be interested to hear back from anyone who has.

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