A (175)

(Tuis.) #1
CHAPTER 11: Digital Video: Streaming Video, MediaPlayer, and MediaController classes 419

Since most Android devices these days have displays which are using a medium (854x480) to high
(HD or 1280x720) resolution, if you are going to use the MPEG4 file format, you should utilize the
MPEG4 H.264 AVC format, which is currently the digital video format most often used in the world
today for Android and HTML5 apps.


The MPEG-4 H.264 AVC (Advanced Video Coding) digital video file format is supported across
all Android OS versions for video playback, and under Android 3.0 (and later versions) for video
recording. It is quite important to note that recording video is only supported if the Android device
hardware has video camera capabilities!


If you are a video content producer, you will find that the MPEG4 H.264 format has the best
compression result, especially if you are using one of the more advanced encoding suites, like the
Sorenson Squeeze Professional 9 software, which we will be using to optimize our 3D planet
fly-over video asset later on in this chapter.


File extension support for MPEG4 video files includes .3GP (MPEG4 SP which stands for “Standard
Play”) and .MP4 (MPEG4 H.264 AVC). I suggested using the latter (.MP4 AVC), as that is what I use
for HTML5 apps, and MP4 is more common to stream in an AVC format, but either type of file should
work just fine in an Android app.


A more recent digital video format that Android now supports is called the WebM (VP8) digital video
format. This format also provides great quality results with a small data footprint. This is the reason
why Google acquired ON2, the company that developed the VP8 codec. We’ll learn about codecs
later on in this chapter. WebM videoplayback was first natively supported in (and in versions
after) Android 2.3. The term native support is used with code(in this case, it’s a codec) which has
become “natively” a part of the operating system software, which means it is included with the rest
of the operating system (API) package.


WebM also supports something called video streaming, which we will also be learning about in
a later section of this chapter. This WebM video streaming playback capability is supported only
if your users have Android Version 4.0 and later. For this reason, I would recommend using WebM
for your “captive” video assets, as Android 2.3 through 4.4 supports non-streaming WebM codec
use. In case you are wondering, captive video is video that is not streamed, meaning video assets
are “captive” inside of the /res/raw folder. Use an MPEG4 H.264 AVC if you are only going to be
streaming video, as all of the Android versions, including Android 5, support that codec, both for
captive video playback as well as for streaming video playback.


Digital Video Compression: Bitrate and Streams


Let’s start out covering the primary resolutions used in commercial video. Before HDTV, or High
Definition TV, came along, video was usually called SD, or Standard Definition, and used a
standard vertical resolution of 480 pixels.


High Definition (or HD) video comes in two resolutions, 1280x720, which I call “Pseudo HD,” and the
higher resolution 1920x1080, which the industry calls “True HD.” Both use a 16:9 widescreen aspect
ratio, and are now used not only in film, television, and iTV sets, but also in smartphones (the Razor
HD is 1280 by 720) and tablets (the Kindle Fire HD is 1920 by 1200). This 1920x1200 resolution
is, by the way, a less wide, or taller, 16:10 pixel aspect ratio, and is becoming more common as a

Free download pdf