I wrote the camera on the iPhone. It UIImagePickerController out that the main class that is used there UIImagePickerController - gives a link to the native recorder. That is, taking a photo \ video is done using a native application that opens on top of mine.
I need to write such a camera so that I can get and change:

  • Original frame rate
  • Resolution

What classes, methods, libraries and frameworks should be used to solve this problem?

  • your UIImagePickerController has a videoQuality property videoQuality it sets the resolution. As for the frame rate, it is unlikely that you can change it when recording, I would suggest watching the editing classes of an already recorded video. - Max Mikheyenko 1:56 pm
  • The frame rate can somehow be changed. I have already met ios applications in which the frequency varies. - Andrew Kachalin
  • I am sure that all this can be done with AVFoundation. but I doubt very much that UIImagePickerController will help you in terms of changing the frame rate - Max Mikheyenko

1 answer 1

The UIImagePickerController class is the easiest and non-functional way to access the camera. The framework that allows you to change the characteristics of the resulting video - AVFoundation . You also need to use the CoreMedia framework.

In particular, the CMTimeShow method is responsible for the frame rate. Approximately in this way you can get the frame rate:

 CMTimeShow(CaptureConnection.videoMinFrameDuration); //минимальная ΡΠΊΠΎΡ€ΠΎΡΡ‚ΡŒ ΠΊΠ°Π΄Ρ€ΠΎΠ² Π² сСкунду. 

Or so

 CMTimeShow(CaptureConnection.videoMaxFrameDuration); //максимальная ΡΠΊΠΎΡ€ΠΎΡΡ‚ΡŒ ΠΊΠ°Π΄Ρ€ΠΎΠ² Π² сСкунду. 

In embodiments of the method, you can specify in more detail the frame rate.

For permission, the sessionPreset method sessionPreset . So you can implement changing the resolution settings:

 [CaptureSession setSessionPreset:AVCaptureSessionPresetLow]; //ΡƒΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ Π½ΠΈΠ·ΠΊΠΎΠ΅ Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΠ΅. 

Or so

 [CaptureSession setSessionPreset:AVCaptureSessionPresetHigh]; //ΡƒΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ высокоС Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΠ΅ 

A good working code, with comments in English on the issue of changing the resolution and frame rate is given here.