michelemarcon
michelemarcon

Reputation: 24767

How to manage required codec for JavaFX application?

I want to show a video (mp4) with JavaFX, which requires a codec to be installed on the target machine. How should I manage this situation? Bundle the codec? Ask the user to download and install it? And from where?

The application should be able to run on Win, Mac, Linux...

Upvotes: 1

Views: 952

Answers (1)

jewelsea
jewelsea

Reputation: 159416

You only need to manage the codec on Linux.

Background on supported configurations

See the supported system configurations for JavaFX media.

Windows 7&8: The pre-installed Microsoft AAC and H.264 DirectShow decoder filters are used by default.

Similarly for OS X, built-in codecs that ship with OS X will be used.

For Linux:

You must install GLIB 2.28 in order to run JavaFX Media . . . to support AAC audio, MP3 audio, H.264 video, and HTTP Live Streaming: libavcodec53 and libavformat53 on Ubuntu Linux 12.04 or equivalent. On Linux platforms, installing libavformat automatically causes libavcodec to be installed.

Also note:

VP6 video support does not require any third party modules.

So VP6 should work out of the box on any platform. However you are using MP4 containers, so VP6 encoding does not apply to you as that is for FLV containers.

Arbitrary codecs are not supported in JavaFX 8

You must let the JavaFX system use either a codec it provides or pick a pre-installed codec according to its internal algorithms. The following feature request is not currently scheduled for implementation:

Recommendation

Package your application as a self-contained application. For Linux, this will be a debian package or for redhat type systems it will be an rpm. Those packages can specify dependencies on libavformat and glibc so that the correct versions of those packages will be installed when you install your application (e.g. yum install your-app.rpm).

Upvotes: 1

Related Questions