SlideShare a Scribd company logo
Multimedia on Android
Types of Multimedia Playback
Playback from File system - File formats, codecs
Streaming from network - Protocols, formats, codecs
Real time Conversational - Latency, Protocols, formats, codecs
Playback from File System
High level APIs
MediaPlayer
VideoView
No access to the decoded data - post processing (Audio mixing, Image
processing, cropping) etc
Low Level Media APIs - MediaCodec
Introduced in Android 4.1 (API Level 16)
Access to low level media codecs for encoding/decoding of media
Have access to compressed data as well as decompressed data
Compressed data can be used for recording
Decompressed data can be used for post processing
Need to understand codecs and file formats
Data Flow Java Application
Application Framework
Java Runtime
JNI
Native Libs
Kernel
Device Drivers
Hardware
Workflow
1. createEncoderByType()/createDecoderByType()
a. mime type "video/3gpp" or "audio/vorbis"
2. configure() - properties eg encryption
3. getInputBuffers() and getOutputBuffers() - get buffers
4. dequeueInputBuffer() - index position of buffer to fill
5. queueInputBuffer() - release buffer
4. dequeueOutputBuffer() - index position of buffer data
5. releaseOutputBuffer() - release buffer
Low Level Media APIs -
MediaExtractor
Android 4.2 - API Level 17
MediaExtractor facilitates extraction of
demuxed, typically encoded, media
data from a data source.
Low Level Media APIs - MediaMuxer
Android 4.3 - API Level 18
MediaMuxer facilitates muxing elementary streams.
Currently supports mp4 or webm file as the output
At most one audio and/or one video elementary stream.
MediaMuxer does not support muxing B-frames.
References
More details -
https://developer.android.com/about/versions/android-4.1.html#Multimedia
https://developer.android.com/about/versions/android-4.3.html#Multimedia
https://developer.android.com/reference/android/media/MediaCodec.html
https://developer.android.com/reference/android/media/MediaExtractor.html
https://developer.android.com/reference/android/media/MediaMuxer.html
Case Study
1080p 60 fps
250 ms Latency
Playback + Recording
Streaming
RTSP/RTCP/RTP
HTTP Live Streaming (HLS)
MPEG - Dynamic Adaptive Streaming over HTTP (DASH)
RTSP/RTCP/RTP
RTSP
- TCP
- connection setup and teardown
RTCP
- UDP
- Connection feedback
RTP
- UDP
- Compressed Audio/Visual Data
RTSP/RTCP/RTP
Low latency, suitable for realtime, conversational applications
As it uses UDP, data losses happen causing corrupted playback
Uses custom ports, blocked by firewalls
Custom servers required - Wowza, Real, Darwin
HLS
Implemented by Apple, non-standard, defacto standard
HTTP based, uses TCP, no losses, adaptive
Near realtime, not suitable for realtime/conversational applications
Suitable for Live broadcasts (one way), VoD
Uses manifest with links to the media segments, .m3u8 extension
Commodity HTTP infrastructure, caching, CDN (Scale)
Facebook live, Periscope etc
M3u8 File Structure
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000
gear1/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=311111
gear2/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=484444
gear3/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=737777
gear4/prog_index.m3u8
M3u8 File Structure
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXTINF:10,
130130211307_1.ts
#EXTINF:10,
130130211307_2.ts
EXT-X-DISCONTINUITY
#EXTINF:10,
130130211307_3.ts
#EXTINF:10,
130130211307_4.ts
#EXT-X-ENDLIST
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXTINF:10,
130130211307_1.ts
#EXTINF:10,
130130211307_2.ts
#EXTINF:10,
130130211307_3.ts
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:2
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXTINF:10,
130130211307_2.ts
#EXTINF:10,
130130211307_3.ts
#EXTINF:10,
130130211307_4.ts
MPEG - DASH
Similar to HLS, Adobe HDS, Microsoft Smooth Streaming but more flexible
International standard, XML based manifest with .mpd extension
Codec agnostic, HTML5 support
Supports multiple use cases like Ad insertion
More efficient than HLS
Used by Youtube, Netflix etc
Multimedia on android
Limitation of MediaPlayer
Support for RTSP/RTP/RTCP is good but support for HLS is flaky
Playback issues
No current playback time
No support for discontinuity
No support for ID3
Support across different versions inconsistent, new versions not necessarily better
No support for DASH, DRM etc
Exoplayer
The Android framework provides MediaPlayer as a quick solution for playing media with minimal code
MediaCodec and MediaExtractor classes are provided for building custom media players.
The open source project, ExoPlayer, is a solution between these two options, providing a pre-built player
that you can extend.
ExoPlayer supports features not currently provided by MediaPlayer, including Dynamic adaptive
streaming over HTTP (DASH), HLS, SmoothStreaming, DRM - Common Encryption, Widevine,
Playready.
It's designed to be easy to customize and extend, allowing many components to be replaced with custom
implementations.
ExoPlayer is a library that you include in your application, it can be easily updated along with your app.
https://developer.android.com/guide/topics/media/exoplayer.html
Thank you!
ramesh130@gmail.com

