CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu

Similar documents
CS 4518 Mobile and Ubiquitous Computing Lecture 7: Location-Aware Computing Emmanuel Agu

Introduction to LAN/WAN. Application Layer 4

Chapter 9. Multimedia Networking. Computer Networking: A Top Down Approach

Mohammad Hossein Manshaei 1393

Multimedia: video ... frame i+1

Networking Applications

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu

Chapter 7 Multimedia Networking

CS 457 Multimedia Applications. Fall 2014

Multimedia Networking

CS 403X Mobile and Ubiquitous Computing Lecture 14: Google Places, Other Useful Android APIs and Cool Location Aware Apps Emmanuel Agu

Week-12 (Multimedia Networking)

CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

CSC 401 Data and Computer Communications Networks

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu

CSC 4900 Computer Networks: Multimedia Applications

CS 4518 Mobile and Ubiquitous Computing Lecture 15: Final Project Slides/Paper, Other Ubicomp Android APIs Emmanuel Agu

CS 218 F Nov 3 lecture: Streaming video/audio Adaptive encoding (eg, layered encoding) TCP friendliness. References:

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu

Page 1. Outline / Computer Networking : 1 st Generation Commercial PC/Packet Video Technologies

Chapter 28. Multimedia

Tema 0: Transmisión de Datos Multimedia

Mul$media Streaming. Digital Audio and Video Data. Digital Audio Sampling the analog signal. Challenges for Media Streaming.

ITEC310 Computer Networks II

CS 4518 Mobile and Ubiquitous Computing Lecture 10: Location-Aware Computing Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Data-Driven Views and Android Components Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

Data Representation. Reminders. Sound What is sound? Interpreting bits to give them meaning. Part 4: Media - Sound, Video, Compression

Internet Video Delivery. Professor Hui Zhang

9/8/2016. Characteristics of multimedia Various media types

CS 3516: Advanced Computer Networks

Computer Networks. Wenzhong Li. Nanjing University

Multimedia Networking

Audio and video compression

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu

Multimedia Networking

Mul$media Support in Android

Chapter 9. Multimedia Networking. Computer Networking: A Top Down Approach

CS 528 Mobile and Ubiquitous Computing Lecture 7b: Smartphone Sensing. Emmanuel Agu

About MPEG Compression. More About Long-GOP Video

Lecture 19 Media Formats

Digital Asset Management 5. Streaming multimedia

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

3.01C Multimedia Elements and Guidelines Explore multimedia systems, elements and presentations.

CS 528 Mobile and Ubiquitous Computing Lecture 4b: Face Detection, recognition, interpretation + SQLite Databases Emmanuel Agu

Streaming (Multi)media

CS 4518 Mobile and Ubiquitous Computing Lecture 6: Databases, Camera, Face Detection Emmanuel Agu

How to achieve low latency audio/video streaming over IP network?

CS640: Introduction to Computer Networks. Application Classes. Application Classes (more) 11/20/2007

The Gullibility of Human Senses

CSCD 433/533 Advanced Networks Fall Lecture 14 RTSP and Transport Protocols/ RTP

MULTIMEDIA I CSC 249 APRIL 26, Multimedia Classes of Applications Services Evolution of protocols

Image and video processing

Multimedia Systems. Lehrstuhl für Informatik IV RWTH Aachen. Prof. Dr. Otto Spaniol Dr. rer. nat. Dirk Thißen

JVA04 HDMI to USB Type-C Game Capture Station Manual Contents

Optimized Strategies for Real-Time Multimedia Communications from Mobile Devices

Compression; Error detection & correction

Outline. QoS routing in ad-hoc networks. Real-time traffic support. Classification of QoS approaches. QoS design choices

INTRODUCTORY COMPUTER NETWORKS PHYSICAL LAYER, DIGITAL TRANSMISSION FUNDAMENTALS. Faramarz Hendessi

Lecture Information Multimedia Video Coding & Architectures

Protocol Layers, Security Sec: Application Layer: Sec 2.1 Prof Lina Battestilli Fall 2017

