This discussion is archived
0 Replies Latest reply: Nov 9, 2012 3:12 AM by 973473 RSS

Problem with videoformat

973473 Newbie
Currently Being Moderated
Hi everybody,

I'm new in JMF and I'm trying to develop an aplication to capture webcam video stream on a computer end send it to another computer by the Lan.
I write the program and when I try to execute it some messages appear. These messages can be :

CannotRealizedException : unable to provide all requested trakcs

or


Class: com.ibm.media.codec.video.h263.NativeEncoder@ece65
can only encode in sizes: 128x96, 176x144, 352x288.
streams is [Lcom.sun.media.multiplexer.RawBufferMux$RawBufferSourceStream;@19209ea : 1
sink: setOutputLocator rtp://192.168.2.11:5004/video
BUILD STOPPED (total time: 1 minute 12 seconds)


I know that these error messages are due to this line :   static final Format[] lesformats = new Format[]{new VideoFormat(VideoFormat.YUV)};//new VideoFormat(VideoFormat.JPEG_RTP)

Please, is there someone who can help me to resolve this for I can continue? I'm trying to find a solution a week ago.Find the code below

Regards

P.S : another problem is that when I want to see formats supported by the webcam,the size of the vector is 0.



package servstream;

import java.awt.Dimension;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.media.protocol.DataSource;
//import javax.annotation.processing.Processor;
import javax.media.*;
import javax.media.format.VideoFormat;
import javax.media.protocol.ContentDescriptor;
import javax.media.ProcessorModel;
import java.lang.*;
import java.util.Vector;
//import javax.media.Processor;

/**
*
* @author Jean Charles
*/
public class ServStream
{
private static String port = "22224";
private static InetAddress addrip;
static final Format[] lesformats = new Format[]{new VideoFormat(VideoFormat.YUV)};//new VideoFormat(VideoFormat.JPEG_RTP)

static final ContentDescriptor descripteur = new ContentDescriptor(ContentDescriptor.RAW_RTP);
private static Vector vectlistperiph;
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException, NoDataSourceException, NoProcessorException, CannotRealizeException, NoDataSinkException
{

MediaLocator inputmdl = new MediaLocator("vfw://0");
vectlistperiph = CaptureDeviceManager.getDeviceList(null);
     if (vectlistperiph == null)
{
     System.out.println("List vector is null");
     
     }
     if (vectlistperiph.size() == 0)
     {
     System.out.println("List vector size is 0");
     System.exit(0);
     }


DataSource dsrce = (DataSource) Manager.createDataSource(inputmdl);
ProcessorModel procmod = new ProcessorModel(dsrce,lesformats,descripteur);
try
{
Processor myprocessor = Manager.createRealizedProcessor(procmod);
MediaLocator outputmdl = new MediaLocator("rtp://192.168.2.11:5004/video");
DataSink destin = Manager.createDataSink(myprocessor.getDataOutput(),outputmdl);
destin.open();
destin.start();
}
catch(CannotRealizeException e)
{
System.out.println("Erreur "+ e);
System.exit(0);
}

}
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points