Views

TOOLBOX

LANGUAGES

Transcoding Module 3.4

From Morfeo Wiki

Jump to: navigation, search

MyMobileWeb 3.4 incorporates a new image transcoding module based on the Standard Transcoding Interface defined by the Open Mobile Alliance. This module incorporates a specific plugin to invoke a remote Alembik Transcoding Server in order to perform image adaptations.

Contents

Standard Transcoding Interface

The scope of the OMA Standard Transcoding Interface (STI v1.0) is to provide a standardized interface between Multimedia Application Platforms and a Transcoding Platform to allow transcoding of media Content files based on application specified Transcoding Parameters and/or user equipment capabilities.

The Standard Transcoding Interface, which uses SOAP over HTTP(S) to perform the communication between Application Platforms and Transcoding Servers, allows service providers to:

  • use a single logical Transcoding Platform for various applications within their network
  • choose their Transcoding Platform provider, i.e. applications no longer have to be tied to specific Transcoding Platforms with proprietary interfaces

The picture below shows a generic view of the OMA generic architecture (grey arrows are out of the scope of STI):

STI Architecture
STI Architecture

In MyMobileWeb use case:

  • MyMobileWeb Application would represent the “Application Platform” in the picture.
  • The Transcoding Platform would be the combination of hardware and software that provide transcoding functionality.

Alembik