Chapter 2 Application Layer

Compression and File Formats

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 4

Lecture 9: Media over IP

Chapter 2 Application Layer. Lecture 4: principles of network applications. Computer Networking: A Top Down Approach

CSCD 443/533 Advanced Networks Fall 2017

For Video Mixing, Switching, Live Broadcasting and Recording

Computing in the Modern World

Lecture Information. Mod 01 Part 1: The Need for Compression. Why Digital Signal Coding? (1)

Mul$media Techniques in Android. Some of the informa$on in this sec$on is adapted from WiseAndroid.com

Chapter 7: Multimedia Networking

Products Presentation 2015

Data Representation and Networking

Review of Previous Lecture

Compression; Error detection & correction

IMPROVING LIVE PERFORMANCE IN HTTP ADAPTIVE STREAMING SYSTEMS

The Transport Layer: User Datagram Protocol

CS 403X Mobile and Ubiquitous Computing Lecture 7: Final Projects + Smorgasbord of Stuff!! Emmanuel Agu

Full HD HEVC(H.265)/H.264 Hardware IPTV Encoder Model: MagicBox HD4 series MagicBox HD401: Single channel HDMI/AV, HDMI/VGA/YPbPr/AV, HDSDI input

Ch 4: Multimedia. Fig.4.1 Internet Audio/Video

Key features: Ultra-responsive 10.1 Multitouch Capacitive Display. Powerful ARM Cortex - A8 1GHz Processor. 1080p Full HD Video Playback

Content distribution networks

Advanced Networking Technologies

Multimedia

Our Technology Expertise for Software Engineering Services. AceThought Services Your Partner in Innovation

MPEG-4. Today we'll talk about...

Mohammad Hossein Manshaei 1393

RealMedia Streaming Performance on an IEEE b Wireless LAN

CS 3516: Advanced Computer Networks

CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu

Steady stream of bits 9/6/2014 5:02:53 PM. Edward Jackson

Integrated Kickstand

Encode and Stream Solutions.

Completing the Multimedia Architecture

