MediaException: Unable to realize
I'm trying to play a video file after from a byte input stream. However, I receive the exception, "Unable to realize". I've searched online for possible reasons but have found nothing. Pls find code below.
public class Test2 extends MIDlet{
public void startApp() {
try{
InputStream in = getClass().getResourceAsStream("fire.mpg");
byte[] data;
int ch;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((ch = in.read()) != -1) {
baos.write((byte)ch);
data = baos.toByteArray();
RecordStore MEFolder= RecordStore.openRecordStore("MEmDNS Folder", true);
int recID = MEFolder.addRecord(data, 0, data.length);
InputStream is = new ByteArrayInputStream(MEFolder.getRecord(recID));
Player p = Manager.createPlayer(is, "video/mpg");
p.realize();
VideoControl video = (VideoControl) p.getControl("VideoControl");
Item videoItem = (Item)video.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
Form videoForm = new Form("VideoForm");
videoForm.append(videoItem);
p.start();
}catch(IOException e){
System.out.println("ioexception caught" + e);
}catch(RecordStoreException e){
System.out.println("recstoreexp caught" + e);
}catch(MediaException e){
System.out.println("mediaexep caught " + e);
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}Many thanks in advance.
Hi,
did you try to move the p.realize() command just before the call to p.start() ?
It might solve the problem.
Similar Messages
-
Re: javax.microedition.media.MediaException: Unable to realize
Dear all ,
I'm getting the out of memory exeception when i'm trying to play large files of size 5mb .
Because the byte array is not able to handle large data.\
How can i pass the large files to audio player from file system.
can any one help me out?
Thanks,
Purnahi,
try {
vfrm.append("Stage 1\n"); // vfrm is a Form for video playback
String resfile_name = "http://www.xxxx.com.tr/mobile/test.mpeg";
StreamConnection c = (StreamConnection)Connector.open(resfile_name);
InputStream in = c.openInputStream();
vfrm.append("FileSize :"+String.valueOf(in.available()));
vfrm.append("Stage 1.1\n");
Player player = Manager.createPlayer(in, "video/mpeg"); // ------- Error on this line -------
vfrm.append("Stage 1.2\n");
player.realize();
vfrm.append("Stage 3");
GUIControl gc;
if ((gc = (GUIControl)player.getControl("GUIControl")) != null) {
vfrm.append((Item)gc.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, null));
vfrm.append("Stage 4");
player.start();
vfrm.append("Stage 5");
} catch (Throwable pe) {
vfrm.append("---"+pe.toString()+"\n");
vfrm.append("err : "+pe.getMessage()+"\n");
}When this code works i am taking these outputs
Stage1
FileSize:706564Stage1.1
--- javax.microedition.media.MediaException
err : nullI am using a HTC PDA with Windows Mobile 6.0.
I am so new about this subject. Please help me ... -
Try adding $JMFHOME/lib to $LD_LIBRARY_PATH
I have the exact same error.
Did you ever solve this problem?
If so, can you please send me the instructions on how to solve it ([email protected]), please?
Thanks -
Codec stops the processor from realizing
Hi, I am trying to build a solution which transmits a webcam stream to two computers simultaneously but with a different overlay on each. The idea being that each computer ends up with the same stream but with different watermarks on top of it. I have created two processors which run as threads and set an overlay codec to the data flow path of each processor. However when I set the codec to the data flow path the processor will not realize and I get the following error.
Failed to build a graph for the given custom options.
Failed to realize: com.sun.media.ProcessEngine@c21495
Cannot build a flow graph with the customized options:
Unable to transcode format: RGB, 320x240, FrameRate=15.0, Length=230400, 24-
bit, Masks=3:2:1, PixelStride=3, LineStride=960, Flipped
to: JPEG/RTP, 320x240, FrameRate=15.0
outputting to: RAW/RTP
Unable to add customed codecs:
videowallfinal.Transmit2$OverlayCodec@8814e9
Error: Unable to realize com.sun.media.ProcessEngine@c21495
The processor works fine if I take out the setCodecChain part so I'm guessing it has something to do with the codec. Any help would be much appreciated. I will post the code below.Here is the code for the processor, a cloneable dataSource is created from the medialocator (webcam) in another class but I havn't added it becuase it would be too long. Thanks again.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import java.io.*;
public class Transmit1 extends Panel implements Runnable{
// Input MediaLocator
// Can be a file or http or capture source
private String ipAddress1;
private String port1;
private Processor processor = null;
private DataSink rtptransmitter = null;
private DataSource dataOutput = null;
private DataSource processorOutput = null;
public static Player player = null;
public Transmit1(DataSource ds) {
this.processorOutput = ds;
this.ipAddress1 = "192.168.5.3";
this.port1 = "55556";
public void start(){
Thread thread = new Thread(this);
thread.start();
public void run() {
run2();
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
public synchronized String run2() {
String result;
// Create a processor for the specified media locator
// and program it to output JPEG/RTP
result = createProcessor();
if (result != null)
return result;
//createTransmitter();
//createTransmitter2();
//Create an RTP session to transmit the output of the
//processor to the specified IP address and port no.
result = createTransmitter();
if (result != null) {
processor.close();
processor = null;
return result;
//result = createTransmitter2();
//if (result != null) {
// processor.close();
// processor = null;
// return result;
// Start the transmission
processor.start();
return null;
* Stops the transmission if already started
public void stop() {
synchronized (this) {
if (processor != null) {
processor.stop();
processor.close();
processor = null;
rtptransmitter.close();
rtptransmitter = null;
//t1.stop();
//t2.stop();
//rtptransmitter2.close();
//rtptransmitter2 = null;
private String createProcessor() {
// if (locator == null)
// return "Locator is null";
// DataSource ds;
// try {
// ds = Manager.createDataSource(locator);
// } catch (Exception e) {
// return "Couldn't create DataSource";
//ds = Manager.createCloneableDataSource(ds);
//if (ds == null) {
// System.err.println("Cannot clone the given DataSource");
// System.exit(0);
// Try to create a processor to handle the input media locator
try {
processor = Manager.createProcessor(processorOutput);
} catch (NoProcessorException npe) {
return "Couldn't create processor";
} catch (IOException ioe) {
return "IOException creating processor";
// Wait for it to configure
boolean result = waitForState(processor, Processor.Configured);
if (result == false)
return "Couldn't configure processor";
// Get the tracks from the processor
TrackControl [] tracks = processor.getTrackControls();
// Do we have atleast one track?
if (tracks == null || tracks.length < 1)
return "Couldn't find tracks in processor";
boolean programmed = false;
// Search through the tracks for a video track
TrackControl videoTrack = null;
for (int i = 0; i < tracks.length; i++) {
Format format = tracks.getFormat();
if ( tracks[i].isEnabled() &&
format instanceof VideoFormat &&
!programmed) {
// Found a video track. Try to program it to output JPEG/RTP
// Make sure the sizes are multiple of 8's.
Dimension size = ((VideoFormat)format).getSize();
float frameRate = ((VideoFormat)format).getFrameRate();
int w = (size.width % 8 == 0 ? size.width :
(int)(size.width / 8) * 8);
int h = (size.height % 8 == 0 ? size.height :
(int)(size.height / 8) * 8);
VideoFormat jpegFormat = new VideoFormat(VideoFormat.JPEG_RTP,
new Dimension(w, h),
Format.NOT_SPECIFIED,
Format.byteArray,
frameRate);
tracks[i].setFormat(jpegFormat);
videoTrack = tracks[i];
System.err.println("Video transmitted as:");
System.err.println(" " + jpegFormat);
// Assume succesful
programmed = true;
} else
tracks[i].setEnabled(false);
if (!programmed)
return "Couldn't find video track";
// Instantiate and set the overlay codec to the data flow path.
try {
Codec codec[] = { new OverlayCodec()};
videoTrack.setCodecChain(codec);
} catch (UnsupportedPlugInException e) {
System.err.println("The process does not support effects.");
// Set the output content descriptor to RAW_RTP
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
// Realize the processor. This will internally create a flow
// graph and attempt to create an output datasource for JPEG/RTP
// video frames.
result = waitForState(processor, Controller.Realized);
if (result == false)
return "Couldn't realize processor";
// Set the JPEG quality to .5.
setJPEGQuality(processor, 0.5f);
// Get the output data source of the processor
dataOutput = processor.getDataOutput();
return null;
// Creates an RTP transmit data sink. This is the easiest way to create
// an RTP transmitter. The other way is to use the RTPSessionManager API.
// Using an RTP session manager gives you more control if you wish to
// fine tune your transmission and set other parameters.
private String createTransmitter() {
// Create a media locator for the RTP data sink.
// For example:
// rtp://129.130.131.132:42050/video
String rtpURL = "rtp://" + ipAddress1 + ":" + port1 + "/video";
MediaLocator outputLocator = new MediaLocator(rtpURL);
// Create a data sink, open it and start transmission. It will wait
// for the processor to start sending data. So we need to start the
// output data source of the processor. We also need to start the
// processor itself, which is done after this method returns.
try {
rtptransmitter = Manager.createDataSink(dataOutput, outputLocator);
rtptransmitter.open();
rtptransmitter.start();
dataOutput.start();
} catch (MediaException me) {
return "Couldn't create RTP data sink";
} catch (IOException ioe) {
return "Couldn't create RTP data sink";
return null;
* Setting the encoding quality to the specified value on the JPEG encoder.
* 0.5 is a good default.
void setJPEGQuality(Player p, float val) {
Control cs[] = p.getControls();
QualityControl qc = null;
VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
// Loop through the controls to find the Quality control for
// the JPEG encoder.
for (int i = 0; i < cs.length; i++) {
if (cs[i] instanceof QualityControl &&
cs[i] instanceof Owned) {
Object owner = ((Owned)cs[i]).getOwner();
// Check to see if the owner is a Codec.
// Then check for the output format.
if (owner instanceof Codec) {
Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
for (int j = 0; j < fmts.length; j++) {
if (fmts[j].matches(jpegFmt)) {
qc = (QualityControl)cs[i];
qc.setQuality(val);
System.err.println("- Setting quality to " + val + " on " + qc);
break;
if (qc != null)
break;
* Convenience methods to handle processor's state changes.
private Integer stateLock = new Integer(0);
private boolean failed = false;
Integer getStateLock() {
return stateLock;
void setFailed() {
failed = true;
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
}else if (state ==Processor.Prefetched){
p.prefetch();
}else if (state == Processor.Realized) {
p.realize();
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
if (failed)
return false;
else
return true;
* Inner Classes
class StateListener implements ControllerListener {
public void controllerUpdate(ControllerEvent ce) {
// If there was an error during configure or
// realize, the processor will be closed
if (ce instanceof ControllerClosedEvent)
setFailed();
// All controller events, send a notification
// to the waiting thread in waitForState method.
if (ce instanceof ControllerEvent) {
synchronized (getStateLock()) {
getStateLock().notifyAll();
public class PreAccessCodec implements Codec {
* Callback to access individual video frames.
void accessFrame(Buffer frame) {
// For demo, we'll just print out the frame #, time &
// data length.
long t = (long)(frame.getTimeStamp()/10000000f);
System.err.println("Pre: frame #: " + frame.getSequenceNumber() +
", time: " + ((float)t)/100f +
", len: " + frame.getLength());
* The code for a pass through codec.
// We'll advertize as supporting all video formats.
protected Format supportedIns[] = new Format [] {
new VideoFormat(null)
// We'll advertize as supporting all video formats.
protected Format supportedOuts[] = new Format [] {
new VideoFormat(null)
Format input = null, output = null;
public String getName() {
return "Pre-Access Codec";
// No op.
public void open() {
// No op.
public void close() {
// No op.
public void reset() {
public Format [] getSupportedInputFormats() {
return supportedIns;
public Format [] getSupportedOutputFormats(Format in) {
if (in == null)
return supportedOuts;
else {
// If an input format is given, we use that input format
// as the output since we are not modifying the bit stream
// at all.
Format outs[] = new Format[1];
outs[0] = in;
return outs;
public Format setInputFormat(Format format) {
input = format;
return input;
public Format setOutputFormat(Format format) {
output = format;
return output;
public int process(Buffer in, Buffer out) {
// This is the "Callback" to access individual frames.
accessFrame(in);
// Swap the data between the input & output.
Object data = in.getData();
in.setData(out.getData());
out.setData(data);
// Copy the input attributes to the output
out.setFormat(in.getFormat());
out.setLength(in.getLength());
out.setOffset(in.getOffset());
return BUFFER_PROCESSED_OK;
public Object[] getControls() {
return new Object[0];
public Object getControl(String type) {
return null;
public class PostAccessCodec extends PreAccessCodec {
// We'll advertize as supporting all video formats.
public PostAccessCodec() {
supportedIns = new Format [] {
new RGBFormat()
* Callback to access individual video frames.
void accessFrame(Buffer frame) {
// For demo, we'll just print out the frame #, time &
// data length.
long t = (long)(frame.getTimeStamp()/10000000f);
System.err.println("Post: frame #: " + frame.getSequenceNumber() +
", time: " + ((float)t)/100f +
", len: " + frame.getLength());
public String getName() {
return "Post-Access Codec";
public class OverlayCodec extends PostAccessCodec {
BufferedImage work;
byte[] workData;
int width;
int height;
int dataLen;
// input format set to match BufferedImage format
RGBFormat supportedRGB = new RGBFormat(null, // size
Format.NOT_SPECIFIED, // maxDataLength
Format.byteArray, // dataType
Format.NOT_SPECIFIED, // frameRate
24, // bitsPerPixel
3, 2, 1, // red/green/blue masks
3, // pixelStride
Format.NOT_SPECIFIED, // lineStride
Format.FALSE, // flipped
Format.NOT_SPECIFIED); // endian
public OverlayCodec() {
// force specific input format
supportedIns = new Format [] {
supportedRGB
public Format setInputFormat(Format format) {
if ((format != null) && (format instanceof RGBFormat) &&
format.matches(supportedRGB)) {
// set up working image if valid type
// (it should be since we insisted!)
Dimension size = ((RGBFormat)format).getSize();
width = size.width;
height = size.height;
dataLen = width * height * 3;
if ((dataLen > 0) &&
((work == null) || (work.getWidth() != width) || (work.getHeight() != height))) {
// working image - same 3-byte format as buffer
work = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
// reference to pixel data
workData = ((DataBufferByte) work.getRaster().getDataBuffer()).getData();
return super.setInputFormat(format);
void drawGraphics(Graphics2D g) {
// replace or override to draw on frame contents
g.clearRect(0, 0, 100, 100);
//g.clearRect(176, 120, 176, 120);
void accessFrame(Buffer frame) {
if ((work != null) && (frame.getData().getClass() == byte[].class)) {
// Create new graphics context for image
// (could be created only once if drawGraphics manages state)
Graphics2D g = work.createGraphics();
// transfer buffer contents into image
byte[] bufData = (byte[]) frame.getData();
int n = Math.min(dataLen, bufData.length);
System.arraycopy(bufData, 0, workData, 0, n);
// perform desired graphics operations
drawGraphics(g);
// copy changed image data back to buffer
System.arraycopy(workData, 0, bufData, 0, n);
g.dispose();
super.accessFrame(frame); // if you care
public String getName() {
return "Frame Overlay Codec";
-
Unable to play videos with non-ASCII-characters in filename
Hi!
I use a MediaPlayer to display MP4-videos in my application. This works quite well. Unfortunately I have a problem if the filename of the video to be shown contains non-ASCII-charcaters.
I get the following message:
-->file:D:\daten\avi\��� ����.MPG
Error: Unable to realize com.sun.media.amovie.AMController@4b7651
Failed to realizeThe first line shows the filename I pass to the setMediaLocation()-method of the MediaPlayer-object.
What's wrong? If I rename the file to ABC.mpg it works fine.
Thanks for your help
ThomasHi!
I use a MediaPlayer to display MP4-videos in my application. This works quite well. Unfortunately I have a problem if the filename of the video to be shown contains non-ASCII-charcaters.
I get the following message:
-->file:D:\daten\avi\��� ����.MPG
Error: Unable to realize com.sun.media.amovie.AMController@4b7651
Failed to realizeThe first line shows the filename I pass to the setMediaLocation()-method of the MediaPlayer-object.
What's wrong? If I rename the file to ABC.mpg it works fine.
Thanks for your help
Thomas -
TMADMIN_CAT:1607: ERROR: Unable to initialize public key subsystem
Hi All,
I have installed HCM 9 with 8.49.08 PeopleTools on CentOS 5.3 Linux. Everything went fine (I have completed the creation of database) until I am about to start the application server that I have just created. I am getting this error, "TMADMIN_CAT:1607: ERROR: Unable to initialize public key subsystem".
@Nicolas
I have followed the instructions in your blog (it's very helpful). However I am now stack with this error.
Screenshot of the error after trying to boot the appserv:
PeopleSoft Domain Boot Menu
Domain Name: DMHCM
1) Boot (Serial Boot)
2) Parallel Boot
q) Quit
Command to execute (1-2, q) [q]: 1
psappsrv.cfg has changed archiving old one...
Copying DMHCM/Archive/psappsrv.cfg to DMHCM/Archive/psappsrv_092509_0140_32.cfg
Attempting to boot bulletin board...
tmadmin - Copyright (c) 1996-1999 BEA Systems, Inc.
Portions * Copyright 1986-1997 RSA Data Security, Inc.
All Rights Reserved.
Distributed under license by BEA Systems, Inc.
Tuxedo is a registered trademark.
TMADMIN_CAT:1607: ERROR: Unable to initialize public key subsystem
==============ERROR!================
Boot attempt encountered errors!. Check the TUXEDO log for details.
==============ERROR!================
Do you wish to see the error messages in the APPSRV.LOG file? (y/n) [n] :
Here the content of the ULOG:
CentOSLinux:psoft /applications/speople/pt849/appserv >tail ULOG.092509
014032.CentOSLinux!tmadmin.24422.3086362304.-2: 09-25-2009: Tuxedo Version 9.1, 32-bit
014032.CentOSLinux!tmadmin.24422.3086362304.-2: GP_CAT:1345: ERROR: pif: can't load 'registry.so'
014032.CentOSLinux!tmadmin.24422.3086362304.-2: LIBSEC_CAT:22: ERROR: Unable to realize the ecsec_map_proof interface implementation native/security/map_proof. Error code (-5000)
014032.CentOSLinux!tmadmin.24422.3086362304.-2: LIBTUX_CAT:6275: ERROR: Unable to initialize public key subsystem (-3003)
014032.CentOSLinux!tmadmin.24422.3086362304.-2: LIBTUX_CAT:6204: ERROR: Could not initialize public key subsystem
020404.CentOSLinux!tmadmin.25119.3086403264.-2: 09-25-2009: Tuxedo Version 9.1, 32-bit
020404.CentOSLinux!tmadmin.25119.3086403264.-2: GP_CAT:1345: ERROR: pif: can't load 'registry.so'
020404.CentOSLinux!tmadmin.25119.3086403264.-2: LIBSEC_CAT:22: ERROR: Unable to realize the ecsec_map_proof interface implementation native/security/map_proof. Error code (-5000)
020404.CentOSLinux!tmadmin.25119.3086403264.-2: LIBTUX_CAT:6275: ERROR: Unable to initialize public key subsystem (-3003)
020404.CentOSLinux!tmadmin.25119.3086403264.-2: LIBTUX_CAT:6204: ERROR: Could not initialize public key subsystem
This seems to be the main culprit... GP_CAT:1345: ERROR: pif: can't load 'registry.so' and I have searched this forum and found several suggestions like make sure that LD_LIBRARY_PATH is correctly set .. incorrect permssions, delete the .adm ... etc. I have done all of this suggestions. I even re-installed the Tuxedo 9.1 with the assumption that some files like resistry,.so might have been corrupted but this all did not resolved the issue. I believe I have done my I could before going here asking for help.
Here is the content of my .bash_profile:
# .bash_profile
PS1='CentOSLinux:$USER $PWD >'
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
export BEA=/applications/speople/bea
export TUXDIR=/applications/speople/bea/tuxedo91
export BEA_HOME=/applications/speople/bea/weblogic92
export ORACLE_HOME=/applications/oracle/10.2.0
export PATH=$PATH:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
LIBPATH=$TUXDIR/lib:$LIBPATH:/usr/lib; export LIBPATH
export PS_HOME=/applications/speople/pt849
. $PS_HOME/psconfig.sh
I would really appreciate any help on this issue. Many thanks.Please, check if you have the following RPM installed :
[root@centos ~]# more /etc/redhat-release
CentOS release 5.3 (Final)
[root@centos ~]# rpm -q compat-libstdc++-33-3.2.3-61.i386
compat-libstdc++-33-3.2.3-61
[root@centos ~]#I tested it on CentOS5.3, everything is working fine. Please, see below all the installation steps :
1. Install CentOS 5.3 with all the default settings
2. Install Tuxedo
2.1 => Modify the file ./linux/sles9/base/tuxedo91_32_SLES_9_x86.bin
mv ./linux/sles9/base/tuxedo91_32_SLES_9_x86.bin /tmp/tuxedo91_32_SLES_9_x86.bin
cat /tmp/tuxedo91_32_SLES_9_x86.bin|sed 's/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/' > ./linux/sles9/base/tuxedo91_32_SLES_9_x86.bin2.2 => Download and install JDK5
./jdk-1_5_0_21-linux-i586-rpm.bin
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.
(LFI#143333/Form ID#011801)
Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP ([email protected]).
inflating: jdk-1_5_0_21-linux-i586.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Done.
[root@centos JDK5]# # /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_21/bin/java 2
[root@centos JDK5]# /usr/sbin/alternatives --config java
There are 4 programs which provide 'java'.
Selection Command
* 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
+ 3 /usr/java/jdk1.5.0_16/bin/java
4 /usr/java/jdk1.5.0_21/bin/java
Enter to keep the current selection[+], or type selection number: 4
[root@centos JDK5]# java -version
java version "1.5.0_21"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_21-b01)
Java HotSpot(TM) Client VM (build 1.5.0_21-b01, mixed mode, sharing)
[root@centos JDK5]#2.3 => Modify the file install.sh
The line
sh $INSTALL_BINARY -f $SILENT_INSTALL_FILE > $INSTALLER_OUTPUT;becomes
sh $INSTALL_BINARY LAX_VM /usr/java/jdk1.5.0_21/jre/bin/java -f $SILENT_INSTALL_FILE > $INSTALLER_OUTPUT;2.4 => run the Tuxedo Installer
sh ./install.sh3. Install Peopletools
4. Install the RPM (from the CentOS 5.3 DVD) - this is required for psadmin
rpm -Uvh compat-libstdc++-33-3.2.3-61.i386.rpm5. Install additional RPMs for Oracle
rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm
rpm -Uvh kernel-headers-2.6.18-128.el5.i386.rpm
rpm -Uvh glibc-headers-2.5-34.i386.rpm
rpm -Uvh glibc-devel-2.5-34.i386.rpm
rpm -Uvh compat-gcc-34-3.4.6-4.i386.rpm
rpm -Uvh libgomp-4.3.2-7.el5.i386.rpm
rpm -Uvh gcc-4.1.2-44.el5.i386.rpm
rpm -Uvh gcc-c++-4.1.2-44.el5.i386.rpm
rpm -Uvh compat-glibc-headers-2.3.4-2.26.i386.rpm
rpm -Uvh compat-glibc-2.3.4-2.26.i386.rpm
rpm -Uvh glibc-utils-2.5-34.i386.rpm
rpm -Uvh compat-db-4.2.52-5.1.i386.rpm
rpm -Uvh compat-gcc-34-c++-3.4.6-4.i386.rpm
rpm -Uvh compat-libstdc++-296-2.96-138.i386.rpm
rpm -Uvh gcc43-4.3.2-7.el5.i386.rpm
rpm -Uvh gcc43-c++-4.3.2-7.el5.i386.rpm6. Install Oracle (database or client depending of the config)
6.1 => add the entry in tnsnames.ora
6.2 => create the symbolic link
[oracle@centos oracle]$ cd $ORACLE_HOME/lib
[oracle@centos lib]$ ln -s libclntsh.so libclntsh.so.9.06.3 => make the ORACLE_HOME readable and executable for everbody
7. psoft user
7.1 => The .bash_profile
[psoft@centos ~]$ more .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export ORACLE_HOME=/oracle/10.2
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PS_HOME=/psoft/psoft849
. $PS_HOME/psconfig.sh
[psoft@centos ~]$7.2 => Modify the file $PS_HOME/psconfig.sh
PS_HOSTTYPE=redhat-4-ia32;export PS_HOSTTYPE8. psadmin, create the new domain, and start
PeopleSoft Domain Boot Menu
Domain Name: DMOHRMS9
1) Boot (Serial Boot)
2) Parallel Boot
q) Quit
Command to execute (1-2, q) [q]: 1
psappsrv.cfg has changed archiving old one...
Copying DMOHRMS9/Archive/psappsrv.cfg to DMOHRMS9/Archive/psappsrv_092609_1218_35.cfg
Attempting to boot bulletin board...
tmadmin - Copyright (c) 1996-1999 BEA Systems, Inc.
Portions * Copyright 1986-1997 RSA Data Security, Inc.
All Rights Reserved.
Distributed under license by BEA Systems, Inc.
Tuxedo is a registered trademark.
No bulletin board exists. Entering boot mode.
INFO: BEA Tuxedo, Version 9.1, 32-bit, Patch Level 036
INFO: Serial #: 650522264137-2065448083901, Expiration NONE, Maxusers 1000000
INFO: Licensed to: Oracle-Peoplesoft-ISV
Booting admin processes ...
exec BBL -A :
process id=26552 ... Started.
1 process started.
Attempting to boot ...
INFO: BEA Tuxedo, Version 9.1, 32-bit, Patch Level 036
INFO: Serial #: 650522264137-2065448083901, Expiration NONE, Maxusers 1000000
INFO: Licensed to: Oracle-Peoplesoft-ISV
Booting server processes ...
exec PSWATCHSRV -A -- -ID 176290 -C psappsrv.cfg -D DMOHRMS9 -S PSWATCHSRV :
process id=26555 ... Started.
exec PSAPPSRV -s@../psappsrv.lst -s@../psqcksrv.lst -sICQuery -sSqlQuery:SqlRequest -- -C psappsrv.cfg -D DMOHRMS9 -S PSAPPSRV :
process id=26556 ... Started.
exec PSAPPSRV -s@../psappsrv.lst -s@../psqcksrv.lst -sICQuery -sSqlQuery:SqlRequest -- -C psappsrv.cfg -D DMOHRMS9 -S PSAPPSRV :
process id=26560 ... Started.
exec PSAPPSRV -s@../psappsrv.lst -s@../psqcksrv.lst -sICQuery -sSqlQuery:SqlRequest -- -C psappsrv.cfg -D DMOHRMS9 -S PSAPPSRV :
process id=26564 ... Started.
exec PSSAMSRV -A -- -C psappsrv.cfg -D DMOHRMS9 -S PSSAMSRV :
process id=26568 ... Started.
exec PSMONITORSRV -A -- -ID 176290 -C psappsrv.cfg -D DMOHRMS9 -S PSMONITORSRV :
process id=26571 ... Started.
exec JSL -A -- -d unused -n //centos.phoenix-nga:9000 -m 1 -M 3 -I 5 -j ANY -x 40 -S 10 -c 1000000 -w JSH :
process id=26574 ... Started.
exec JREPSVR -A -- -W -P /psoft/psoft849/appserv/DMOHRMS9/jrepository :
process id=26576 ... Started.
8 processes started.HTH,
Nicolas. -
While runnig the program i am getting the following error.
create player for : video.mpg
Error value:80040216
Error:Unable to realize com.sun.media.amovie.AMController@765a16
Failed to realize the player
As i am new in jmf i can't understand the problem.please help me by pointing out the error & how to solve the problem.Thanks in advance.
import java.awt.*;
import java.awt.event.*;
import javax.media.*;
import javax.media.control.FramePositioningControl;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
* Sample program to demonstrate FramePositioningControl.
public class Seek extends Frame implements ControllerListener, ActionListener {
Player p;
FramePositioningControl fpc;
Object waitSync = new Object();
boolean stateTransitionOK = true;
int totalFrames = FramePositioningControl.FRAME_UNKNOWN;
Panel cntlPanel;
Button fwdButton;
Button bwdButton;
Button rndButton;
* Given a DataSource, create a player and use that player
* as a player to playback the media.
public boolean open(DataSource ds) {
System.err.println("create player for: " + ds.getContentType());
try {
p = Manager.createPlayer(ds);
} catch (Exception e) {
System.err.println("Failed to create a player from the given DataSource: " + e);
return false;
p.addControllerListener(this);
p.realize();
if (!waitForState(p.Realized)) {
System.err.println("Failed to realize the player.");
return false;
// Try to retrieve a FramePositioningControl from the player.
fpc = (FramePositioningControl)p.getControl("javax.media.control.FramePositioningControl");
if (fpc == null) {
System.err.println("The player does not support FramePositioningControl.");
System.err.println("There's no reason to go on for the purpose of this demo.");
return false;
Time duration = p.getDuration();
if (duration != Duration.DURATION_UNKNOWN) {
System.err.println("Movie duration: " + duration.getSeconds());
totalFrames = fpc.mapTimeToFrame(duration);
if (totalFrames != FramePositioningControl.FRAME_UNKNOWN)
System.err.println("Total # of video frames in the movies: " + totalFrames);
else
System.err.println("The FramePositiongControl does not support mapTimeToFrame.");
} else {
System.err.println("Movie duration: unknown");
// Prefetch the player.
p.prefetch();
if (!waitForState(p.Prefetched)) {
System.err.println("Failed to prefetch the player.");
return false;
// Display the visual & control component if there's one.
setLayout(new BorderLayout());
cntlPanel = new Panel();
fwdButton = new Button("Forward");
bwdButton = new Button("Backward");
rndButton = new Button("Random");
fwdButton.addActionListener(this);
bwdButton.addActionListener(this);
rndButton.addActionListener(this);
cntlPanel.add(fwdButton);
cntlPanel.add(bwdButton);
cntlPanel.add(rndButton);
Component vc;
if ((vc = p.getVisualComponent()) != null) {
add("Center", vc);
add("South", cntlPanel);
setVisible(true);
return true;
public void addNotify() {
super.addNotify();
pack();
* Block until the player has transitioned to the given state.
* Return false if the transition failed.
boolean waitForState(int state) {
synchronized (waitSync) {
try {
while (p.getState() < state && stateTransitionOK)
waitSync.wait();
} catch (Exception e) {}
return stateTransitionOK;
public void actionPerformed(ActionEvent ae) {
String command = ae.getActionCommand();
if (command.equals("Forward")) {
int dest = fpc.skip(1);
System.err.println("Step forward " + dest + " frame.");
} else if (command.equals("Backward")) {
int dest = fpc.skip(-1);
System.err.println("Step backward " + dest + " frame.");
} else if (command.equals("Random")) {
if (totalFrames == FramePositioningControl.FRAME_UNKNOWN)
System.err.println("Cannot jump to a random frame.");
else {
int randomFrame = (int)(totalFrames * Math.random());
randomFrame = fpc.seek(randomFrame);
System.err.println("Jump to a random frame: " + randomFrame);
int currentFrame = fpc.mapTimeToFrame(p.getMediaTime());
if (currentFrame != FramePositioningControl.FRAME_UNKNOWN)
System.err.println("Current frame: " + currentFrame);
* Controller Listener.
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
} else if (evt instanceof EndOfMediaEvent) {
p.setMediaTime(new Time(0));
//p.start();
//p.close();
//System.exit(0);
} else if (evt instanceof SizeChangeEvent) {
* Main program
public static void main(String [] args) {
if (args.length == 0) {
prUsage();
System.exit(0);
MediaLocator ml;
if ((ml = new MediaLocator(args[0])) == null) {
System.err.println("Cannot build media locator from: " + args[0]);
prUsage();
System.exit(0);
DataSource ds = null;
// Create a DataSource given the media locator.
try {
ds = Manager.createDataSource(ml);
} catch (Exception e) {
System.err.println("Cannot create DataSource from: " + ml);
System.exit(0);
Seek seek = new Seek();
if (!seek.open(ds))
System.exit(0);
static void prUsage() {
System.err.println("Usage: java Seek <url>");
}I don't know anything about movie controllers, but I do know that most people won't bother looking at code unless you use the formatter.
-
Cannot realize processor: webcam to RTP
Hello,
I am having trouble converting the DataSource I get from a VFW webcam (Intel Easy PC Camera) into a source suitable for streaming over RTP. I get a strange "Failed to build a graph for the given custom options" error when I try to realize the processor.
I am using the following code to transcode the camera's video source to a H261_RTP source to give to an RTP data sink:
DataSource camera = Manager.createDataSource(new MediaLocator("vfw://0"));
Processor processor = Manager.createProcessor(camera);
waitForState(processor, Processor.Configured);
// Should only get the VFW video track
if (processor.getTrackControls().length != 1)
return;
VideoFormat vfmt = new VideoFormat(VideoFormat.H261_RTP, null, Format.NOT_SPECIFIED, null, Format.NOT_SPECIFIED);
(processor.getTrackControls())[0].setFormat(vfmt);
(processor.getTrackControls())[0].setEnabled(true);
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
waitForState(processor, Processor.Realized);When I call the second waitForState() (which calls processor.realize()), I get the following error:
Failed to build a graph for the given custom options.
Failed to realize: com.sun.media.ProcessEngine@60b6f5
Cannot build a flow graph with the customized options:
Unable to transcode format: YUV Video Format: Size = java.awt.Dimension[widt
h=320,height=240] MaxDataLength = 115200 DataType = class [B yuvType = 2 StrideY
= 320 StrideUV = 160 OffsetY = 0 OffsetU = 76800 OffsetV = 96000
to: H261/RTP
outputting to: RAW/RTP
Error: Unable to realize com.sun.media.ProcessEngine@60b6f5Has anyone hade trouble converting from a YUV video format to a H261_RTP video format? Is my camera out of the ordinary for being YUV?
The problem is I know this can be done with JMF because the JMFStudio fires up my camera and streams it out perfectly. From looking through the JMFStudio source, it basically just sets the final format type for the video track and lets the Processor or whatever handle all of the intermediary conversions when realize() is called. I thought that's what I'm doing too, but haven't found where I'm going wrong.
I adapted my code from the VideoTransmit.java example program, which encountered the same errors.I have a similar problem. I am currently using a Intel camera (think it's easy pc). In my case, I am trying to create a processor to handle both the audio and video streams and I get an error when I try to create a send stream. The log file contains either JMF complaining about not being able to open com.ibm.media.codec.video.h263.NativeEncoder or not being able to transcode between different YUVFormats. The encoder seems capable of handling only 3 sizes when encoding.My initial try was to specify a YUV format which could be processed by the encoder. But I kept getting stuck in specifying the datatype when creating the desired format. Any ideas anyone ???
Vijayan -
Dear Friends ,
I am new to JMF,
I am just tring to write a simple program to play some videos in a JPanel and getting the following run time errors.
I have the followings in my class path:-
jmf.jar
fobs4jmf.jar
customizer.jar
mediaplayer.ja
multiplayer.jar
jmf.properties
fobs4jmf.dll
and I am using
jdk 1.6.0_14
netbeans 6.7.1
OS- vista
The portion of the coding which is used to play video
public class VideoPanel extends JPanel
//Player mediaPlayer ;
MediaPlayer mediaPlayer = new javax.media.bean.playerbean.MediaPlayer();
public VideoPanel( )
setLayout( new BorderLayout() ); // use a BorderLayout
} // end MediaPanel constructor
public void playThisVideo(URL mediaURL){
Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
mediaPlayer.setMediaLocation(mediaURL.toString());
mediaPlayer.start(); // start playing the media clip
} Error:
Unable to handle format: DX50, 320x240, FrameRate=25.0, Length=230400 0 extra bytes
Unable to handle format: mpeglayer3, 48000.0 Hz, 0-bit, Stereo, Unsigned, 16000.0 frame rate, FrameSize=9216 bits
Failed to realize: com.sun.media.PlaybackEngine@1326484
Error: Unable to realize com.sun.media.PlaybackEngine@1326484
Failed to realize: input media not supported: DX50 video, mpeglayer3 audio I am getting the same error when i use the following code.
Player mediaPlayer ;
Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
mediaPlayer = Manager.createRealizedPlayer(mediaURL);
Component video = mediaPlayer.getVisualComponent();
Component controls = mediaPlayer.getControlPanelComponent();
mediaPlayer.start();Please reply and help to this solve this problem.
Regards
vaananHello!
Try to register plugin in JMF:
1. Launch JMStudio (java JMStudio).
2. Go to File->Preferences
3. Enter the "Plugins" tab
4. In the "Demultiplexer" tab, add the class "com.omnividea.media.parser.video.Parser" and commit. See screenshot.
5. In the "Codec" tab, add the class "com.omnividea.media.codec.video.NativeDecoder" and commit. See screenshot.
6. In the "Codec" tab, add the class "com.omnividea.media.codec.audio.NativeDecoder" and commit. See screenshot.
7. In the "Codec" tab, add the class "com.omnividea.media.codec.video.JavaDecoder" and commit. See screenshot.
8. Go to the "Packages" tab
9. Include "com.omnividea" in both the Protocol Prefix and the Context Prefix list. Move both of them up to the first position. Commit both. See screenshot.
The recipe is copied from FOBS4JMF home site: [http://fobs.sourceforge.net/f4jmf_first.html] -
Video transmission with multithreading. I am having a problem?
I am doing an application for sending video streams to multiple clients at the same time. So am using multithreading. I have the following codes to do the transmission. When I am using it with one thread only it is working fine. But when I use it with more threads for multiple transmissions I am have an error saying �Unable to realize com.sun.media.ProcessEngine�. Can anyone help me plz.
import java.awt.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import java.io.*;
import java.lang.Thread;
public class VideoTransmitThread extends Thread{
// Input MediaLocator
// Can be a file or http or capture source
private MediaLocator locator;
private String ipAddress;
private String port;
private Processor processor = null;
private DataSink rtptransmitter = null;
private DataSource dataOutput = null;
public VideoTransmitThread(MediaLocator locator,
String ipAddress,
String port) {
this.locator = locator;
this.ipAddress = ipAddress;
this.port = port;
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
//run method for the thread
public void run( ) {
String result;
// Create a processor for the specified media locator
// and program it to output JPEG/RTP
result =createProcessor();
if (result != null)
System.out.println("error: "+result);
// Create an RTP session to transmit the output of the
// processor to the specified IP address and port no.
result =createTransmitter();
if (result != null) {
processor.close();
processor = null;
//return result;
System.out.println("error: "+result);
System.exit(0);
try {
Thread.sleep(1000); // 100 msec
} catch (InterruptedException e) {
return;
// Start the transmission
processor.start();
* Stops the transmission if already started
public void stop1() {
synchronized (this) {
if (processor != null) {
processor.stop();
processor.close();
processor = null;
rtptransmitter.close();
rtptransmitter = null;
private String createProcessor() {
if (locator == null)
return "Locator is null";
DataSource ds;
DataSource clone;
try {
ds = Manager.createDataSource(locator);
} catch (Exception e) {
return "Couldn't create DataSource";
// Try to create a processor to handle the input media locator
try {
processor = Manager.createProcessor(ds);
} catch (NoProcessorException npe) {
return "Couldn't create processor";
} catch (IOException ioe) {
return "IOException creating processor";
// Wait for it to configure
boolean result = waitForState(processor, Processor.Configured);
if (result == false)
return "Couldn't configure processor";
// Get the tracks from the processor
TrackControl [] tracks = processor.getTrackControls();
// Do we have atleast one track?
if (tracks == null || tracks.length < 1)
return "Couldn't find tracks in processor";
boolean programmed = false;
// Search through the tracks for a video track
for (int i = 0; i < tracks.length; i++) {
Format format = tracks.getFormat();
if ( tracks[i].isEnabled() &&
format instanceof VideoFormat &&
!programmed) {
// Found a video track. Try to program it to output JPEG/RTP
// Make sure the sizes are multiple of 8's.
Dimension size = ((VideoFormat)format).getSize();
float frameRate = ((VideoFormat)format).getFrameRate();
int w = (size.width % 8 == 0 ? size.width :
(int)(size.width / 8) * 8);
int h = (size.height % 8 == 0 ? size.height :
(int)(size.height / 8) * 8);
VideoFormat jpegFormat = new VideoFormat(VideoFormat.JPEG_RTP,
new Dimension(w, h),
Format.NOT_SPECIFIED,
Format.byteArray,
frameRate);
tracks[i].setFormat(jpegFormat);
System.err.println("Video transmitted as:");
System.err.println(" " + jpegFormat);
// Assume succesful
programmed = true;
} else
tracks[i].setEnabled(false);
if (!programmed)
return "Couldn't find video track";
// Set the output content descriptor to RAW_RTP
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
// Realize the processor. This will internally create a flow
// graph and attempt to create an output datasource for JPEG/RTP
// video frames.
result = waitForState(processor, Controller.Realized);
if (result == false)
return "Couldn't realize processor";
// Set the JPEG quality to .5.
setJPEGQuality(processor, 0.5f);
// Get the output data source of the processor
dataOutput = processor.getDataOutput();
return null;
// Creates an RTP transmit data sink. This is the easiest way to create
// an RTP transmitter. The other way is to use the RTPSessionManager API.
// Using an RTP session manager gives you more control if you wish to
// fine tune your transmission and set other parameters.
private String createTransmitter() {
// Create a media locator for the RTP data sink.
// For example:
// rtp://129.130.131.132:42050/video
String rtpURL = "rtp://" + ipAddress + ":" + port + "/video";
MediaLocator outputLocator = new MediaLocator(rtpURL);
// Create a data sink, open it and start transmission. It will wait
// for the processor to start sending data. So we need to start the
// output data source of the processor. We also need to start the
// processor itself, which is done after this method returns.
try {
rtptransmitter = Manager.createDataSink(dataOutput, outputLocator);
rtptransmitter.open();
rtptransmitter.start();
dataOutput.start();
} catch (MediaException me) {
return "Couldn't create RTP data sink";
} catch (IOException ioe) {
return "Couldn't create RTP data sink";
return null;
* Setting the encoding quality to the specified value on the JPEG encoder.
* 0.5 is a good default.
void setJPEGQuality(Player p, float val) {
Control cs[] = p.getControls();
QualityControl qc = null;
VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
// Loop through the controls to find the Quality control for
// the JPEG encoder.
for (int i = 0; i < cs.length; i++) {
if (cs[i] instanceof QualityControl &&
cs[i] instanceof Owned) {
Object owner = ((Owned)cs[i]).getOwner();
// Check to see if the owner is a Codec.
// Then check for the output format.
if (owner instanceof Codec) {
Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
for (int j = 0; j < fmts.length; j++) {
if (fmts[j].matches(jpegFmt)) {
qc = (QualityControl)cs[i];
qc.setQuality(val);
System.err.println("- Setting quality to " +
val + " on " + qc);
break;
if (qc != null)
break;
* Convenience methods to handle processor's state changes.
private Integer stateLock = new Integer(0);
private boolean failed = false;
Integer getStateLock() {
return stateLock;
void setFailed() {
failed = true;
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
if (failed)
return false;
else
return true;
* Inner Classes
class StateListener implements ControllerListener {
public void controllerUpdate(ControllerEvent ce) {
// If there was an error during configure or
// realize, the processor will be closed
if (ce instanceof ControllerClosedEvent)
setFailed();
// All controller events, send a notification
// to the waiting thread in waitForState method.
if (ce instanceof ControllerEvent) {
synchronized (getStateLock()) {
getStateLock().notifyAll();
* Sample Usage for VideoTransmitNew class
public static void main(String [] args) {
// We need three parameters to do the transmission
// For example,
// java VideoTransmitNew file:/C:/media/test.mov 129.130.131.132 42050
System.err.println("Start transmission");
//Create a video transmit object with the specified params.
MediaLocator URL=new MediaLocator("file:///C:/media/test.mpg");
//Am using 3 different threads.
new VideoTransmitThread(URL,"CSELAB12PC10","9876").start();
new VideoTransmitThread(URL," CSELAB12PC11","9870").start();
new VideoTransmitThread(URL," CSELAB12PC12","9690").start();
//close all transmission before quiting.Hm, that was my silver bullet. Other than doing an uninsall and then installing Presenter again, you may need to reach out to Adobe and see if they can identify what could be causing this.
-
Hi,
I m new to JMF.We are using MjSIP and i want to transmit video through JMF to other machine.The problem is the implementation which is given in MjSIP isnt working .
I mean whenever i execute the implementation given in mjSIP like JVisualReceiver etc.Both machines hangs coz they are not being able to realize the processor.I have successfully run the Player but i m getting problem in realizing the processor.
Although we are using the same processor.realize() method given in JMF Api.
Even i m not being able to run this sample given by SUN.
package local.ua;
* @(#)VideoTransmit.java 1.7 01/03/13
* Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
* Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
* modify and redistribute this software in source and binary code form,
* provided that i) this copyright notice and license appear on all copies of
* the software; and ii) Licensee does not utilize the software in a manner
* which is disparaging to Sun.
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
* LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
* INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
* OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
* This software is not designed or intended for use in on-line control of
* aircraft, air traffic, aircraft navigation or aircraft communications; or in
* the design, construction, operation or maintenance of any nuclear
* facility. Licensee represents and warrants that it will not use or
* redistribute the Software for such purposes.
import java.awt.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import java.io.*;
public class VideoTransmit {
// Input MediaLocator
// Can be a file or http or capture source
private MediaLocator locator;
private String ipAddress;
private String port;
private Processor processor = null;
private DataSink rtptransmitter = null;
private DataSource dataOutput = null;
public VideoTransmit(MediaLocator locator,
String ipAddress,
String port) {
this.locator = locator;
this.ipAddress = ipAddress;
this.port = port;
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
public synchronized String start() {
String result;
// Create a processor for the specified media locator
// and program it to output JPEG/RTP
result = createProcessor();
if (result != null)
return result;
// Create an RTP session to transmit the output of the
// processor to the specified IP address and port no.
result = createTransmitter();
if (result != null) {
processor.close();
processor = null;
return result;
// Start the transmission
processor.start();
return null;
* Stops the transmission if already started
public void stop() {
synchronized (this) {
if (processor != null) {
processor.stop();
processor.close();
processor = null;
rtptransmitter.close();
rtptransmitter = null;
private String createProcessor() {
if (locator == null)
return "Locator is null";
DataSource ds;
DataSource clone;
try {
ds = Manager.createDataSource(locator);
} catch (Exception e) {
return "Couldn't create DataSource";
// Try to create a processor to handle the input media locator
try {
processor = Manager.createProcessor(ds);
} catch (NoProcessorException npe) {
return "Couldn't create processor";
} catch (IOException ioe) {
return "IOException creating processor";
// Wait for it to configure
boolean result = waitForState(processor, Processor.Configured);
if (result == false)
return "Couldn't configure processor";
// Get the tracks from the processor
TrackControl [] tracks = processor.getTrackControls();
// Do we have atleast one track?
if (tracks == null || tracks.length < 1)
return "Couldn't find tracks in processor";
boolean programmed = false;
// Search through the tracks for a video track
for (int i = 0; i < tracks.length; i++) {
Format format = tracks.getFormat();
if ( tracks[i].isEnabled() &&
format instanceof VideoFormat &&
!programmed) {
// Found a video track. Try to program it to output JPEG/RTP
// Make sure the sizes are multiple of 8's.
Dimension size = ((VideoFormat)format).getSize();
float frameRate = ((VideoFormat)format).getFrameRate();
int w = (size.width % 8 == 0 ? size.width :
(int)(size.width / 8) * 8);
int h = (size.height % 8 == 0 ? size.height :
(int)(size.height / 8) * 8);
VideoFormat jpegFormat = new VideoFormat(VideoFormat.JPEG_RTP,
new Dimension(w, h),
Format.NOT_SPECIFIED,
Format.byteArray,
frameRate);
tracks[i].setFormat(jpegFormat);
System.err.println("Video transmitted as:");
System.err.println(" " + jpegFormat);
// Assume succesful
programmed = true;
} else
tracks[i].setEnabled(false);
if (programmed)
return "Couldn't find video track";
// Set the output content descriptor to RAW_RTP
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
// Realize the processor. This will internally create a flow
// graph and attempt to create an output datasource for JPEG/RTP
// video frames.
result = waitForState(processor, Controller.Realized);
if (result == false)
return "Couldn't realize processor";
// Set the JPEG quality to .5.
setJPEGQuality(processor, 0.5f);
// Get the output data source of the processor
dataOutput = processor.getDataOutput();
return null;
// Creates an RTP transmit data sink. This is the easiest way to create
// an RTP transmitter. The other way is to use the RTPSessionManager API.
// Using an RTP session manager gives you more control if you wish to
// fine tune your transmission and set other parameters.
private String createTransmitter() {
// Create a media locator for the RTP data sink.
// For example:
// rtp://129.130.131.132:42050/video
String rtpURL = "rtp://" + ipAddress + ":" + port + "/video";
MediaLocator outputLocator = new MediaLocator(rtpURL);
// Create a data sink, open it and start transmission. It will wait
// for the processor to start sending data. So we need to start the
// output data source of the processor. We also need to start the
// processor itself, which is done after this method returns.
try {
rtptransmitter = Manager.createDataSink(dataOutput, outputLocator);
rtptransmitter.open();
rtptransmitter.start();
dataOutput.start();
} catch (MediaException me) {
return "Couldn't create RTP data sink";
} catch (IOException ioe) {
return "Couldn't create RTP data sink";
return null;
* Setting the encoding quality to the specified value on the JPEG encoder.
* 0.5 is a good default.
void setJPEGQuality(Player p, float val) {
Control cs[] = p.getControls();
QualityControl qc = null;
VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
// Loop through the controls to find the Quality control for
// the JPEG encoder.
for (int i = 0; i < cs.length; i++) {
if (cs[i] instanceof QualityControl &&
cs[i] instanceof Owned) {
Object owner = ((Owned)cs[i]).getOwner();
// Check to see if the owner is a Codec.
// Then check for the output format.
if (owner instanceof Codec) {
Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
for (int j = 0; j < fmts.length; j++) {
if (fmts[j].matches(jpegFmt)) {
qc = (QualityControl)cs[i];
qc.setQuality(val);
System.err.println("- Setting quality to " +
val + " on " + qc);
break;
if (qc != null)
break;
* Convenience methods to handle processor's state changes.
private Integer stateLock = new Integer(0);
private boolean failed = false;
Integer getStateLock() {
return stateLock;
void setFailed() {
failed = true;
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
if (failed)
return false;
else
return true;
* Inner Classes
class StateListener implements ControllerListener {
public void controllerUpdate(ControllerEvent ce) {
// If there was an error during configure or
// realize, the processor will be closed
if (ce instanceof ControllerClosedEvent)
setFailed();
// All controller events, send a notification
// to the waiting thread in waitForState method.
if (ce instanceof ControllerEvent) {
synchronized (getStateLock()) {
getStateLock().notifyAll();
* Sample Usage for VideoTransmit class
public static void main(String [] args) {
// We need three parameters to do the transmission
// For example,
// java VideoTransmit file:/C:/media/test.mov 129.130.131.132 42050
if (args.length < 3) {
System.err.println("Usage: VideoTransmit <sourceURL> <destIP> <destPort>");
System.exit(-1);
// Create a video transmit object with the specified params.
VideoTransmit vt = new VideoTransmit(new MediaLocator(args[0]),
args[1],
args[2]);
// Start the transmission
String result = vt.start();
// result will be non-null if there was an error. The return
// value is a String describing the possible error. Print it.
if (result != null) {
System.err.println("Error : " + result);
System.exit(0);
System.err.println("Start transmission for 60 seconds...");
// Transmit for 60 seconds and then close the processor
// This is a safeguard when using a capture data source
// so that the capture device will be properly released
// before quitting.
// The right thing to do would be to have a GUI with a
// "Stop" button that would call stop on VideoTransmit
try {
Thread.currentThread().sleep(60000);
} catch (InterruptedException ie) {
// Stop the transmission
vt.stop();
System.err.println("...transmission ended.");
System.exit(0);
I m getting this exception
Failed to realize: com.sun.media.ProcessEngine@bd0108
Error: Unable to realize com.sun.media.ProcessEngine@bd0108
Error : Couldn't realize processorFinaly i was able to solve the problem.The other machine was having some firewall blocking the receiver.
-
Receiving Video RTP Stream (JMF) in JME ( MMAPI ) - URGENT !!!
Hi Folks...
I�m trying to develop an application that sends the images from a web cam connected to the computer, to the PDA that the images can be viewed by the user...
My code for the JMF RTP Video Stream is as follows.
Processor proc = null;
javax.media.protocol.DataSource ds = null;
TrackControl[] tc = null;
int y;
boolean encodingOk = false;
Vector<javax.media.protocol.DataSource> datasources = new Vector<javax.media.protocol.DataSource>();
for( int x = 0 ; x < camerasInfo.length ; x++ ){
try {
proc = Manager.createProcessor(camerasInfo[x].getLocator());
}catch (NoProcessorException e) { System.out.println("Erro ao int�nciar PROCESSOR: " + e); }
catch (IOException e) { System.out.println("Erro ao int�nciar PROCESSOR: " + e); }
proc.configure();
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
proc.setContentDescriptor( new ContentDescriptor(ContentDescriptor.RAW_RTP) );
tc = proc.getTrackControls();
for( y = 0; y < tc.length ; y++ ){
if (!encodingOk && tc[y] instanceof FormatControl){
if( ( (FormatControl) tc[y] ).setFormat( new VideoFormat(VideoFormat.RGB) ) != null ){
tc[y].setEnabled(true);
}else{
encodingOk = true;
}else{
tc[y].setEnabled(false);
proc.realize();
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
try{
ds = proc.getDataOutput();
}catch(NotRealizedError e){
System.out.println("ERRO ao realizar datasource: " + e);
}catch(ClassCastException e){
System.out.println("Erro ao realizar datasource: " + e);
datasources.add(ds);
System.out.println( ds.getLocator() );
encodingOk = false;
MediaLocator ml = new MediaLocator("rtp://10.1.1.100:99/video");
try {
DataSink datSink = Manager.createDataSink(ds , ml);
datSink.open();
datSink.start();
} catch (NoDataSinkException e) {
System.out.println("Erro ao instanciar DataSink: " + e );
} catch (SecurityException e) {
System.out.println("Erro ao iniciar DataSink: " + e);
} catch (IOException e) {
System.out.println("Erro ao iniciar DataSink: " + e);
}I�m not sure if this code is correctly... it is ?
So... the next part of the systems runs on the PDA..
The code that access this RTP Stream is as follows..
VideoControl c = null;
try {
player = Manager.createPlayer("rtp://10.1.1.100:99/video");
c = (VideoControl) player.getControl("VideoControl");
tela = (Item) c.initDisplayMode( GUIControl.USE_GUI_PRIMITIVE, null);
player.start();
append(tela);
} catch (IOException e) {
str.setText(e.toString());
append( str );
} catch (MediaException e) {
str.setText(e.toString());
append( str );
}So when the APP try to create a player for "rtp://10.1.1.100:99/video" an MediaException is throwed..
javax.microedition.media.MediaException: Unable to create Player for the locator: rtp://10.1.1.100:99/video
So... I don�t know what happen =/
The error is in the PDA module ? Or in the computer�s initialization off the RTP Video Streaming ?
I need finish this job at next week... so any help is usefull..
Waiting for answers
Rodrigo KerkhoffFirst of all: before going onto the j2me part, make sure the server works, before doing anything else! Apparently, it doesn't...
The MediaLocator is generally used to specify a kind of URL depicting where the data put into the datasink should go to. In your case, This cannot be just some URL where you want it to act as a rtps server. You'll need to implement that server yourself I guess. -
Problem with Cut.java sample
I am attempting to use code from the Cut.java sample to cut multiple
regions from the same source audio file to separate destination files.
I am calling the doIt() method from my coding, passing MediaLocators to
the input and output files (both .wav) , and arrays with a single
element (time in ns as a long) for the start and end, and false for
frame mode. The first time I call it, it works fine. However, on
subsequent calls, despite the output messages suggesting it has worked
successfully, the output files are full of white noise. I have tried:
using a new instance of Cut each time
adding code to close the processor and disconnect the datasink
disabling JMF buffering
all to no effect. Any suggestions would be greatly appreciated.
cheers
Matthew Wilson.I have kind of the same problem too.
I copy-paste the "cutting sections from an input" example from http://java.sun.com/products/java-media/jmf/2.1.1/solutions/Cut.java but can't get it to work.
The error I'm getting back is:
- Create processor for: file:/c:/song.mp3
- Configure the processor for: file:/c:/song.mp3
Transcode:
from: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits
to: LINEAR, 44100.0 Hz, 16-bit, Stereo, BigEndian, Signed
- Realize the processor for: file:/c:/song.mp3
Failed to build a graph for the given custom options.
Failed to realize: com.sun.media.ProcessEngine@19360e2
Cannot build a flow graph with the customized options:
Unable to transcode format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits
to: LINEAR, 44100.0 Hz, 16-bit, Stereo, BigEndian, Signed
outputting to: RAW
Error: Unable to realize com.sun.media.ProcessEngine@19360e2
Failed to realize the processor.
Failed to cut the inputsince I'm using eclipse as IDE, I made some "minor" changes on Cut.java to test it on eclipse
public static void main(String [] args) {
args = new String[7];
args[0] = "-o";
args[1] = "file:/c:/tmp.mov"; //outputfile
args[2] = "file:/c:/peli.mov"; //inputfile
args[3] = "-s";
args[4] = "5000";
args[5] = "-e";
args[6] = "25000";
//no more changes...Does any one have an idea what do I'm doing wrong? I'll appreciate ur help. -
Problem with fobs4jmf while playing various formats in JMF application
hi all,
well i am using fobs4jmf & JMF2.1.1e.while playing various formats like avi,dat,xvid etc. JStudio hangs & while playing them with my application program gives following run time error
FOLLOWING ERROR WHILE PLAYING .AVI FILE
Failed to configure: com.sun.media.PlaybackEngine@480457
IO exception: BasicPullParser: readBytes(): Reached end of stream while trying
to read 4 bytes
Error: Unable to realize com.sun.media.PlaybackEngine@480457
javax.media.CannotRealizeException
Exception in thread "main" java.lang.NullPointerException
at Mediaplayer.<init>(Mediaplayer.java:131)
at Mediaplayer.main(Mediaplayer.java:214)
Press any key to continue...
FOLLOWING ERROR WHILE PLAYING .DAT FILE
Failed to configure: com.sun.media.PlaybackEngine@17943a4
Bad header in the media: WAVE Parser: expected magic string WAVE, got CDXA
Error: Unable to realize com.sun.media.PlaybackEngine@17943a4
javax.media.CannotRealizeException
Exception in thread "main" java.lang.NullPointerException
at Mediaplayer.<init>(Mediaplayer.java:131)
at Mediaplayer.main(Mediaplayer.java:214)
Press any key to continue...
i have installed fobs4jmf & all its codec are added in jmf registry.
also is there som multiplexer that has to be added as i am already using a demultiplexer given along with fobs4jmf.
plz reply....
mayank
[email protected]Hi everyone, I am actually trying to make a media player using
JMF and FOBS4JMF. My problem is that I've followed all the procedures to
install fobs4JMF and it all works fine until I try to register jar files using
jmstudio. In fact, it works when i open runjmstudio.bat. The movie is played
fine, jars are correctly registered ... but when I close it and I open jmstudio
again it fails and I get the error : "Failed to realize: input media not
supported: XVID video, mpgelayer3 audio" plus codecs, demultiplexer ... are not registered anymore. In fact, it works with fobs_jmstudio.exe (the one in the fobd4jmf folder) and not with jmstudio.exe (the one in the jmf folder). When I try to add them manually into the second one, I get the error : "Could not add Item". I wonder if you had any idea of what type of problem it could be.
I've posted my problem in many forums but nobody seems to have the solution. Thanks a lot. -
As we know jmf can stream in h.263/rtp with payload 34. i am streaming h.263/rtp to a device which does not understand payload 34 rather payload 96 whihc is used by h.263-1998 and 2000 updated versions.
Do anyone has any idea how can change payload from 34 to compatible with 96.
Sorry if it is not the right place/forum to ask this question. But if any one has any idea where i can ask question regarding transcoding h.263/rtp packets from the one compatible with rfc 2190 (which is supported by jmf and is almost outdated) to packets compatible with rfc 2429.Sorry captfoss i was on leave for some time so could not respond to your reply on time.
While working today i found that JMF has a videoformat :-VideoFormat.H263_1998_RTP which is compaitable with RFC 2429. But there is a problem - i tried several times to transcode my h263 file i am reading from local computer to h263_1998_RTP format but it fails giving following error:-
Failed to realize: com.sun.media.ProcessEngine@19209ea
Cannot build a flow graph with the customized options:
Unable to transcode format: H263, 176x144, FrameRate=15.0, Length=76032 0 extra bytes
to: H263-1998/RTP
outputting to: RAW/RTP
Error: Unable to realize com.sun.media.ProcessEngine@19209eathen i checked in jmf registery i found a codec -com.sun.media.codec.video.vh263.Native Decoder -This Decoder converts h263,h263/rtp as well as h263-1998/rtp into yuv format. but i could not found any encoder which converts any format(yuv or rgb or h263 or any other) to h263-1998/rtp.
Is there any way by which i can transcode to h263-1998/rtp???
Maybe you are looking for
-
How do i install the lastest version of itunes
How do i install the lastest version of itunes
-
How can you tell if you have a virus? I am having trouble with my email and can not get any mail from work. This has been going on for a couple of weeks. My phone is now having issues too! I also have also had a lot of Adobe requests to update.
-
hello when i trying to execute the report from form by using web.show_document display error that is rep-51002 where i am using oracle database 10g and developer suite 10g both are on the same computer. please how can solve this problem. thanks
-
How do I retrive pics from my stolen phone?
I have lost my phone 6months ago. And only recently that I needed my pictures of my cases. How do I retrive it? I turn my icloud on,but how does it works?
-
Goods issue for API DI transfer
hi experts, I have SAP BO and I want to make a goods issue for API DI transfer with excel macro, is that possible??