Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different recording file sizes from different iPads

Tags:

avfoundation

I have two iPads, specifically: A1489 & A1566.

If I record a video of the ceiling for 1 minute, the A1489 results in a file size which is almost always half the size of the A1566.

The only different in the resulting videos seems to be that the A1566 has a higher data-rate and I don't understand why this is?

I am using ACFoundation with AVCaptureSessionPreset1280x720.

Can anyone shed any light on why there is this difference?

Additional Info: The Frame rate on both is 30 Frames per second.

Thanks

Chris

like image 912
Chris Avatar asked Aug 11 '15 12:08

Chris


People also ask

Is the iPad good for recording audio?

It's certainly possible to record ambient audio or vocals with the iPad's built-in microphone and to create loops and music without any external hardware, but it's nice to have the option to add microphones, keyboards, and other tools. Next you'll need some software to turn the iPad into a digital audio workstation.

Can you change iPad video recording resolution?

Use quick toggles to change video resolution and frame rate In Video mode, use quick toggles at the top of the screen to change the video resolution and frame rates available on your iPad. To display quick toggles, go to Settings > Camera > Record Video, then turn on Video Format Control.

What video format does iPad use?

The iPad natively supports many of the common video formats used today, including H. 264, MP4, M4V, MOV, MPEG-4 and M-JPEG. By default, these play in the iPad's Videos app.


2 Answers

Ipad A1489 is an Apple iPad mini 2 (Retina/2nd Gen) and A1566 is an Apple iPad Air 2.

Ipad mini 2 has a 5 megapixel "iSight" camera whereas Ipad Air 2 has an 8 megapixel "iSight" camera .

The iPad Air 2 has been treated to an 8MP iSight camera, which gives it 60% more pixels to work with compared to last year's iPad Air and its 5MP shooter. Read more.

It's the same iSight camera, principle applies for the transition from 5mp to 8mp.

Air2 does seem to be able to capture double the fps(120) than mini 2.

There are interesting answers for this question as to how does the video file size increase with fps.

But that is less important since you use 30fps at 1280x720 for both.

What is important is the bitrate.

Bit rates are directly reflective of the frame rate and resolution settings in the cameras. The filesize is determined by bitrate. (filesize is bitrate times length).

Using an AVCaptureSession object

You use the sessionPreset property to customize the quality level, bitrat for the output. Most common capture configurations are available through session presets; from the AvcCaptureSession docs

For possible values of sessionPreset, see Video Input Presets. The default value is AVCaptureSessionPresetHigh which

Specifies capture settings suitable for high quality video and audio output.

You used AVCaptureSessionPreset1280x720 which specifies capture settings suitable for 720p quality (1280x720 pixel) video output.

Their values vary per device.

But AVCaptureSession is just the object to coordinate the flow of data from an AV input device to an output.

Up until here you have uncompressed frames.

You use an AVCaptureVideoDataOutput object to process uncompressed frames from the video being captured. You typically configure several aspects of an output.

You mentioned 30fps so i assume you capped the frame rate by setting the minFrameDuration here. you can specify the pixel format using the videoSettings property. There are many properties that can be changed at this point or defaulted.

like image 102
Laurentiu L. Avatar answered Sep 21 '22 15:09

Laurentiu L.


Here are the results of my own testing using two samples captured with the default values (iPad Mini 2 FHD 30 fps and iPad Air 2 FHD 30 fps).

This is for Full HD but I expect similar results for HD.

  • iPad Mini 2 - A1489

    [Video]
    Codec: AVC
    Profile: [email protected]
    Options: CABAC / 1 ref. frame
    Frame Rate: 29.970
    Frame Rrate Mode: VFR (max. 30)
    Color Space: YUV 4:2:0 (8 bit)
    Scan Type: progressive
    Bitrate: 14.3 Mbps
    Bits-per-pixel: 0.231
    
    [Audio]
    Codec: AAC-LC
    Sample rate: 44100
    Channels: 1
    Bitrate Mode: CBR
    Bitrate: 64.0 Kbps
    
  • iPad Air 2 - A1566

    [Video]
    Codec: AVC
    Profile: [email protected]
    Options: CABAC / 1 ref. frame
    Frame Rate: 29.970
    Frame Rrate Mode: VFR (max. 30)
    Color Space: YUV 4:2:0 (8 bit)
    Scan Type: progressive
    Bitrate: 17.4 Mbps
    Bits-per-pixel: 0.280
    
    [Audio]
    Codec: AAC-LC
    Sample rate: 44100
    Channels: 1
    Bitrate Mode: CBR
    Bitrate: 64.0 Kbps
    

As you can see the only thing that differs is the bitrate with the iPad Air preferring higher values (17.4 Mbps vs 14.3 Mbps)

Why higher bitrates?

The move to 17 Mbps for Full HD was probably done in order to rival the most widespread AVCHD camcorders and they raised the HD one to keep the quality level constant. The move is supported by the device improved specs and possibly average expected carrier rates.

A higher bitrate allows for a better quality of the resulting video and is is important especially in the case of high-motion videos.

The bits-per-pixel value is an indicator of the expected quality vs. data rate. This metric varies based on the content of the video but as you can see in case of the two samples which are shot in the same place and are very similar it went from 0.231 to0.280 (greater is better). In theory, for H.264/AVC what goes over 0.200 can be tuned to save bandwidth without much quality loss.

Custom Recording (AVAssetWriter)

Session profiles will automatically set encoding options based on device version and you cannot control most of the parameters.

If you want to fine tune the encoding, the Apple documentation recommends using the AVAssetWriter class (source, see Recording).

You can also use a third-party library to encode the raw video but you most likely won't be taking advantage of the device hardware encoding capabilities.

like image 39
aergistal Avatar answered Sep 18 '22 15:09

aergistal