Chapter 7 (Week 14) The Application Layer (CONTINUATION ANDREW S. TANENBAUM COMPUTER NETWORKS FOURTH EDITION PP

15 Data Compression 2014/9/21. Objectives After studying this chapter, the student should be able to: 15-1 LOSSLESS COMPRESSION

Introduction to Networked Multimedia An Introduction to RTP p. 3 A Brief History of Audio/Video Networking p. 4 Early Packet Voice and Video

Transcription:

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu

Reminder: Final Project 1-slide from group in 2 weeks Thursday October 11: 2/30 of final project grade Slide should cover 3 aspects 1. Problem you intend to work on Solve WPI/societal problem (e.g. walking safe at night) Points awarded for difficulty, components used (location, sensor, camera, ML) If games, must gamify solution to real world problem 2. Why this problem is important E.g. 37% of WPI students feel unsafe walking home 3. Summary of envisioned mobile app (?) solution 1. E.g. Mobile app automatically texts users friends when they get home at night You can: Bounce ideas of me (email, or in person) Change idea any time

Final Project: Difficulty Score Project execution: 80% Project difficulty score: 20% Mobile Components and Android UI (4 points each) Every 5 Android screens (A maximum of 8 points can be earned for the UI) Playback audio/video Maps, location sensing Camera: simply taking pictures Ubiquitous Computing Components & Android UI (6 points each) Activity Recognition, sensor programming, step counting GeoFencing, Mobile Vision API: e.g. Face/barcode detection/tracking Machine/Deep Learning (10 points each) Machine/deep learning (i.e. run study, gather data or use existing dataset to classify/detect something) Program Android, machine learning/deep learning components

Multimedia Networking: Basic Concepts

Multimedia networking: 3 application types Multimedia refers to audio and video. 3 types 1. streaming, stored audio, video streaming: transmit in batches, begin playout before downloading entire file e.g., YouTube, Netflix, Hulu Streaming Protocol used (e.g. Real Time Streaming Protocol (RTSP), HTTP streaming protocol (DASH)) 2. streaming live audio, video e.g., live sporting event (futbol) 3. conversational voice/video over IP Requires minimal delays due to interactive nature of human conversations e.g., Skype, RTP/SIP protocols Credit: Computer Networks (6 th edition), By Kurose and Ross

Digital Audio Sender converts audio from analog waveform to digital signal E.g PCM uses 8-bit samples 8000 times per sec Receiver converts digital signal back into audio waveform Insert figure 7-57 Tanenbaum Analog audio Digital audio

Audio Compression Audio CDs: 44,100 samples/second Uncompressed audio, requires 1.4Mbps to transmit real-time Audio compression reduces transmission bandwidth required E.g. MP3 (MPEG audio layer 3) compresses audio down to 96 kbps

Video Encoding Digital image: array of <R,G,B> pixels Video: sequence of images Redundancy: Consecutive frames mostly same (1/30 secs apart) Video coding (e.g. MPEG): use redundancy within and between images to decrease # bits used to encode video Spatial (within image) Temporal (from 1 image to next) spatial coding example: instead of sending N values of same color (all purple), send only two values: color value (purple) and number of times repeated (N)...... frame i temporal coding example: instead of sending complete frame at i+1, send only differences from frame i Credit: Computer Networks (6 th edition), By Kurose and Ross frame i+1

MPEG-2: Spatial and Temporal Coding Example MPEG-2 output consists of 3 kinds of frames: I (Intracoded) frames: JPEG-encoded still pictures (self-contained) Acts as reference, if packets have errors/lost or stream fast forwarded P (Predictive) frames: Encodes difference between a block in this frame vs same block in previous frame B (Bi-directional) frames: Difference between a block in this frame vs same block in the last or next frame Similar to P frames, but uses either previous or next frame as reference 3 consecutive frames

MPEG Generations Different generations of MPEG: MPEG 1, 2, 4, etc MPEG-1: audio and video streams encoded separately, uses same clock for synchronization purposes Audio signal Clock Audio encoder System multiplexer MPEG-1 output Video signal Video encoder Sample MPEG rates: MPEG 1 (CD-ROM) 1.5 Mbps MPEG2 (DVD) 3-6 Mbps MPEG4 (often used in Internet, < 1 Mbps)

Playing Audio and Video in Android

MediaPlayer http://developer.android.com/guide/topics/media/mediaplayer.html Android Classes used to play sound and video MediaPlayer: Plays sound and video AudioManager: plays only audio Any Android app can create instance of/use MediaPlayer APIs to integrate video/audio playback functionality MediaPlayer can fetch, decode and play audio or video from: 1. Audio/video files stored in app s resource folders (e.g. res/raw/ folder) 2. External URLs (over the Internet)

MediaPlayer http://developer.android.com/guide/topics/media/mediaplayer.html MediaPlayer supports: Streaming network protocols: RTSP, HTTP streaming Media Formats: Audio (MP3, AAC, MIDI, etc), Image (JPEG, GIF, PNG, BMP, etc) Video (MPEG-4, H.263, H.264, H.265 AVC, etc) 4 major functions of a Media Player 1. User interface, user interaction 2. Handle Transmission errors: retransmissions, interleaving 3. Decompress audio 4. Eliminate jitter: Playback buffer (Pre-download 10-15 secs of music)

Using Media Player: http://developer.android.com/guide/topics/media/mediaplayer.html Step 1: Request Permission in AndroidManifest or Place video/audio files in res/raw If streaming video/audio over Internet (network-based content), request network access permission in AndroidManifest.xml: Internet If playing back local file stored on user s smartphone, put video/audio files in res/raw folder

Using MediaPlayer Step 2: Create MediaPlayer Object, Start Player To play audio file saved in app s res/raw/ directory Note: Audio file opened by create (e.g. sound_file_1.mpg) must be encoded in one of supported media formats

Using MediaPlayer Step 2: Create MediaPlayer Object, Start Player To play audio from remote URL via HTTP streaming over the Internet

Releasing the MediaPlayer MediaPlayer can consume valuable system resources When done, call release( ) to free up system resources In onstop( ) or ondestroy( ) methods, call MediaPlayer in a Service: Can play media (e.g. music) in background while app is not running Start MediaPlayer as service

Playing Audio File using MediaPlayer Example from Android Nerd Ranch 1 st edition

MediaPlayer Example to Playback Audio from Android Nerd Ranch (1 st edition) Ch. 13 HelloMoon app that uses MediaPlayer to play audio file

HelloMoon App armstrong_on_moon.jpg Put image armstrong_on_moon.jpg in res/drawable/ folders Place audio file to be played back (one_small_step.wav) in res/raw folder Create strings.xml file for app Play, Stop, Image description..

HelloMoon App HelloMoon app will have: 1 activity (HelloMoonActivity) that hosts HelloMoonFragment AudioPlayer class will be created to encapsulate MediaPlayer First set up the rest of the app: 1. Define fragment s XML layout 2. Create fragment java class 3. Modify the activity (java) and its XML layout to host the fragment Activity (HelloMoonActivity) Fragment (HelloMoonFragment)

Defining the Layout for HelloMoonFragment Define XML for HelloMoon UI (fragment_hello_moon.xml)

Creating a Layout Fragment Previously added Fragments to activity s java code Layout fragment: Can also add fragments to hosting Activity s XML file We will use a layout fragment instead Create activity s XML layout (activity_hello_moon.xml) Activity s XML layout file contains/hosts fragment

Set up HelloMoonFragment.java Inflate view in oncreateview( ) Get handle to Start, Stop buttons

Create AudioPlayer Class encapsulates MediaPlayer

Hook up Play and Stop Buttons

Speech: Android Support

Speaking to Android http://developer.android.com/reference/android/speech/speechrecognizer.html https://developers.google.com/voice-actions/ Speech recognition: Accept inputs as speech (instead of typing) e.g. dragon dictate app? Note: Requires internet access Two forms 1. Speech-to-text Convert user s speech to text. E.g. display voicemails in text 2. Voice Actions: Voice commands to smartphone (e.g. search for, order pizza) Speech to text

Live Streaming

Live Streaming Live streaming extremely popular now (E.g. going Live on Facebook) A person can share their experiences with friends Popular live streaming apps include Facebook, Periscope Also possible on devices such as Go Pro Uses RTMP (real time protocol by Adobe), or other 3 rd party APIs Facebook Live Live GoPro

Live Streaming Bandwidth Issues On WiFi, bandwidth is adequate, high quality video possible Cellular links: Low bandwidth, Variable bandwidth (multi-path fading) Even when standing still Optimized for download not upload Video quality increasing faster than cellular bandwidths Ultra HD, 4k cameras makes it worse, now available on many smartphones

mobilivup Live Streaming P Lundrigan et al, Mobile Live Video Upstreaming, International Teletraffic Congress, 2016 Scenario: Multiple smartphones in same area mobilivup approach: Live video upstreaming using neighbors: Cell protocol guarantees each smartphone slice of cell bandwidth Use/Combine neighbors bandwidth to improve video quality Streaming smartphone: WiFi Direct connection to neighbors WiFi Direct allows smartphones connect directly, no Access Point

Live Streaming P Lundrigan et al, Mobile Live Video Upstreaming, International Teletraffic Congress, 2016 Results: 2 smartphones 88% throughput increase vs 1 phone Issues: Video packets travel/arrive out of order Incentives for forwarding nodes?

Ad Hoc Vs Infrastructure WiFi Mode Infrastructure mode: Mobile devices communicate through Access point Ad Hoc Mode: Mobile devices communicate directly to each other (no AP required) WiFi Direct is new standard to be used for ad hoc WiFi mode

References Head First Android Android Nerd Ranch, 2 nd edition Busy Coder s guide to Android version 6.3 CS 65/165 slides, Dartmouth College, Spring 2014 CS 371M slides, U of Texas Austin, Spring 2014