Considering how 'OS X' is trying to target media applications like video and sound editing, it would seem to be a 'no brainer' to provide JMF with every Mac. When 'OS X' was first released, Steve Jobs made a lot of noise about how Apple's implementation of Java was going to be the best available, yet Apple has yet to deliver this great package. Apple is delivering H.264 with 'OS X' version 10.5 and could be the first company to provide H.264 support in JMF!
Will Apple take the lead?
Java 1.6.020 Jre; Java Media Framework 2.1.1e; Java3D 1.5.2 (MacOSX users click here) Download: The separate packages for Windows and Linux are only different with respect to some different argument conventions in the batch/script files. The Jar files themselves are identical and will run on any computer that has Java installed.
On Linux and other Unix-like systems, OpenOffice.org requires to install the Java Media Framework (JMF) in order to play sound and video.
This page explains how to install the Java Media Framework and how to configure it for OpenOffice.org.
- 2Installation
- 2.1Single user
Download
First we will download the required software. In the following examples, we suppose you download it to the usual directory (on Linux, it's named /home/user/Download [replace 'user' with your user name], although it may vary according to your locale - in Spanish, for example, it's /home/user/Descargas).
Download the JMF Performance Pack for Linux from Oracle's site:
Do not choose the *.zip version, but the *.bin (the latest is named jmf-2_1_1e-linux-i586.bin).
And download also the JMF MP3 Plugin, if you are interested in mp3 support (a quite common format nowadays). You can find it also in Oracle's site:
Installation
In this section we explain how to install the JMF. Instead of following the guidelines given in Sun's site, we try to show a more simple way.First, we give the instructions to install the software for the current user only. If you are interested in installing the JMF system-wide, follow the same instructions, you will only need to add then a few extra steps.
Single user
Java Media Framework
We suppose you have downloaded the required software in /home/user/Download.Open a terminal (in the Gnome desktop it is called gnome-terminal, in KDE it is the Konsole), and change the current directory to the place where you downloaded the software:
Create a new directory to unpack the software. We name it JMF:
Copy the JMF Performance Pack binary in that directory (it is better to work with a copy of the downloaded file, because there may be problems during the installation, as several users have reported).
Change the working directory to JMF:
Now change the file mode to make it executable:
And execute the 'installer' (you don't need root privileges because it will only unpack the files in the current directory, instead of installing them):
The license text will be displayed on your terminal screen.Scroll down the license by pressing Enter, until you reach the agreement question:
Type yes
to accept it.You will be asked with two more questions. Answer no
to them:
After answering to these questions, the unpacking process will start.
At this point, you may get an error similar to the following:
If so, please refer to the 'Troubleshooting' section below.
The JMF will try to find the devices in your system. Don't panic if you get some messages telling that it couldn't open some devices:
The important thing is that it finds your sound card (and video card, in case you have one). You can check this later from within the JMStudio, installed with the JMF.
If everything went good, the JMF should be unpacked in /home/user/Download/JMF/JMF-2.1.1e/
.
Now we can move the JMF folder to a permanent location in our home directory:
Java Media Framework
Finally, we can remove the temporal folder:
Next step is installing the mp3 plug-in, if you want support for mp3 files.
JMF MP3 plug-in
Change the current directory to the place where you downloaded the plug-in zip file (latest version is named javamp3-1_0.zip):
Create a new directory to unpack it. We name it JAVAMP3:
Extract the zip file inside this new folder:
Then copy the plug-in Java Archive (mp3plugin.jar) inside the JMF folder, together with the other JARs (/home/user/JMF-2.1.1e/lib/):
Finally, we can remove the temporal folder:
JMF Configuration
Once moved to our home directory, we are ready to launch the JMStudio, test the configuration, and add the mp3 plug-in.
To launch the JMStudio, type the following:
You will see a window like the following:
Select the menu File > Preferences to open the JMF Registry Editor.In the Capture device tab, there may be at least the JavaSound audio capture. If not, press Detect Capture Devices. Problems in this area may be related to your hardware and/or operating system, you should contact their support in case of troubles.
In the Plugins tab, select Codec; enter com.sun.media.codec.audio.mp3.JavaDecoder
. Press Add, and then Commit.
If nothing went wrong, close the JMF Registry Editor. You could now play an mp3 audio file.But if a 'JMF Registry Error' window pops up displaying an error message ('Could not add item'), and the terminal outputs 'java.lang.ClassNotFoundException', then you must close the JMStudio and set some environment variables, then restart the JMStudio and add the mp3 codec as explained above:
If you have followed these steps, you should be able to configure now OpenOffice.org to use the JMF. Notice that if you want the JMF to be accessible for other (Java) applications, like web applets, you should set some environment variables. Read the following section for instructions.
Multi-user
If you want to install the JMF system-wide, so that it is available for every user, follow the same steps as above, and move the ~/JMF-2.1.1e
folder from your home to a system-wide location. We will choose /opt
. Notice that setting up the JMF will require then root privileges.
Open a terminal, type su
and enter the system administrator password.
Then move the JMF to its new location (don't forget to replace 'user' with your user directory name):
Create a symbolic link to reference in the environment variables (this way it's easier to update):
Next we have to set global environment variables. We do so by editing (or creating, in case it doesn't exist) a file named java.sh
in /etc/profile.d/java.sh
, with the following content:
Change JAVA_HOME
to the location of the JRE (or JDK). Later we will talk about fobs4jmf.jar
. Note that every export
command must be in only one line; if the Wiki engine changes that when laying out this page, please write your /etc/profile.d/java.sh
removing the extra line breaks if you copy and paste from here.
After rebooting your system, every user could type jmstudio
from the command line to launch the JMStudio, with no need to this from the installation directory (/opt/JMF-2.1.1e/bin/
).
OpenOffice.org Configuration
Before being able to use the Java Media Framework to reproduce audio and video in OpenOffice.org, you must add the JMF library folder to the class path of the Java Virtual Machine launched by OpenOffice.org. You do so with the dialog under Tools > Options:
Press the 'Class Path' button, and add the JMF library folder (if you have choosen the system-wide installation, it is /opt/JMF/lib
; if you have installed the JMF just in your home directory, it is /home/user/JMF-2.1.1e/lib
).
You will need to restart OpenOffice.org for this changes to take effect.
After restart, you should be able to play audio and sound supported by JMF. You can try playing one of the sounds from the gallery:
Java Api Framework
Troubleshooting
If you get an error similar to the following:
you will have to edit the installer and correct a line.
There are different ways of doing this, we will use the vim editor.
First we have to clear things up, because this error corrupts the installer file. You can test this by checking its size:
So remove everything and copy back the file downloaded:
Java Media Framework Books
Open the file with vim in binary mode:
In the vim editor, type /tail
and press ENTER to look for the line to be fixed:
This will find the problematic line.
Then press the key l to move to the left on that line, until the sign +.
Press i to insert text, and insert -n
, with a space
Press ESC to stop inserting, and type :wq
to write the changes and quit.
Extending JMF
Sun's Java Media Framework comes with support for few formats. You can extend it by installing Fobs4JMF, which is a JMF wrapper for the popular ffmpeg, it can play the most common formats and codecs (ogg, mp3, m4a, divx, xvid, h264, mov, avi, etc):
Please refer to http://fobs.sourceforge.net for more details.
Unfortunately there are no recent binaries for Linux (see http://sourceforge.net/project/showfiles.php?group_id=105646&package_id=117443), so you will have to compile it from the sources.
Once compiled, you don't need to install anything, you just have to copy fobs4jmf.jar and libfobs4jmf.so in /opt/JMF/lib/.
TODO: not very complicated explanation of how to compile it (at least in Ubuntu) on people's demand...See Discussion tab, where this request has been requested, of those able to do, and thanks!