Implementation of an Android Phone Based Video Streamer 2010 IEEE/ACM International Conference on Green Computing and Communications 2010 IEEE/ACM International Conference on Cyber, Physical and Social Computing N Vun, Y H Ooi School of Computer Engineering Nanyang Technological University Digital Object Identifier : 10.1109/GreenCom-CPSCom.2010.76 Date of Conference: 18-20 Dec. 2010 Page(s):912 - 915 Adviser : Yih-Ran Sheu Student : Chun-Chang Tu SN : MA120110 Motivation OUTLINE • • • • • • • ABSTRACT INTRODUCTION ANDROID ARCHITECTURE OVERVIEW DEVELOPMENT TOOLS AND ENVIRONMENT SETUP VIDEO CAMERA STREAMING SYSTEM IMPLEMENTATION RESULTS AND DISCUSSION CONCLUDING REMARKS Abstract • This paper presents the implemented of the camera on the mobile phone to capture real time video which is then streamed over the WiFi network. Then the video can be viewed on other station connected to the same network using the standard VLC media player. Introduction 1/3 • Android technology become popular in the consumer electronics market. • They provide very convenient hardware platforms for the developers to implement and test their ideas with much lower cost. Introduction 2/3 • The main objective of this paper is implement a video streamer on an Android based mobile phone. • The implementation is done completely using open source software tools, software modules and technologies without the need of any special or propriety development tool. Introduction 3/3 • Figure 1 illustrates the use of an Android phone as the embedded platform, connecting to an IP network using its WiFi interface. • The video can be viewed on LAN PCs using the open-source VLC media player. Android Architecture Overview Android Architecture Overview Android Architecture Overview JVM dx SDK Development Tools and Environment Setup (1/3) • Development of Android Apps can be conveniently performed using the Eclipse IDE. • For Android App development, extension tools are needed. These extension tools are packaged in the Android Development Tools. • Android SDK starter package contains various development tool chains and libraries are needed by the Eclipse to compile and package the application into the Android Package file. Development Tools and Environment Setup (2/3) Development Tools and Environment Setup (3/3) • The emulator cannot support emulation of specific hardware features like camera. • Application that involves networking will also need proper setup of the virtual router. • As such, sometimes it is more convenient, or inevitable, that testing has to be done with the actual phone when the App makes use of the hardware feature. VIDEO CAMERA STREAMING SYSTEM (1/11) • The application in the Android phone is made up of two modules: a video recorder module and a cross-compiled LIVE555 streamer module. VIDEO CAMERA STREAMING SYSTEM (2/11) • Implementation of the video recorder module makes use of the Media Libraries provided in the Android SDK. • It involves extending the SurfaceView class, creating a SurfaceHolder class and a MediaRecorder class, and implementing a SurfaceHolder.Callback function. VIDEO CAMERA STREAMING SYSTEM (3/11) VIDEO CAMERA STREAMING SYSTEM (4/11) • LIVE555 is used as the engine for streaming the video file in this implementation. VIDEO CAMERA STREAMING SYSTEM (5/11) • As the source code of the Live 555 is created in C/C++, it cannot be compiled to run as a native Android App. • There are two ways to integrate the package into this system: cross compiled the code and run it as a standalone C program, or modify it and compiled as a shared library package. VIDEO CAMERA STREAMING SYSTEM (6/11) • LIVE555 uses the glibc for its library, which is not included in the standard Android libraries. • To overcome this, Live 555 has to be linked statically during compilation, i.e. all the library functions needed are included in the executable code. VIDEO CAMERA STREAMING SYSTEM (7/11) • The compiled LIVE555 program is then transferred to the appropriate file directory in the phone. VIDEO CAMERA STREAMING SYSTEM (8/11) • Another complication is standard Android phone is set to restrict user with limited access to its lower level functions and features. • To start the LIVE555 server through a shell command, the user needs to have root access in the operating environment. • Hence a further step is needed here, the ‘rooting’ of the Android phone. VIDEO CAMERA STREAMING SYSTEM (9/11) • Another alternative is integrate the LIVE555 code together with the Video recorder code and package them as an .apk file. • This will involve the modification of the LIVE555 code to make it as a library function, and combination of the C/C++ and Java languages in an application. VIDEO CAMERA STREAMING SYSTEM (10/11) • This can be achieved by Android’s recent release toolkit, viz. the Android Native Development Kit . • This toolkit allows the programmers to embed native C/C++ code into Android application. • Java Native Interface method is used to bridge the communication between the Java application and the native C/C++ code. VIDEO CAMERA STREAMING SYSTEM (11/11) IMPLEMENTATION RESULTS AND DISCUSSION (1/5) IMPLEMENTATION RESULTS AND DISCUSSION (2/5) • The video of the clock running on the first PC monitor is captured by the Android phone, then streamed through the phone WiFi link to a LAN router, which is then playback in real time by a VLC player running on the second PC. • There is no observable throughput delay in the streaming process under normal network condition. IMPLEMENTATION RESULTS AND DISCUSSION (3/5) • However, though not clearly noticeable in the photo, there is playback frame delay between the source and the playback image. • The delay will depend on the instance the VLC media player is started. This is due to the use of the file as a buffer between the two software modules running on the Android phone. IMPLEMENTATION RESULTS AND DISCUSSION (4/5) • While the video recorder module will start recording the video into the file upon launching by the user, the LIVE555 will only start streaming the video upon receiving the request from the VLC player. • As the LIVE555 streamer starts the video from the beginning of the file, it streams the image that was recorded earlier. IMPLEMENTATION RESULTS AND DISCUSSION (5/5) • Another consequence of using the file buffer is that the system will stop operation once the file size exceeds the maximum limit that the Android platform can support. • To overcome these limitations, the two software modules have to be further modified such that data can be passed directly between them in real time CONCLUDING REMARKS • This paper describes the successful implementation of a video streamer system using an Android phone as the video capturing device. • As the system was setup as a preliminary investigation and evaluation of using the Android platform for embedded applications, certain limitations remain in the implemented system. REFERENCES [1] http://www.npd.com/press/releases/press_100804.html [2] http://developer.android.com/guide/basics/what-is-android.html [3] http://developer.android.com/sdk/eclipse-adt.html [4] LIVE555 Media Server, http://www.live555.com/mediaServer/ [5] VLC Media Player, http://www.videolan.org/vlc/ [6] N. Vun and M Ansary, “Implementation of an Embedded H.264 Live Video Streaming System”, IEEE ISCE 2010 [7] http://en.wikipedia.org/wiki/Rooting_(Android_OS)