Java Media Framework
   HOME

TheInfoList



OR:

The Java Media Framework (JMF) is a Java
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
that enables audio, video and other time-based media to be added to
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
applications and applets. This optional package, which can capture, play, stream, and transcode multiple
media formats Media may refer to: Communication * Media (communication), tools used to deliver information or data ** Advertising media, various media, content, buying and placement for advertising ** Broadcast media, communications delivered over mass el ...
, extends the
Java Platform, Standard Edition Java Platform, Standard Edition (Java SE) 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). The platform uses Ja ...
(Java SE) and allows development of cross-platform multimedia applications.


Versions and licensing

An initial, playback-only version of JMF was developed by
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
,
Silicon Graphics Silicon Graphics, Inc. (stylized as SiliconGraphics before 1999, later rebranded SGI, historically known as Silicon Graphics Computer Systems or SGCS) was an American high-performance computing manufacturer, producing computer hardware and soft ...
, and
Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California. It is the world's largest semiconductor chip manufacturer by revenue, and is one of the developers of the x86 seri ...
, 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
codec A codec is a device or computer program that encodes or decodes a data stream or signal. ''Codec'' is a portmanteau of coder/decoder. In electronic communications, an endec is a device that acts as both an encoder and a decoder on a signal or da ...
s, 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 applet Java applets were 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. The user launched the Java applet from a ...
s and
Java Web Start In computing, Java Web Start (also known as JavaWS, javaws or JAWS) is a deprecated framework developed by Sun Microsystems (now Oracle) that allows users to start application software for the Java Platform directly from the Internet using a web br ...
, which have access to the full JMF in the web browser's or appletviewer's underlying JRE.JMF FAQ
/ref> 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 A jar is a rigid, cylindrical or slightly conical container, typically made of glass, ceramic, or plastic, with a wide mouth or opening that can be closed with a lid, screw cap, lug cap, cork stopper, roll-on cap, crimp-on cap, press-on cap, ...
files, and shell scripts to launch four JMF-based applications: * JMStudio - A simple player GUI * JMFRegistry - A GUI for managing the JMF "registry," which manages preferences, plug-ins, etc. * JMFCustomizer - Used for creating a JAR file that contains only the classes needed by a specific JMF application, which allows developers to ship a smaller application. * JMFInit 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. In January 2011, Tudor Holton of Bentokit Project released a
Debian package deb is the format, as well as extension of the software package format for the Debian Linux distribution and its derivatives. Design Debian packages are standard Unix ar archives that include two tar archives. One archive holds the control ...
for the JMF to alleviate difficulties that had arisen over time when installing the JMF on
Debian Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of D ...
and
Ubuntu Ubuntu ( ) is a Linux distribution based on Debian and composed mostly of free and open-source software. Ubuntu is officially released in three editions: ''Desktop'', ''Server'', and ''Core'' for Internet of things devices and robots. All the ...
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. A similar
Debian package deb is the format, as well as extension of the software package format for the Debian Linux distribution and its derivatives. Design Debian packages are standard Unix ar archives that include two tar archives. One archive holds the control ...
installer for the JMF MP3 Plugin was also built in February 2011.


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-2 (a.k.a. H.222/H.262 as was defined by the ITU) is a standard for "the generic video coding format, coding of moving pictures and associated audio information". It describes a combination of Lossy compression, lossy video compression and ...
,
MPEG-4 MPEG-4 is a group of international standards for the compression of digital audio and visual data, multimedia systems, and file storage formats. It was originally introduced in late 1998 as a group of audio and video coding formats and related tec ...
,
Windows Media Windows Media is a discontinued multimedia framework for media creation and distribution for Microsoft Windows. It consists of a software development kit (SDK) with several application programming interfaces (API) and a number of prebuilt technolo ...
,
RealMedia RealMedia is a proprietary multimedia container format created by RealNetworks with the filename extension . RealMedia is generally used in conjunction with RealVideo and RealAudio, while also being used for streaming content over the Internet. T ...
, most
QuickTime QuickTime is an extensible multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. Created in 1991, the latest Mac version, QuickTime X, is avai ...
movies,
Flash Flash, flashes, or FLASH may refer to: Arts, entertainment, and media Fictional aliases * Flash (DC Comics character), several DC Comics superheroes with super speed: ** Flash (Barry Allen) ** Flash (Jay Garrick) ** Wally West, the first Kid ...
content newer than Flash 2, and needs a plug-in to play the ubiquitous
MP3 MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio developed largely by the Fraunhofer Society in Germany, with support from other digital scientists in the United States and elsewhere. Origin ...
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. 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. Platforms beyond those that Oracle provides support to are left to their corresponding JRE vendors. While Sun still provides a forum for discussion of its implementation, there have been several efforts to implement open-source alternatives.Xuggler
An open-source java plugin that supports additional codecs and is automatically kept up to date wit
FFMPEG
/ref>


Alternatives

Depending on a developer's needs, several other libraries may be more suitable than JMF. These include: * Freedom for Media in Java (FMJ) An API-compatible with JMF open source alternative *
QuickTime for Java 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 ...
* IBM Toolkit for MPEG-4 * Jffmpeg * vlcj * gstreamer-java *
Cortado A cortado is a beverage consisting of espresso mixed with a roughly equal amount of warm milk to reduce the acidity. The milk in a cortado is steamed, but not frothy and "texturized" as in many Italian coffee drinks. The cortado comes from Spain, ...
, a complete player for Ogg Vorbis and Theora in a Java applet * Directshow <> Java Wrapper * JLayer MP3 library * Video4Linux4Java


Code example

The following example shows an AWT file-selection dialog, and attempts to load and play the media file selected by the user. import javax.media.*; import java.io.File; import java.awt.*; public class TrivialJMFPlayer extends Frame 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.


References

{{Portal bar, Computer programming Java APIs Multimedia frameworks