Java Media Framework

Last updated
Java Media Framework
Developer(s) Sun Microsystems
Stable release
2.1.1e / May 23, 2003 (2003-05-23)
Written in Java
Operating system Cross-platform
Type Library for multimedia
Website Java Media Framework API (JMF), on Oracle.com

The Java Media Framework (JMF) is a Java library that enables audio, video and other time-based media to be added to Java applications and applets. This optional package, which can capture, play, stream, and transcode multiple media formats, extends the Java Platform, Standard Edition (Java SE) and allows development of cross-platform multimedia applications.

Contents

Versions and licensing

An initial, playback-only version of JMF was developed by Sun Microsystems, Silicon Graphics, and Intel, and released as JMF 1.0 in 1997. JMF 2.0, developed by Sun and IBM, came out in 1999 and added capture, streaming, pluggable codecs, and transcoding. JMF is branded as part of Sun's "Desktop" technology of J2SE opposed to the Java server-side and client-side application frameworks. The notable exceptions are Java applets and Java Web Start, which have access to the full JMF in the web browser's or appletviewer's underlying JRE. [1] [2]

JMF 2.0 originally shipped with an MP3 decoder and encoder. This was removed in 2002, and a new MP3 playback-only plug-in was posted in 2004.

JMF binaries are available under a custom license, and the source is available under the SCSL.

The current version ships with four JAR files, and shell scripts to launch four JMF-based applications:

JMF is available in an all-Java version and as platform-specific "performance packs", which can contain native-code players for the platform, and/or hooks into a multimedia engine specific to that platform. JMF 2.0 offers performance packs for Linux, Solaris (on SPARC) and Windows. [1]

In January 2011, Tudor Holton of Bentokit Project released a Debian package for the JMF to alleviate difficulties that had arisen over time when installing the JMF on Debian and Ubuntu Linux. This package does not contain the JMF, but presents the user with the JMF License, retrieves it from the Oracle website, and then installs it. [3] A similar Debian package installer for the JMF MP3 Plugin was also built in February 2011. [4]

Design concepts

JMF abstracts the media it works with into DataSources (for media being read into JMF) and DataSinks (for data being exported out). It does not afford the developer significant access to the particulars of any given format; rather, media is represented as sources (themselves obtained from URL's) that can be read in and played, processed, and exported (though not all codecs support processing and transcoding).

A Manager class offers static methods that are the primary point-of-contact with JMF for applications.

Criticism and alternatives

Many JMF developers have complained that the JMF implementation supplied in up-to-date JRE's supports relatively few up-to-date codecs and formats. 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. [5] While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. In particular, MS Windows-based JMF developers new to JMF often expect support for some newer formats on all platforms when such formats are only, in fact, supported on MS Windows.

While JMF is considered a very useful framework, the freely available implementation provided by Oracle is suffering from a lack of updates and maintenance. JMF does not get much maintenance effort from Oracle; the API has not been enhanced since 1999, and the last news item on JMF's home page was posted in September 2008. While JMF is built for extensibility, there are few such third-party extensions. Furthermore, content editing functionality in JMF is effectively non-existent. You can do simple recording and playback for audio and video, but the implementation provided by Oracle can do little else. [6]

Platforms beyond those that Oracle provides support to are left to their corresponding JRE vendors. [7] While Sun still provides a forum for discussion of its implementation, there have been several efforts to implement open-source alternatives. [8] [9] [10] [11] [12]

Alternatives

Depending on a developer's needs, several other libraries may be more suitable than JMF. These include:

Code example

The following example shows an AWT file-selection dialog, and attempts to load and play the media file selected by the user.

importjavax.media.*;importjava.io.File;importjava.awt.*;publicclassTrivialJMFPlayerextendsFrame{publicstaticvoidmain(String[]args){try{Framef=newTrivialJMFPlayer();f.pack();f.setVisible(true);}catch(Exceptione){e.printStackTrace();}}publicTrivialJMFPlayer()throwsjava.io.IOException,java.net.MalformedURLException,javax.media.MediaException{FileDialogfd=newFileDialog(this,"TrivialJMFPlayer",FileDialog.LOAD);fd.setVisible(true);Filef=newFile(fd.getDirectory(),fd.getFile());Playerp=Manager.createRealizedPlayer(f.toURI().toURL());Componentc=p.getVisualComponent();add(c);p.start();}}

Much of the example is involved with the building of the AWT GUI. Only two lines touch JMF. Manager.createRealizedPlayer() implicitly creates a DataSource from a URL representation of the file, creates a Player, and realizes it, meaning that all resources necessary for playback are allocated and initialized. The getVisualComponent() asks the Player for an AWT Component suitable for use in a GUI. If a control component were desired, it would be obtained with getControlPanelComponent() and added to the GUI separately. Note that the developer is not concerned with the format of the media - this code works equally well for any media format that JMF can import and read.

Related Research Articles

<span class="mw-page-title-main">Java applet</span> Small application written in Java

Java applets are small applications written in the Java programming language, or another programming language that compiles to Java bytecode, and delivered to users in the form of Java bytecode.

<span class="mw-page-title-main">Java (programming language)</span> Object-oriented programming language

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities that are typically not available in traditional compiled languages.

<span class="mw-page-title-main">XMMS</span> Free and open source audio player

X Multimedia System (XMMS) is an audio player for Unix-like systems released under a free software license.

Java Platform, Micro Edition or Java ME is a computing platform for development and deployment of portable code for embedded and mobile devices. Java ME was formerly known as Java 2 Platform, Micro Edition or J2ME.

Java Platform, Standard Edition is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).

