37
J Manoj Kumar (M.Tech IIT Bombay) Guided by: Prof. Sridhar Iyer ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Embed Size (px)

DESCRIPTION

ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES. J Manoj Kumar (M.Tech IIT Bombay) Guided by: Prof. Sridhar Iyer. Problem Definition. Adapt CDEEP Live Videos to Mobile Devices. Adapt to low bandwidth networks. Problems in video streaming to mobile devices - PowerPoint PPT Presentation

Citation preview

Page 1: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

J Manoj Kumar (M.Tech IIT Bombay)Guided by: Prof. Sridhar Iyer

ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE

DEVICES

Page 2: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Problem Definition1. Adapt CDEEP Live Videos to Mobile Devices.

Adapt to low bandwidth networks.Problems in video streaming to mobile devices

Limited Memory in Mobile devices. Low Bandwidth of Mobile Network like GPRS.

2. Adapt Java Applets to Mobile DevicesJava Applets are built with J2SE technology that

do not work on mobile devices.Limited Memory in Mobile devices.Mobile devices work on J2ME technology.

Page 3: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Adaptation Of CDEEP Live videos to Mobile Devices

Page 4: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Existing System - Study Element Based System

Works only for “stored CDEEP videos”

Page 5: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Study Element Based SystemThree types of Study Elements are

categorized

i. Presentation Element -- portion of video

that shows one slide of presentation.

ii. White paper Element – portion of video

that shows white paper.

iii. Instructor Element – portion of video that

shows instructor.

Page 6: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES
Page 7: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Classifying ImagesClassification -- Feature based TaggingFeature -- a unique property

Type of Element

Feature Used

Instructor Element

Face Recognition

White paper Element

CDEEP Logo Image

Presentation Element

Heading Color

Page 8: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Proposed System

Page 9: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Live Video Adaptation Module

Capture sets of 300 images from Live stream.Classify each set of images study elements.Copy images and audio to server.

Page 10: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Image Extraction Methodology

Approach 1:Using Video LAN(VLC)

Save or Record for five minutes.Extract Images from saved video.

DisadvantagesHigh CPU utilization because of Video

transcoding.Delay between actual video and seeing video

increases for each iteration.

Page 11: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Convert to MJPEG StreamMJPEG - Motion JPEG ( Images are shown one

after the other). Ex: surveillance camera.Images are separated by delimiter.

DisadvantagesHigh CPU Utilization because of Video

Transcoding.Unable to display images.

Page 12: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Approach 2:Using FFmpeg

Images extracted directly from live stream.ffmpeg -i url -an -r 1 -f image -s 320x240 video

%d.jpgGroup images to sets of 300.

Using Mplayer:Images extracted and grouped directly from

live stream.mplayer -nosound -vf framestep=25 -vo

jpeg:subdirs=img:maxfiles=300 url

Page 13: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Audio ExtractionUsing FFmpeg

Audio is saved in the form of mp3 chunks.

ffmpeg -i url -t 00:00:20 -acodec libmp3lame -ab 24 -ar 8000 audio.mp3

Generate XML

Page 14: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

System Implementation

Page 15: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Sequence Diagram

Page 16: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Design ConsiderationsPort blocking in GSM networks

Direct TCP connections not possible due to port blocking.

Allows only HTTP connection to ports 80 and 8080.

Audio StreamingAudio streaming to mobile device is not

supported.Hence, need to do progressive download.

Page 17: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Usage

1.Enter URL 2. select video 3. slide show

Page 18: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Comparison to Existing System

Supports automatic creation of offline

copy of video.

Live video can be viewed as soon as it

starts.

Misclassifications of images cannot be

corrected.

Page 19: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Adaptation of Applets to Mobile Devices

Page 20: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Project OSCAR

Project OSCAR – Open Source Courseware Animations Repository.

Repository for web-based, interactive animations for various teaching concepts.

Animation is typically an Java Applet with brief description of concept.

Page 21: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Overview of J2MEJava Micro Edition J2ME – small devices like

mobiles, PDA’s with low RAM and speed.

J2ME has 3 principles

Configuration – JVM + set of API’s

Profile – set of API’s designed for specific

configuration

Optional package –technology specific API’s

to extend the capabilities of JVM

Page 22: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Architecture of J2ME

Page 23: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

J2MEConfiguration: specifies JVM and core set of

API’s for a specific family of devices.Two types of configuration

Connected Device Configuration CDC – minimum of 512KB ROM, 256KB of RAM, full JVM must be supported.High end PDA’s, TV setup boxes, car navigation

systems.Connected Limited Device Configuration CLDC –

minimum of 160KB of ROM, 32KB RAM, KVM Mobiles, pagers, PDA’s.

Cannot add native methods.

Page 24: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

J2SE Applets to J2ME Conversion Difficulties1. Incompatibility of Architectures of J2SE and

J2ME

