Transcoding to Different Formats
|
|
Problem
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.
Solution
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:
-
Create a Processor for the given input URL.
-
Configure the Processor.
-
Parse the output media locater and based on the file extension, determine
the content descriptor using MimeManager.
-
Set the (output) content descriptor on the Processor.
-
For each of the given track formats:
-
Match it against the supported formats of each track.
-
If there is a match, set the format on that track.
-
Realize the Processor.
-
Obtain the output DataSource and use it in conjuction with the output media
locator to create a DataSink.
-
Start the Processor and DataSink.
-
Wait for the DataSink's EndOfStreamEvent.
-
Close up the Processor and DataSink.
Some error checking is handled as an example.
|
|
| Requirements |
|
| 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 |
|