Alembik (http://alembik.sourceforge.net/) is an open-source Java project (under LGPL license) which provides a STI fully-compliant transcoding server.

MyMobileWeb STI Transcoding Module

The platform provides a new transcoding module which allows the communication between MyMobileWeb applications any STI fully-compliant transcoders in order to perform image adaptations. Moreover, MyMobileWeb provides a specific plugin to communicate with Alembik servers.

How to configure MyMobileWeb to invoke Alembik

  • First of all, you can download Alembik in SourceForge (so far, MyMobileWeb has been tested with Alembik v.1.0-beta3). You can see further details about the Alembik deployment here.
  • You should deploy Alembik in a remote server according to the Alembik installation instructions. Any web container supporting SOAP (JAXWS 2.x implementation) will be enough to deploy Alembik, since MyMobileWeb will invoke it using the synchronous mode (an EJB3 container is not required in this case) via SOAP.
  • Once you have deployed the application in your server you should configure the transcoder following the Alembik configuration instructions through the web administration console (http://[host:port]/alembik/). Here you should choose the ImageMagickMediaProcessor to perform image adaptations and set the ImageMagick executable path. You can download ImageMagick software here.
  • You should place the alembik-soap-client.jar that comes inside the Alembik distribution inside the WEB-INF/lib folder of your aplication. Inside the alembik-soap-client.jar you will find a transcoding.properties file (in the org.alembik package); here you can modify the wsd location of the Alembik server to be invoked:
service.locator=org.alembik.soap.SOAPServiceLocator
soap.transcoding.wsdl.location=http://MyAlembikServer:MyPort/alembik/process?wsdl
soap.transcoding.namespace.uri=http://soap.alembik.org/
  • You should place the following libraries inside inside the WEB-INF/lib folder of your application. You can get all of them in https://jax-ws.dev.java.net/:
    • jaxws-api.jar
    • jaxws-rt.jar
    • jaxws-tools.jar
    • jaxb-api.jar
    • jaxb-impl.jar
    • stax-ex.jar
    • streambuffer.jar
  • Configure the MyMobileWeb.Global.xml configuration file as follows:
 
    <module name="Transcoders">
        <module name="ImageTranscoder">
            <property name="Plugin_Class" value="org.morfeo.mymw.transcoder.sti.STIImgTranscodingPlugin"/>
            <!--<property name="Plugin_Class" value="org.morfeo.tidmobile.transcoder.TidImgTranscodingPlugin"/>
-->
        </module>
    </module>
 

You should indicate the org.morfeo.mymw.transcoder.sti.STIImgTranscodingPlugin as the new plugin class in charge of performing the transcoding process.

  • Configure the MyMobileWeb.ImageTranscoder.xml configuration file as follows:
 
    <module name="ImageTranscoder">
	<property name="Cache_Work_Directory" value="temp/images"/>
	<property name="STI_Transcoding_Mode" value="remote"/>
	<property name="STI_Resources_Base_Url" value="http://192.168.2.29:8080/MyProyect/{0}"/>
        <property name="STI_Transcoder_Class" value="org.morfeo.mymw.transcoder.sti.AlembikSTITranscoder"/>
    </module>
 

STI_Transcoding_Mode indicates that the transcoding process will be performed in a remote server. In a future a local version will be available, but for now the only option is "remote". STI_Resources_Base_Url indicates the URL used to resolve relative paths. Note that Alembik needs a valid URL to retrieve the resources to be adapted.

E.g: According to de configuration above, a relative resource path as resources/images/image.jpg would be resolved as
http://192.168.2.29:8080/MyProyect/resources/images/image.jpg
, so it would be the final URL sent to Alembik.

STI_Transcoder_Class indicates the class in charge of invoking the Alembik remote server

  • Define the transcoding servlet in WEB-INF/web.xml as follows:
 
 <servlet>
    <servlet-name>
      TranscoderHTTP
    </servlet-name>
 
    <servlet-class>
      org.morfeo.mymw.transcoder.server.TranscoderHTTP
    </servlet-class>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>TranscoderHTTP</servlet-name>
    <url-pattern>/TR</url-pattern>
  </servlet-mapping>
 

How to configure MyMobileWeb to invoke a generic STI transcoding server

  • You should place the jaxb-api.jar and jaxb-impl.jar inside the WEB-INF/lib folder of your application. You can get them from https://jax-ws.dev.java.net/.
  • Configure the MyMobileWeb.ImageTranscoder.xml configuration file as follows:
 
    <module name="ImageTranscoder">
	<property name="Cache_Work_Directory" value="temp/images"/>
	<property name="STI_Transcoding_Mode" value="remote"/>
	<property name="STI_Resources_Base_Url" value="http://192.168.2.29:8080/SportingSCXML/{0}"/>
        <property name="STI_Transcoder_Class" value="org.morfeo.mymw.transcoder.sti.RemoteSTITranscoder"/>
        <property name="STI_Service" value="http://192.168.2.149:8080/Proof/STIService"/>
    </module>
 

This configuration indicates that RemoteSTITranscoder will be in charge of sending the Transcoding Requests to the Service placed in the URL http://192.168.2.149:8080/Proof/STIService and waiting for the response.

CSS Styles

A new set of CSS styles has been defined in order to specify the transformations that the transcoding server should perform. The CSS styles are based on STI transformations, and the full specification could be found here. For now, you can include these CSS styles in your MyMobileWeb image or link controls.

In order to proof the new STI module, you could execute the Advanced example. First of all you should configure the application as it was previously explained. Then you should change the transcoder.css style sheet by other (let's call it transcoder_sti.css) with new CSS styles. Finally you should rename all the references to the transcoder.css style sheet (now they will reference to the transcoder_sti.css) For instance, the transcoder_sti.css could be defined as follows:

link.vertical {
    img-position:top;
}

link.image.transcode {
    transcode:true;
    width:30%;
    resize-directive:aspect-ratio;
}

image.transcode1 {
    transcode:true;
    width:80px;
    height:80px;
    resize-directive:stretch;
}

  
image.transcode2 {
    transcode:true;
    width:80px;
    height:80px;
}

image.transcode3 {
    transcode:true;
    width:50%;
}

image.transcode4 {
    transcode:true;
    width:50%;
}

Other possible CSS examples could be:

image.trans {
    transcode:true;
    content-type:"image/png";
    level-correction:true;
    resize-directive:aspect-ratio;
    rotation:180;
    height:50%;
    width:50%;
}
image.trans {
    transcode:true;
    resize-directive:stretch;
    mirror-axis:UD;
    noise-reduction:true;
    resize-directive:stretch;
    sharpen:false;
    height:30px;
    width:50px;
}

...

Note that CSS styles are only user recommendations to perform the transcoding process. However, it is possible that the transcoding server doesn't support some of the transformations suggested by means of CSS styles (and based on STI transformations). Apart from that, if the transcoding server, due to any reason, return an image that is bigger than the dimensions of the device, the image would not been displayed.

Here you can find the features supported by each Alembik MediaProcessor.