How to: Android video encoding



Android Encoding, Transcoding Best Practices

*Width + Height are horizontal view

A/V Bit Rate Video Bit Rate Audio Bit Rate Width Height Type Key Frame Interval Frames Per Second
80 56 24 128 72 Base 48 23.98
150 102 48 128 72 Base 48 23.98
250 202 48 256 144 Base 48 23.98
400 352 48 256 144 Base 48 23.98
600 552 48 512 288 Base 48 23.98
800 736 48 512 288 Base 48 23.98
1000 936 64 512 288 Base 48 23.98
1300 1236 64 512 288 Base 48 23.98
1600 1536 64 512 288 Base 48 23.98
1900 1836 64 512 288 Base 48 23.98
2200 2136 64 512 288 Base 48 23.98
2500 2436 64 512 288 Base 48 23.98
1200 1136 64 768 432 Main 48 23.98
1600 1536 64 768 432 Main 48 23.98
1900 1836 64 768 432 Main 48 23.98




I’m going to do a quick overview of encoding / transcoding settings for Android devices. I wanted to try and compile best practices from multiple sources for gravlab’s reference with our automatic android HLS / HDS encoding and hosting. I’ll try to update this raw information with a more detailed step by step as time allows. Want to save yourself a lot of time and trouble? Don’t like the learning curve with HLS and HDS streaming? Let us encode and host your HLS and HDS video automatically for you!

Please visit our video encoding page here for iOS video encoding resources


Android H.264 Encoding Settings

  • Encoding / Coding Profiles: Baseline, Main
  • Encoding / Coding Levels: 1 through 3.2
  • Muxing Formats: F4V, MP4, MOV, 3GGP
  • Audio Encoding: AAC LC, HEAAC v1, HEAAC v2

Screen size / Screen Resolution (click for full size)


Android multibit rate encoding how to


Here’s some Android mobile video encoding / transcoding tips:


1. Use the aspect ratio of the original video. This always makes your life easier.


2. Keep the frame size in multiples of 16 to avoid unnecessary performance degradation or CPU consumption. If not possible, resort only to multiples of 8, not 4.


3. Keep the content in progressive output mode. Deinterlace whenever possible. Use Motion Compensated deinterlacing for best results. If not possible, use Motion Adaptive deinterlacing instead.


4. Use content that was deliberately shot for smaller screens for best user experience and fidelity. If not possible, scale with multi-tap filters (10 taps or more). The higher the tap the greater the sampling area (it is presumed that the filter is sophisticated enough to extract the necessary information to resample a better new image). High quality scaling filters utilize a higher sampling area from surrounding pixels (10 or more) and, thus, are able to derive higher quality output. Lower quality scaling filters (2-4 taps) create mediocre results, with images often being soft and blurry.


Lower filter results are OK for streaming on the larger screen sizes of computers and laptops, but will give you very poor picture quality on smaller screen sizes of mobile devices. Lower end filters are faster than higher end filters due their smaller sampling area. Use high quality scaling filters.


5. Use two pass encoding, or multi-pass encoding. Seriously. Typically a transcoder/encoder will use the first pass to index complex scenes and use the second pass for actual encoding. This process provides the best predictability for the encoder and improves your mobile video. Depending on the complexity of the video, the perceptual video quality results from single pass to two pass encoding can vary as much as 10–30 percent. That’s signficant because you’re dealing with lower bitrate resources with mobile video.


7. If the H.264 encoder supports “look_ahead” logic, use it.


8. Do not use content encoded at a larger frame size and then scale it down. Create separate versions at the frame sizes when you encode or transcode.


If higher frame size content is encoded and delivered, the mobile device will try to scale it down, burning more CPU resources — 40% in some cases. This slows performance, reduces battery life, and degrades mobile video playbook.


9. Do not use multiple slices mode in H.264. You should use 0 slices or 1 slice, or turn it off all together. If slices are in the video, the mobile video player will try to reproduce them while consuming unnecessary processor / RAM resources.
10. If your source is interlaced and it needs to be scaled, deinterlace first then scale second.


3 karma points