JMF Video Stream via Jxta

Hi all,
i want to Stream live video and audio from a webcam device.
I got an mixedDatasource and can display it.
now my question: if it is possible to stream a infinity large PushBufferDataSource via Jxta (Peer to Peer)?
Here my code:
          Format formats[]=new Format[2];
          formats[0]=new VideoFormat(VideoFormat.YUV);
          formats[1]=new AudioFormat(AudioFormat.LINEAR);
          Processor proz=null;
          ProcessorModel mod=new ProcessorModel(mixedDataSource,formats,new ContentDescriptor(ContentDescriptor.RAW));
          try {
               proz=Manager.createRealizedProcessor(mod);
          } catch (Exception e) {               
               e.printStackTrace();
               System.exit(-1);
          proz.start();
          PushBufferDataSource ds=(PushBufferDataSource)proz.getDataOutput();
          try {
               ds.connect();
          } catch (IOException e) {               
               e.printStackTrace();
          }thanks for any suggestions
Greetz

s its possible. we made project i made it . if u want sourcencode mail me to sivaitvlr@gmail,com

Similar Messages

  • JMF video streaming

    Hi all,
    I want to use JMF video streaming api but I have no idea how to do it.
    I want to create several "agents" where each agent streams a single video to a certain ip address . (actually i want each agent to stream to the same computer)
    I want in my application (not the agents applications) to capture each of these streams and display each of them seperately.
    How can this be achieved with JMF ?
    thx.

    no one ????

  • Video Streamer Via Internet

    Hi, I scoured the forums and couldn't find anything that really satisfied my question: Can I stream videos over the internet without encoding anything?
    For example, I want to stream my library of about .75 TB from my computer at my college apartment to pretty much any other place I'm at, with no (or minimal) encoding. On the fly encoding would be possible to do since my computer is pretty beefy and should be able to handle it.
    Linux to Windows would probably be preferable.
    Last edited by brando56894 (2010-03-19 05:35:07)

    java_developper wrote:
    My problem is: the server can't recieve the video stream.Wowzers! That sounds like a biggie!

  • Capturing two video streams via firewire simutaneously

    I want to record two videos from two firewire cameras simutaneously to my hardrive directly. I have been able to record 1 stream into quicktime and one stream in imovie hd at the same time without any trouble. Just want to save the space the hd dv format video file takes up. Would buying another quicktime pro license allow me to set one quicktime for one camera and the other quicktime for the other camera. If i can do this would the record setting be best set on mp4 or h.264 if I am editing this in fcp. If this isn´t plausible, does anyone know of software out there that might solve my problem. Can you achieve this in FCP. Thanks Dave

    Just click on the QuickTime Player icon in the Applications folder. Command-C to copy it then Command-V to paste it. You now have two copies of QuickTime Player. Open one, set it's input, then open the other and see if you can set it's input separately.

  • JMF Video Stream

    I'm transmiting my webcam video to another computer via VideoTransmit.java. But when i'm sending my webcam video, at the same time i want to display my video on my computer too. How can i do that?
    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);
    }Edited by: [email protected] on Dec 24, 2007 9:32 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    s its possible. we made project i made it . if u want sourcencode mail me to sivaitvlr@gmail,com

  • I watch a video stream via VLC plugin; how can I open it in VLC player?

    In Windows 7 I watch TV streams that use the VLC plugin; I would like to know how to obtain the stream "address" and open it in the VLC Player itself!?

    Then ask on a vlc forum, or the TV support site.
    Some companies streaming TV will not be intending for you to operate in such a manner and potentially save their content. Copyright issues are likely to be involved.

  • Video Stream via Network

    Please help me to choose a CISCO devices

    I think you are looking some device like this :
    http://www.cisco.com/en/US/products/hw/contnetw/ps1863/index.html

  • How do I make only the video stream through atv and keep audio via pc

    Basically I am having the video streamed via atv3 to my tv via HDMI, but I want the speakers connected to my PC to be used. They're logitech speakers that have the pink-green-black 3.5mm cable setup. They can't be plugged into the TV and it appears that the HDMI stream pulls audio through the TV but I just want it to only stream the video, if that's possible.
    I have searched other forums but due to ignorance I couldn't quite understand if their questions were the same, and the answers didn't seem to fit
    Any help would be great, thanks.

    Welcome to the forums!
    What is the size limit for your email system? It may be that it is too small for any reasonable audio file. I'd suggest looking at a file-hosting and download service like YouSendIt, which would let people download the full presentation.

  • Get underlaying video stream

    Hello. I am new to media in Java. I want to take a byte stream from a webcam and send it via a JXTA socket to my remote computer (this is going on a robotic submarine). What I can't figure out is how to get the byte stream from the camera and then feed it to a player on the other end. How do I get the underlaying byte stream?

    1. Use JMF to write the video to a temp file (preferably in the ram). Read the temp file into a JXTA socket to be sent. On the client side, read the data in the socket into a temp file. Point a player at the temp file to play the video.If you're wanting to do this, then rather than writing it to a temp file, you could simply create a custom DataSink and have the DataSink send the file via your JXTA socket.
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/DataSourceReader.html]
    The entire file will be passed into your code, and you can do whatever you want with the data. The example just sends the data to be printed in a function called printDataInfo.
    2. Use the RTP protocol in the JMF libraries to push a stream onto a port on the loopback address. Read the stream on the port as a UDP byte stream instead of an RTP stream. Feed the recieved byte stream in to the JXTA socket. On the client side, read the JXTA socket stream into a udp stream and send it to another port on the local machine. Read the UDP stream as a RTP stream back into a player. Or, you could simply write a custom RTPConnector that would replace the UDP socket with a JXTA socket, so you'd be able to deliver the video packets via JXTA instead of UDP.
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/RTPConnector.html]
    Swap out the UDP sockets in this example for JXTA sockets.
    Of the two ideas, the RTPConnector option is probably the easier to implement because the sample code already does everything, you just have to swap out the kinds of sockets it uses.

  • Remote video streaming not working with Windows Server Essentials Media Pack

    I installed Server Essentials Media Pack and the video streaming via remote access does not seem to be working. I see all the video files on the server's remotewebaccess page in "Media Library" group. When I try to play the video in Chrome
    the player appears for a brief moment, but then the browser starts downloading the entire file. With Internet Explorer the empty browser window opens and the download starts. I am trying it while outside of my local network. The video streaming used to work
    with Server 2012 Esesentials. Am I missing some additional codecs or remote streaming is no longer supported?

    Hi,
    What’s the default player for these media files on your computer? The issue may be caused by the default player could not load the media file correctly. Please make sure Windows Media Player
    with full codec installed is the default one. And then check if the media streaming feature could work as normal. Here is an article about how to configure the media streaming feature, hope it helps.
    Manage Digital Media in Windows Server 2012 Essentials
    http://technet.microsoft.com/en-us/library/jj628151.aspx
    Best Regards,
    Andy Qi
    Andy Qi
    TechNet Community Support

  • Video is not streaming via home sharing to apple TV V2, any thoughts?

    Video is not streaming via home sharing to apple TV V2, any thoughts?

    Troubleshooting Home Sharing with Apple TV (2nd generation)

  • Topic: Microsoft's Silverlight for Mac. I wanted to video stream a movie via Verizon FIOS. It demanded Silverlight.dmg Macbok Pro refused to download from 3rd party supplier (CNET). How can I get this?

    Topic: Microsoft's Silverlight for Mac. I wanted to video stream a movie via Verizon FIOS. It demanded Silverlight.dmg.  Macbok Pro refused to download from 3rd party supplier (CNET). How can I get this from Apple?  The Verizon FIOS video website was churning on the error message, "Checking device registration status."  It got stuck in a loop. Verizon tech support never came on. Was on terminal "Hold."  Any recommendations?

    Never download anything from CNET. The site is untrustworthy and is known to distribute Windows spyware intentionally.

  • P2p video streaming using jmf (is it possible to "forward" the stream ?)

    Hello
    In my project a peer will start streaming captured video from the webcam to his neighbors and then his neighbors will have to display the video and forward(stream) it to their neighbors and so on . So my question is can i do this using jmf , a simple scenario will be : peer_1 streams to peeer_2 and then peer_2 to forward(stream) the video received from peer_1 to peer_3 .
    I've read the jmf2_0 guide and i've seen that it's only possible to stream from a server to a client and that's about it , but i want also the client to pass the stream forward to another client ... like for example [http://img72.imageshack.us/img72/593/p2pjmf.gif|http://img72.imageshack.us/img72/593/p2pjmf.gif]
    I want to know at least if this it's possible with jmf or should i start looking for another solution ? and do you have any examples of such projects or examples of forwarding the stream with jmf ....
    thanks for any suggestions

    _Cris_ wrote:
    I want to know at least if this it's possible with jmf or should i start looking for another solution ? and do you have any examples of such projects or examples of forwarding the stream with jmf .... You can do what with JMF. Once you receive the stream, it's just a video stream. You can do anything you want with it...display it, record it, or send it as an RTP stream.

  • Does anyone know a work around to broadcast live (in real time) via video stream through a BC website?

    Does anyone know a work around to broadcast live (in real time) via video stream through a BC website?
    ~Leritha

    There is no work around. You would look to use a service, like Twitch, you get a embed code for the live stream, you put that on a page and away you go. All depends on the service your using.

  • Advantages of JMF in video streaming

    Hi,
    Video conferencing can be done by many methods but why JMF is used for video/audio streaming
    what are its advantages? and Also what are its disadvantages?
    Is there any other better way to do video conferencing ?
    Please give details regarding the current scenario of JMF in video streaming.
    thanx

    Video conferencing can be done by many methods but why JMF is used for video/audio streaming
    what are its advantages?It has RTP built-in, handles a handful of the most basic codecs, there is decent documentation for it...is written in Java... easily extendible for new codec support...
    what are its disadvantages? It hasn't been updated or supported in 7 years... Windows 2000 was the last supported operating system... has bugs which will never be fixed... only supports a handful of low-bandwidth formats for streaming...
    Is there any other better way to do video conferencing ? Yeah, tons...the best alternative right now would probably be with Adobe Flex technology, but JavaFX and Silverlight will both have audio & video capturing / streaming capabilities soon...

Maybe you are looking for

  • Maximum number of emails on server

    hi I have since months following situation : bb 9300 on vodafon italy some email accounts working ok one email account worked ok until two months ago now when I validate it , it remians validated for few seconds and then I recieve an email on bb only

  • I bought a suscription to a magazine but it did not work

    I bought a one year subscription to Cosmopolitan en Español" but now that the new edition is there, it is asking me to pay again. What can I do?

  • Mac does not start is asking me to reboot from back up

    My Mac is not starting and is asking me to reboot from the time machine however it is showing me that the latest complete backup is form September. Should I reboot from there and once I am in I will be able to  rescue latest backups or should I re-in

  • How to retain 3D View while embedding U3D in PDF

    Hi, I'm using PDF Library to embed U3D data into PDF file. But I noticed that when I open my PDF file, the 3D Views created in U3D file are not retained. I know that in Acrobat 3D when we embed U3D, there is is check box reading "Retains views, comme

  • Forms Takes TOOOOOO Long to Load

    Hi all, I am having a form containing a tabbed canvas consisting of 7 tab pages.There are approximately 8 blocks containing nearly 300 items in total(mainly display items and buttons and no image items) and nearly 10 form level program units and 2 li