More Related Content

What's hot (20)

PDF
Android Internals
Opersys inc.
 
PDF
Android Multimedia Framework
Picker Weng
 
PPTX
Validation Controls in asp.net
Deep Patel
 
PPTX
Introduction to Android ppt
Taha Malampatti
 
PPTX
Strings in Java
Abhilash Nair
 
PPTX
Android activity lifecycle
Soham Patel
 
PDF
Android media framework overview
Jerrin George
 
PDF
Understanding the Android System Server
Opersys inc.
 
PPTX
Introduction to Android and Android Studio
Suyash Srijan
 
PPT
Object Oriented Programming Concepts using Java
Glenn Guden
 
PPTX
Understanding android security model
Pragati Rai
 
PPTX
Network intrusion detection system and analysis
Bikrant Gautam
 
PPT
Android Audio System
Yi-Hsiang Huang
 
PDF
Android IPC Mechanism
National Cheng Kung University
 
PDF
Embedded Android : System Development - Part IV
Emertxe Information Technologies Pvt Ltd
 
PPTX
Android Security
Arqum Ahmad
 
PPT
7) packaging and deployment
techbed
 
PDF
Android presentation
Siva Ramakrishna kv
 
PPTX
REST & RESTful Web Services
Halil Burak Cetinkaya
 
PDF
Embedded Android : System Development - Part I
Emertxe Information Technologies Pvt Ltd
 
Android Internals
Opersys inc.
 
Android Multimedia Framework
Picker Weng
 
Validation Controls in asp.net
Deep Patel
 
Introduction to Android ppt
Taha Malampatti
 
Strings in Java
Abhilash Nair
 
Android activity lifecycle
Soham Patel
 
Android media framework overview
Jerrin George
 
Understanding the Android System Server
Opersys inc.
 
Introduction to Android and Android Studio
Suyash Srijan
 
Object Oriented Programming Concepts using Java
Glenn Guden
 
Understanding android security model
Pragati Rai
 
Network intrusion detection system and analysis
Bikrant Gautam
 
Android Audio System
Yi-Hsiang Huang
 
Android IPC Mechanism
National Cheng Kung University
 
Embedded Android : System Development - Part IV
Emertxe Information Technologies Pvt Ltd
 
Android Security
Arqum Ahmad
 
7) packaging and deployment
techbed
 
Android presentation
Siva Ramakrishna kv
 
REST & RESTful Web Services
Halil Burak Cetinkaya
 
Embedded Android : System Development - Part I
Emertxe Information Technologies Pvt Ltd
 

Viewers also liked (18)

PDF
ExoPlayer for Application developers
Hassan Abid
 
PPT
Android Audio & OpenSL
Yoss Cohen
 
PDF
The unconventional devices for the Android video streaming
Matteo Bonifazi
 
PDF
Installing And Configuring Java Me Tools
Jussi Pohjolainen
 
DOCX
Android mediacodec
Taehwan kwon
 
PPTX
The android activity lifecycle
Eng Chrispinus Onyancha
 
PPTX
Android Life Cycle
mssaman
 
PDF
안드로이드 MediaPlayer & VideoView
Eunjoo Im
 
PDF
08 android multimedia_framework_overview
Arjun Reddy
 
PPT
Adaptive Development Methodology
Steve Greene
 
PPTX
Android Jam - Activity Lifecycle & Databases - Udacity Lesson 4a
Paul Blundell
 
PDF
Embedded Android Real-Time Streaming Optimization
VIA Embedded
 
PDF
Android Multimedia Support
Jussi Pohjolainen
 
PPTX
Android audio system(audioflinger)
fefe7270
 
PDF
Android: Intent, Intent Filter, Broadcast Receivers
CodeAndroid
 
PPT
Multimedia formats
Christian Macatangay
 
PPTX
Presentation on Android operating system
Salma Begum
 
PPT
Android ppt
blogger at indiandswad
 
ExoPlayer for Application developers
Hassan Abid
 
Android Audio & OpenSL
Yoss Cohen
 
The unconventional devices for the Android video streaming
Matteo Bonifazi
 
