JMF Solutions

Transcoding to Different Formats

Given an input URL, the object is to transcode the input media to different track formats and generate a resulting file with the transcoded data.  The output file could also be of a different content type from the original input.

A sample application is written.  It accepts an input URL where the original data comes from; an output URL where the transcoded data will be saved; and a list of track formats of which the input data will be transcoded to.  The actual algorithm to transcode the data is rather straight forward:
  1. Create a Processor for the given input URL.
  2. Configure the Processor.
  3. Parse the output media locater and based on the file extension, determine the content descriptor using MimeManager.
  4. Set the (output) content descriptor on the Processor.
  5. For each of the given track formats:
    1. Match it against the supported formats of each track.
    2. If there is a match, set the format on that track.
  6. Realize the Processor.
  7. Obtain the output DataSource and use it in conjuction with the output media locator to create a DataSink.
  8. Start the Processor and DataSink.
  9. Wait for the DataSink's EndOfStreamEvent.
  10. 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 Transcode -o <output URL> -a <audio format> -v <video format> <input URL>
<audio format> is of the form:
[encoding]/[rate]/[sizeInBits]/[channels]/[big|little]/[signed|unsigned] <video format>: is of the form: [encoding]

java Transcode -o file:/c:/temp/ -a linear/8000 file:/c:/movies/amovie.avi
will transcode the input AVI movie to a QuickTime movie with 8KHz linear audio.
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