Monkey's Audio is an algorithm and file format for lossless audio data compression. Lossless data compression does not discard data during the process of encoding, unlike lossy compression methods such as Advanced Audio Coding, MP3, Vorbis, and Opus. Therefore, it may be decompressed to a file that is identical to the source material.

<span class="mw-page-title-main">Swing (Java)</span> Java-based GUI toolkit

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.

The Connected Device Configuration (CDC) is a specification of a framework for Java ME applications describing the basic set of libraries and virtual-machine features that must be present in an implementation. The CDC is combined with one or more profiles to give developers a platform for building applications on embedded devices ranging from pagers up to set-top boxes. The CDC was developed under the Java Community Process as JSR 36 and JSR 218.

<span class="mw-page-title-main">GStreamer</span> Multimedia framework

GStreamer is a pipeline-based multimedia framework that links together a wide variety of media processing systems to complete complex workflows. For instance, GStreamer can be used to build a system that reads files in one format, processes them, and exports them in another. The formats and processes can be changed in a plug and play fashion.

Java TV is a Java-based software framework designed for use on TV set-top boxes, based on components called Xlets. It is currently used only on the Connected Device Configuration, specifically for iTV applications development.

A multimedia framework is a software framework that handles media on a computer and through a network. A good multimedia framework offers an intuitive API and a modular architecture to easily add support for new audio, video and container formats and transmission protocols. It is meant to be used by applications such as media players and audio or video editors, but can also be used to build videoconferencing applications, media converters and other multimedia tools. Data is processed among modules automatically, it is unnecessary for app to pass buffers between connected modules one by one.

In computing, Java Web Start is a deprecated framework developed by Sun Microsystems that allows users to start application software for the Java Platform directly from the Internet using a web browser. The technology enables seamless version updating for globally distributed applications and greater control of memory allocation to the Java virtual machine.

<span class="mw-page-title-main">Java (software platform)</span> Set of computer software and specifications

Java is a set of computer software and specifications that provides a software platform for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers. Java applets, which are less common than standalone Java applications, were commonly run in secure, sandboxed environments to provide many features of native applications through being embedded in HTML pages.

BD-J, or Blu-ray Disc Java, is a specification supporting Java ME Xlets for advanced content on Blu-ray Disc and the Packaged Media profile of Globally Executable MHP (GEM).

Media Foundation (MF) is a COM-based multimedia framework pipeline and infrastructure platform for digital media in Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, and Windows 11. It is the intended replacement for Microsoft DirectShow, Windows Media SDK, DirectX Media Objects (DMOs) and all other so-called "legacy" multimedia APIs such as Audio Compression Manager (ACM) and Video for Windows (VfW). The existing DirectShow technology is intended to be replaced by Media Foundation step-by-step, starting with a few features. For some time there will be a co-existence of Media Foundation and DirectShow. Media Foundation will not be available for previous Windows versions, including Windows XP.

QuickTime for Java or QTJ is a software library that allows software written in the Java programming language to provide multimedia functionality, by making calls into the native QuickTime library. In practice, it allows Java applications on Mac OS, Mac OS X and Microsoft Windows to support the capture, editing, playback, and export of many different media formats and codecs.

Comparison of the Java and .NET platforms.

<span class="mw-page-title-main">JavaFX</span> Java software platform for GUI

JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications that can run across a wide variety of devices. JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linux, and macOS, as well as mobile devices running iOS and Android, through Gluon Mobile.

The Java Class Library (JCL) is a set of dynamically loadable libraries that Java Virtual Machine (JVM) languages can call at run time. Because the Java Platform is not dependent on a specific operating system, applications cannot rely on any of the platform-native libraries. Instead, the Java Platform provides a comprehensive set of standard class libraries, containing the functions common to modern operating systems.

IcedTea is a build and integration project for OpenJDK launched by Red Hat in June 2007. IcedTea also includes some addon libraries: IcedTea-Web is a free software implementation of Java Web Start and the Java web browser applet plugin. IcedTea-Sound is a collection of plugins for the Java sound subsystem, including the PulseAudio provider which used to be included with IcedTea. The Free Software Foundation recommends that all Java programmers use IcedTea as their development environment.

References

  1. 1 2 JMF FAQ
  2. Java Media Framework API
  3. "Ubuntu installer for JMF". Launchpad. Retrieved 4 March 2011.
  4. "JMF Plugin installer for Debian" . Retrieved 4 March 2011.
  5. JMF 2.1.1 - Supported Formats
  6. JMF: A Mistake Asking to Be Re-Made by Chris Adamson, December 13, 2005
  7. Installation Instructions for JMF on Mac OS X
  8. JMF-Interest, the official discussion list Archived 2006-04-27 at the Wayback Machine
  9. Jffmpeg: A JMF open-source plugin to support additional codecs
  10. Fobs4JMF: Another JMF open source plugin to support additional codecs
  11. FMJ: An open-source replacement for/alternative to/implementation of JMF
  12. Xuggler: An open-source java plugin that supports additional codecs and is automatically kept up to date with FFMPEG