Installing And Configuring Java Me Tools
Jussi Pohjolainen
 
Android mediacodec
Taehwan kwon
 
The android activity lifecycle
Eng Chrispinus Onyancha
 
Android Life Cycle
mssaman
 
안드로이드 MediaPlayer & VideoView
Eunjoo Im
 
08 android multimedia_framework_overview
Arjun Reddy
 
Adaptive Development Methodology
Steve Greene
 
Android Jam - Activity Lifecycle & Databases - Udacity Lesson 4a
Paul Blundell
 
Embedded Android Real-Time Streaming Optimization
VIA Embedded
 
Android Multimedia Support
Jussi Pohjolainen
 
Android audio system(audioflinger)
fefe7270
 
Android: Intent, Intent Filter, Broadcast Receivers
CodeAndroid
 
Multimedia formats
Christian Macatangay
 
Presentation on Android operating system
Salma Begum
 
Ad

Similar to Multimedia on android (20)

PPTX
Media Source Extensions
FITC
 
PDF
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Chris Adamson
 
PDF
JAM316 - Native API Deep Dive: Multimedia Playback & Streaming
Dr. Ranbijay Kumar
 
PPTX
Multimedia Streaming Architecture
Olaf Reitmaier Veracierta
 
PPT
MPEG 4
tvutech
 
PDF
Multimedia Services: Video
Dani Gutiérrez Porset
 
PDF
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Máté Nádasdi
 
PDF
Serverless Media Workflow
MooYeol Lee
 
PPT
Android Media Player Development
Talentica Software
 
PPTX
Multimedia data compression challenge and their solution
shamsbhai495
 
PDF
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Chris Adamson
 
PPTX
2016 Streaming Media West: Transitioning from Flash to HTML5
Erica Beavers
 
PPTX
Streaming video to html
jeff tapper
 
PDF
whitepaper_mpeg-if_understanding_mpeg4
aniruddh Tyagi
 
PDF
whitepaper_mpeg-if_understanding_mpeg4
Aniruddh Tyagi
 
PDF
whitepaper_mpeg-if_understanding_mpeg4
aniruddh Tyagi
 
PDF
Mobile Smart Streaming
Tremend Software Consulting
 
PDF
The unconventional devices for the video streaming in Android
Alessandro Martellucci
 
PDF
20 Years of Streaming in 20 Minutes
Alpen-Adria-Universität
 
PDF
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
Derek Buitenhuis
 
Media Source Extensions
FITC
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Chris Adamson
 
JAM316 - Native API Deep Dive: Multimedia Playback & Streaming
Dr. Ranbijay Kumar
 
Multimedia Streaming Architecture
Olaf Reitmaier Veracierta
 
MPEG 4
tvutech
 
Multimedia Services: Video
Dani Gutiérrez Porset
 
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Máté Nádasdi
 
Serverless Media Workflow
MooYeol Lee
 
Android Media Player Development
Talentica Software
 
Multimedia data compression challenge and their solution
shamsbhai495
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Chris Adamson
 
2016 Streaming Media West: Transitioning from Flash to HTML5
Erica Beavers
 
Streaming video to html
jeff tapper
 
whitepaper_mpeg-if_understanding_mpeg4
aniruddh Tyagi
 
whitepaper_mpeg-if_understanding_mpeg4
Aniruddh Tyagi
 
whitepaper_mpeg-if_understanding_mpeg4
aniruddh Tyagi
 
Mobile Smart Streaming
Tremend Software Consulting
 
The unconventional devices for the video streaming in Android
Alessandro Martellucci
 
20 Years of Streaming in 20 Minutes
Alpen-Adria-Universität
 
A Progressive Approach to the Past: Ensuring Backwards Compatability Through ...
Derek Buitenhuis
 
Ad

More from Ramesh Prasad (6)

PPTX
Managing sales using CRM
Ramesh Prasad
 
PDF
Signal processing in smartphones - 4G perspective
Ramesh Prasad
 
PPTX
Advance Android Application Development
Ramesh Prasad
 
PPTX
Android Application Development
Ramesh Prasad
 
PPTX
Sdk For Firmware Development
Ramesh Prasad
 
PPTX
De Interlacing Techniques
Ramesh Prasad
 
Managing sales using CRM
Ramesh Prasad
 
Signal processing in smartphones - 4G perspective
Ramesh Prasad
 
Advance Android Application Development
Ramesh Prasad
 
Android Application Development
Ramesh Prasad
 
Sdk For Firmware Development
Ramesh Prasad
 
De Interlacing Techniques
Ramesh Prasad
 

Multimedia on android