“Access to the hardware accelerated encoders on Snapdragon-based devices has definitely provided an improvement in video quality which our users appreciate.”
– Jonas Vig, CEO and VP Products, Bambuser AB
- Direct access to video processing core on Snapdragon for live, mobile video encoding
- Streaming video at up to 800x480 pixels
- 4-5x lower CPU utilization compared to software encoding
- Strong competitive edge among Android video apps
- High-quality, real-time video in use by journalists and emergency crews worldwide
Does the success of your mobile app hinge on video? Bambuser’s does. Its users rely on it to broadcast live video to the Web, where their audiences can watch personal stories, sports, entertainment and breaking news unfold in real time. Bambuser’s engineers have made the app as simple as possible so that mobile users can stream high-quality (up to 800x480), live video to their editors, blogs, websites, and social networks.
Beneath the simple UI, however, lies the technically difficult problem of efficiently encoding the camera feed. Some mobile phones handle encoding by running a software codec (in Bambuser’s case, the open source encoder, libavcodec) on the CPU, which limits the quality and resolution of the video that users share. And, even at low resolution, software running on the CPU corresponds to increased drain on the battery and decreased capacity for other mobile apps and voice calls.
Bambuser developers had implemented hardware encoding on select Snapdragon-powered devices when they discovered Qualcomm’s Video Codec Sample application. “The sample code confirmed our own approach,” notes Bambuser CEO Jonas Vig, “and showed us that some Snapdragon-powered devices use modified IOMX headers, which we wouldn't have figured out on our own. This opened the market opportunity for us to enable hardware acceleration on these devices too.”
IOMX and hardware free up the CPU
Qualcomm’s Video Codec Sample code is a use case of the IOMX API that shows how to call into the video processing core, a single-purpose engine that resides in the multimedia subsystem of the Snapdragon mobile processor. IOMX is an abstraction layer to OpenMax IL, provided through the Stagefright Media Framework in Android OS versions 2.2 through 4.0. The sample code lets developers feed a stream directly to the hardware encoder/decoder on certain Snapdragon-based devices.
Bambuser’s engineers based their implementation on the portion of the code that captures video from the camera and encodes/compresses it in hardware; the sample also includes classes for decoding/decompressing a stream in hardware and handing it off to the player in a mobile device.
To handle 640x480 resolution on a single-core CPU, Bambuser’s software encoder without hardware acceleration uses almost 100% of the CPU and attains only 15 fps. That leaves little capacity for critical tasks such as camera management, audio capture and network traffic. With hardware acceleration, the app can handle that same resolution at a full 30 fps, using a modest 20% of the CPU. In another documented set of tests, streaming live VGA video over Bambuser with a non-Snapdragon-based device consumed about 80% of CPU capacity, while streaming with a Snapdragon-based device consumed less than 15% of CPU capacity – about five times less.
When a video-based app can offload the heavy lifting of encoding from the CPU to dedicated hardware, it frees the CPU up for other tasks and opens the door to even more novel multimedia applications. Hardware acceleration allows professionals such as journalists to dispatch live, high-quality video reports from their mobile phones.
“Once we had general IOMX encoding working,” concludes Vig, “integrating it in our application was a matter of hours. There are no suitable APIs for this in the basic Android platform, but investing time in making hardware acceleration work on specific devices can absolutely pay off.”
What are you waiting for? Download the Video Codec Sample application and study the files to see how you too can integrate a video-based Android app with the hardware codecs in Snapdragon. We update the sample code occasionally as new devices go commercial and as new releases of Android appear. The package includes a test suite for the codecs and sample code for modifying your own video applications.