Saturday, June 13, 2015

iOS Video Quality

Resolution, framerate, and quality of video captured using iOS devices

This is a brief overview of my findings while working on a recent project at Hudl on the Ubersense app.

Which resolutions are available on an iOS device?

This depends on what model device you have, and whether you're talking about the front or back camera. Using Apple APIs, you can get a list of all the AVCaptureDeviceFormats for a camera -- here's a code snippet doing just that:
AVCaptureDevice *camera = ...;
for (AVCaptureDeviceFormat *format in [camera formats])
{
    CMVideoDimensions dims = CMVideoFormatDescriptionGetDimensions([format formatDescription]);
    CGFloat fps = 0;
    if ([format.videoSupportedFrameRateRanges count] > 0)
    {
        AVFrameRateRange *range = format.videoSupportedFrameRateRanges[0];
        fps = range.maxFrameRate;
    }
    NSString *title = [NSString stringWithFormat:@"%@ x %@ @ %@", @(dims.width), @(dims.height), @(fps)];
    NSLog(@"%@", title);
}
Let's see what's available on the iPhone6 back camera:
  • 192x144, 30 FPS
  • 352x288, 30 FPS
  • 480x360, 30 FPS
  • 640x480, 30 FPS
  • 960x540, 30 FPS
  • 1280x720, 30 FPS
  • 1280x720, 240 FPS
  • 1920x1080, 30 FPS
  • 1920x1080, 60 FPS
  • 2592x1936, 30 FPS
  • 3264x2448, 30 FPS
And the iPhone6 front camera:
  • 192x144, 60 FPS
  • 352x288, 60 FPS
  • 480x360, 60 FPS
  • 640x480, 60 FPS
  • 960x540, 60 FPS
  • 1280x720, 60 FPS
  • 1280x960, 60 FPS

Examples

What differences can you detect between these 5 different AVCaptureDeviceFormats?

I recorded 5 videos, each with a different AVCaptureDeviceFormat in Ubersense at 3.5x zoom. I then opened the videos in the Ubersense player, zoomed in again to 3.5x, and took a screenshot.

(Which formats I used are at the end of this post.)

Conclusions

On iOS devices, you can't use resolution as a proxy for quality. In other words, the naive assumption that the higher the resolution, the better the quality; and the lower the resolution, the worse the quality is false.

Quality depends on more than just resolution. It's a good idea to do some tests using real data.

Format used

The formats I used, in order, were:
  • 480x360, 30 FPS
  • 1280x720, 30 FPS
  • 1280x720, 240 FPS
  • 1920x1080, 30 FPS
  • 1920x1080, 60 FPS
The most obvious difference is that the 240 FPS format looks way worse than everything else; presumably a tradeoff of such a high frame rate. Otherwise, I find it difficult to choose between the various formats -- it's suprising to me that 1920x1080 isn't clearly superior to 640x480, given the gigantic difference in resolution.

What do you think?