"In a world where mobile content is becoming more prevalent by the day, how can we enhance the experience of gathering images, audio and video for consumption on mobile devices?
Brian will demonstrate how you can leverage the Wireless Universal Resource File (WURFL), PHP, ImageMagick, ffmpeg, and other open source tools to optimize content for consumption on mobile devices."
9. Who is Schematic?
Full-service interactive agency
Offices in Atlanta; New York; LA; San Francisco;
Austin, TX; Minneapolis, MN; San Jose, Costa Rica
3
10. Who is Schematic?
Full-service interactive agency
Offices in Atlanta; New York; LA; San Francisco;
Austin, TX; Minneapolis, MN; San Jose, Costa Rica
Some clients include...
Dell
Target
Disney 3
Nokia
Comcast
MTV
12. What are we talking about?
PC and mobile development are very different
4
13. What are we talking about?
PC and mobile development are very different
Identifying devices with WURFL
4
14. What are we talking about?
PC and mobile development are very different
Identifying devices with WURFL
Generating content for mobile consumption
Images, video, audio
PHP, open source tools
4
52. Gotchas
wurfl.xml is ~8 MB in size!
Not a great idea to parse it from front end
13
53. Gotchas
wurfl.xml is ~8 MB in size!
Not a great idea to parse it from front end
Extract data you need, place in database
Youʼll need a plan for updating from your source data
13
56. Use what you need
Display sizes
Relevant video, audio formats supported
14
57. Use what you need
Display sizes
Relevant video, audio formats supported
MIDP, CLDC versions supported
Handy in determining compatibility for applications
14
58. Use what you need
Display sizes
Relevant video, audio formats supported
MIDP, CLDC versions supported
Handy in determining compatibility for applications
Bitmasks values are handy
14
59. Applying bitmask and DB
<?php
define(‘VIDEO_MP4’, 1);
define(‘VIDEO_3GP’, 2);
define(‘VIDEO_WMV’, 4);
// $videoFormats = 7;
$videoFormats =
VIDEO_MP4 | VIDEO_3GP | VIDEO_WMV; 15
?>
id | manuf | model | video_formats
----------------------------------
1 | Nokia | N95 | 7
62. Using it from PHP
Itʼs just XML!
SimpleXML, DOM, etc.
16
63. Using it from PHP
Itʼs just XML!
SimpleXML, DOM, etc.
Caching your lookups
Memcached
SQLite, other DBs
16
64. Using it from PHP
Itʼs just XML!
SimpleXML, DOM, etc.
Caching your lookups
Memcached
SQLite, other DBs
Lookup by user agent
16
$_SERVER[‘HTTP_USER_AGENT’]
Opera: X-OperaMini-Phone-UA
66. Summary and other options
Use WURFL responsibly and efficiently!
PHP scripts on its website
Employ some caching techniques
17
67. Summary and other options
Use WURFL responsibly and efficiently!
PHP scripts on its website
Employ some caching techniques
WURFL and other options are key to a great mobile
experience
DeviceAtlas
17
71. Some challenges
Varying amounts of bandwidth available
Costly data plans
Unlimited vs. per-MB/GB
19
72. Some challenges
Varying amounts of bandwidth available
Costly data plans
Unlimited vs. per-MB/GB
Different capabilities across devices
19
73. Some challenges
Varying amounts of bandwidth available
Costly data plans
Unlimited vs. per-MB/GB
Different capabilities across devices
Limited memory in devices
19
75. How to workaround them
Serve content tailored to userʼs device
Efficient use of resources and bandwidth
Determine if a given piece of content will work on the device
before download
20
76. How to workaround them
Serve content tailored to userʼs device
Efficient use of resources and bandwidth
Determine if a given piece of content will work on the device
before download
Hope for the best!
User will sort it out
It will work or it wonʼt
20
78. To be fair...
None of this may be relevant in a few years
21
79. To be fair...
None of this may be relevant in a few years
Mobile browsers and devices are evolving
21
80. To be fair...
None of this may be relevant in a few years
Mobile browsers and devices are evolving
Low-end devices are prevalent in many parts of the world
Who is your audience, and where are they located?
21
84. My Personal Approach
I pre-generate files and write them to disk
I can rely on them being in place when making decision
23
85. My Personal Approach
I pre-generate files and write them to disk
I can rely on them being in place when making decision
Images:
foo_240x320.jpg
foo_320x240.jpg
23
86. My Personal Approach
I pre-generate files and write them to disk
I can rely on them being in place when making decision
Images:
foo_240x320.jpg
foo_320x240.jpg
Video: 23
foo_176x144.3gp
foo_176x144.mp4
87. My Personal Approach
I pre-generate files and write them to disk
I can rely on them being in place when making decision
Images:
foo_240x320.jpg
foo_320x240.jpg
Video: 23
foo_176x144.3gp
foo_176x144.mp4
Audio:
foo.aac
106. Gotchas
Generating images on-demand is expensive
Keep it cheap and/or infrequent
Write the different sizes to disk; routine cleanup
Memcached
Pre-generate them
29
108. Summary
Serving image tailored for device
Uses least amount of bandwidth possible
Uses device resources efficiently
30
109. Summary
Serving image tailored for device
Uses least amount of bandwidth possible
Uses device resources efficiently
Be smart with the server-side implementation!
30
110. Summary
Serving image tailored for device
Uses least amount of bandwidth possible
Uses device resources efficiently
Be smart with the server-side implementation!
Less complex than dealing with video, audio
30
129. Optimizing for mobile
Lower resolution
176x144, 320x240
Reduce video framerate
Playback looks jerky
But it requires less bandwidth!
35
130. Optimizing for mobile
Lower resolution
176x144, 320x240
Reduce video framerate
Playback looks jerky
But it requires less bandwidth!
Reduce bitrates
35
138. Expense
Generating videos is not cheap
Should not be done in real time
End user will have to wait for it!
37
139. Expense
Generating videos is not cheap
Should not be done in real time
End user will have to wait for it!
Pre-generate with an offline process
Store them on disk
Purge when and if needed
37
140. Expense
Generating videos is not cheap
Should not be done in real time
End user will have to wait for it!
Pre-generate with an offline process
Store them on disk
Purge when and if needed
37
Weʼll look at FFmpeg shortly!
158. Expense
Again, generating audio isnʼt cheap
Shouldnʼt transcode in real time
Pre-generate in an offline process
42
159. Expense
Again, generating audio isnʼt cheap
Shouldnʼt transcode in real time
Pre-generate in an offline process
42
160. Expense
Again, generating audio isnʼt cheap
Shouldnʼt transcode in real time
Pre-generate in an offline process
What can we use?
Surprise! FFmpeg! 42
164. Basics
Decodes and encodes audio and video streams
Many A/V formats supported
44
165. Basics
Decodes and encodes audio and video streams
Many A/V formats supported
Supports use of external libraries to handle additional
formats
44
166. Basics
Decodes and encodes audio and video streams
Many A/V formats supported
Supports use of external libraries to handle additional
formats
Runs on many platforms (Windows, OS X, Linux)
44
168. Usage
ffmpeg [[infile options] -i infile]...
{[outfile options] outfile}...
45
ffmpeg -h: 504 lines!
Extensive amount of options for both audio and
video
169. Usage
ffmpeg [[infile options] -i infile]...
{[outfile options] outfile}...
45
ffmpeg -h: 504 lines!
Extensive amount of options for both audio and
video
200. FFmpeg Summary
Powerful tool!
Takes a lot to master it
Probably makes more sense to A/V experts
54
201. FFmpeg Summary
Powerful tool!
Takes a lot to master it
Probably makes more sense to A/V experts
But itʼs easy enough to get the job done right
54
202. FFmpeg Summary
Powerful tool!
Takes a lot to master it
Probably makes more sense to A/V experts
But itʼs easy enough to get the job done right
Its manpage is your friend!
54
205. Mobile is tricky!
All of those combinations
Devices
Providers
Bandwidth / data plans
Capabilities
56
206. Mobile is tricky!
All of those combinations
Devices
Providers
Bandwidth / data plans
Capabilities
Use resources efficiently
56
207. Mobile is tricky!
All of those combinations
Devices
Providers
Bandwidth / data plans
Capabilities
Use resources efficiently
Optimize the experience for the end user 56
212. We’re Hiring!
It goes without saying: Schematic is only as good
as the people who work here. That’s why we’re so
particular about recruiting, training, nurturing, and
retaining the very best people in our field.
If you have digital expertise (technical, creative, managerial–or
something else entirely), enthusiasm, curiosity, and the 58
ability to collaborate with others, we’d love to hear from you.
For more information, please see me or visit
http://www.schematic.com/#/JoinUs/