MIDlet architecture Applet Architecture Only one form per screen in MIDlet, Multiple

panels in applet. Difficult to convert from J2ME architecture to J2SE

architecture.

Page 25: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

1. .

2. Canvas size and Co-ordinates of Image Object Designed for Desktop systems Co-ordinates have to be set manually – cannot

be automated

Sample OSCAR paint codepublic void paint(Graphics G){g.drawImage(Image img1, 480, 600,this);g.drawImage(Image img2, 530, 400,this);g,drawImage(Image img3, 60, 370, this);}

Page 26: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

1. Amount of Text on Screen Designed for Desktop Resolutions – cannot be fit

mobile screen, preplanning cannot be automated.Sample OSCAR animation with text field.

public void init(){ta = new TextArea("", 31, 47);ta.setText("\n\t Energy Transaction in Biological

Systems\n"+"\n In this animation you will learn the concepts of ATP

Metabolism……….……………… 10 lines };

Page 27: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Other General DifferencesNo floating point support in J2ME.

No Java Native Interface (JNI) in J2ME.

No finalize method in J2ME.

No Thread Groups.

Page 28: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

J2SE to J2ME – Conversion Possibilities1. Copy of Paint Method

J2ME uses J2SE’s Graphics class with minor changes -- enables copy paint method as it is during conversion

Sample applet with paint methodpublic void paint( Graphics g){

g.drawString("Sending",150,75);

g.drawRect("40,50,10,20);

g.drawImg(Image img,20,30,center);

g.drawArc(30,40,10,30,60,120);}

g.drawString, g.drawRect, g.drawImg, g.drawArc are common in both j2se and j2me

Page 29: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Buttons to Key mappingJ2ME doesn’t display buttons, it uses mobile

device keys take input OSCAR animations -- buttons like start, stop. Buttons to key mapping is possible.

LWUITLight Weight User Interface Toolkit is a UI

library developed by Sun.Offers advanced UI capabilities and API

inspired by Swing.LWUIT allows multiple panels on screen.

Page 30: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Overview of Flash and Action Script

Flash – multimedia platform language for creating

animations

Action Script can be embedded. – ECMA script.

AS is Object Oriented similar to Java Script.

AS + Flash – more interactive animations.

Used to build Rich Internet Applications.

Flash Lite – highly optimized flash runtime for mobiles.

Provides same functionality similar to desktop.

Page 31: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Applet to Flash – Conversion DifficultiesNo Multi-Threading in Flash

Multi-Threading – two or more parts in a program to run concurrently ( Multitasking ).

Essential ability to have code do something while UI is doing something else.

Single Thread – Having heavy computation, cannot update UI.

Program becomes un-responsive and crashes after 60 seconds.

Sample OSCAR program with threadclass Timer extends Thread {//code//void Settime();void sleep(); }

Page 32: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Conversion difficultiesNo method(function) overloading

Difficult for multiple methods – if constructor overloading

Sample java programpublic void defaultSetter(int iValue) {

setter(iValue, false); }

public void setter(int iValue, boolean bForce) {

// whatever }

In action scriptpublic function setter(iValue:int, bForce:Boolean =

false):void {

// whatever }

Page 33: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Other General Difficulties and Possibilities1. Limited Data Structures

Action script supports only Arrays and Dictionary. No queues, no linked List, no stack compared to Java. Need to re-implement data structures which are

wrapped.

2. No Blocking Next code of line is supposed to run, user cannot

prevent it from run – Alert.show(); does not stop exexctuing next line.

Possibilities• Java and Action Script have same syntax with a little

change.• Syntax change automated by Java to Action script

converter (J2AS3)

Page 34: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

ConclusionSuccessfully integrated to existing Study

element based adaptation.Live video transmission of CDEEP videos

can be adapted to networks with low bandwidth.

Automated porting Java applets to mobile devices as J2ME MIDlets and flash files is difficult and infeasible.

Page 35: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Future Work1. Decrease Misclassifications of images

Study element based system is prone to errors. Better feature based classification.

2. Synchronization between audio and images

Synchronizing audio with the image slideshow.

3. Text Improvement Identify text in study elements and improve text

quality.

Page 36: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

References1. Fabrice Bellard. Ffmpeg codec manual.

http://www.ffmpeg.org/ffmpeg-doc.html .

2. Free Software Foundation. Mplayer manual. http://www.mplayerhq.hu/DOCS/HTML/en/index.html.

3. G.N. Murthy and S. Iyer. Study element based adaptation of lecture videos to mobile devices. In Communications (NCC), 2010 National Conférence on, pages 1 - 5, 29-31 2010.

4. Herbert Schildt . Java 2ME the complete reference. Osborne/McGraw-Hill, fourth edition, 2001.

Page 37: ADAPTATION OF APPLETS AND LIVE VIDEOS TO MOBILE DEVICES

Questions?