JMF Solutions

Exporting Media Received over RTP

Given a source IP address, a source port number, and a duration, the object is to receive media stream over the network, transcode the stream to default track formats and generate a resulting file with the transcoded data.

A sample application is written.  It accepts a source IP address and port number where the original data comes from; an output URL where the transcoded data will be saved; and a duration parameter which decides the amount of input data to be received.  The actual algorithm to transcode the data is rather straight forward:
  1. Create an input URL by concatenating source IP address, port number and content type as follows: "rtp://SourceIP1:SourcePort1/ContentType1&SourceIP2:SourcePort2/ContentType2".
  2. Create a Processor for the input URL.
  3. Configure the Processor.
  4. Parse the output media locater and based on the file extension, determine the content descriptor using MimeManager.
  5. Set the (output) content descriptor on the Processor.
  6. For each track, get its supported formats, and set the first format on that track.
  7. Realize the Processor.
  8. Obtain the output DataSource and use it in conjuction with the output media locator to create a DataSink.
  9. Start the Processor and DataSink.
  10. Wait for MediaTime to reach duration, then close the Processor.
  11. Wait for the DataSink's EndOfStreamEvent.
  12. Close up the Processor and DataSink.
Some error checking is handled as an example.
Platform: JDK 1.1.6 or later
JMF API: 2.0 or later
Implementation: AJ, WPP, SPP *

* AJ = All Java, WPP = Windows Performance Pack, SPP = Solaris Performance Pack
Related Classes
How to run this sample
java RTPExport -o <output URL> -d <duration> <session> <session> ...
where <session> is of the form: [SourceIP]:[SourcePort]/[ContentType].

java RTPExport -o file:/c:/temp/
will simultaneously receive video and audio streams and transcode them to a QuickTime movie.
Source Code
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Duke's Choice Awards Nomination RHS

VTS OnDemand RHS Banner

Virtual Tech Summit Sept 2015 RHS banner

JavaOne 2014 Replay banner