Alternative to AVFoundation captureStillImageAsynchronouslyFromConnection - ios

I created an app that uses AVFoundation captureStillImageAsynchronouslyFromConnection to take a picture every 0.2 seconds and analyse the picture. However, I didn't realize that it made the shutter sound every time it took a picture until I had already built the app.
Question: Is there a good alternative to AVFoundation captureStillImageAsynchronouslyFromConnection that doesn't make a shutter sound or is there a legit way to turn the sound off?

Alternative solution to take photo would be AVCapturePhotoCaptureDelegate method capturePhoto(with:delegate:). Check out the documentation for AVCapturePhotoOutput.
But as i can see from your question, you want to mute the shutter speed when taking photos. As per apple documentation API, there is no way you can mute the shutter sound when taking photo. Until unless user turn off the mute hardware button.
As a workaround you can start analysing the camera frame of a continuous video by using AVCaptureVideoDataOutputSampleBufferDelegate. Here is the detailed documentation from apple for How to capture video frames from the camera as images using AV Foundation on iOS. With this method you can still get the images and avoid shutter sound as well.

Related

Recording locations in time domain with AVFoundation

I followed a lot of tutorials and every tutorials about recording in AVFoundation covers only recording Video or Audio or both of this things.
I would like to record some location in the same time domain like Video/Audio on separate track. This location waypoints is described with 5 properties only - latitude, longitude, altitude, startTime, duration and it'll be changing no often that 5 seconds of the recording. This recording is for presentation purposes and I need functionality such as streaming, play forward, skipping, pause.
Anybody have some idea how to do it with AVFoundation framework?
Sure, this is possible.
AVFoundation is a collection of higher and lower level libraries with lots of options to tap into the processing pipeline at various stages. Assuming you want to capture from the Camera, then you're going to be using some combination of AVCaptureSession, its delegate https://developer.apple.com/reference/avfoundation/avcapturevideodataoutputsamplebufferdelegate and an AVAssetWriter.
The AVCaptureVideoDataOutputSampleBufferDelegate is capturing vended CMSampleBuffers (which combine a frame of video data with timing information), at the point you receive it, you typically just "write out" the CMSampleBuffer to record the video, but you can also further process it to filter it in realtime or, as you want to do, record additional information with timing data (e.g. at this point in the video, I had these coordinates).
Research how to write video from the camera on iOS to get started and using the Delegate, you'll soon see where to hook into the code to achieve what you're after.

Removing low frequency (hiss) noise from video in iOS

I am recording videos and playing them back using AVFoundation. Everything is perfect except the hissing which is there in the whole video. You can hear this hissing in every video captured from any iPad. Even videos captured from Apple's inbuilt camera app has it.
To hear it clearly, you can record a video in a place as quiet as possible without speaking anything. It can be very easily detected through headphones and keeping volume to maximum.
After researching, I found out that this hissing is made by preamplifier of the device and cannot be avoided while recording.
Only possible solution is to remove it during post processing of audio. Low frequency noise can be removed by implementing low pass filter and noise gates. There are applications and software like Adobe Audition which can perform this operation. This video shows how it is achieved using Adobe Audition.
I have searched Apple docs and found nothing which can achieve this directly. So I want to know if there exists any library, api or open source project which can perform this operation. If not, then how can I start going in right direction because it does looks like a complex task.

Play the same sound when start/stop recording video with AVCaptureMovieFileOutput that is heard in device's camera app?

I am creating a camera app that uses AVFoundation.
When I take a picture with my AVCaptureStillImageOutput object, it makes the same "shutter" noise that the default camera makes without me needing to tell the AVCaptureStillImageOutput to do so, which is great.
What I am wondering is if it is possible to get AVCaptureMovieFileOutput make the same "ding" noise that is heard when the user starts/stops recording video through the camera app?
If not, I guess I will need to have my own noise in the app's bundle and play it when the user starts/stops recording...
Thanks in advance!
Yes, you can:
AudioServicesPlaySystemSound(1117); // Video start sound
AudioServicesPlaySystemSound(1118); // Video stop sound
A full list of available system sound codes is here: http://iphonedevwiki.net/index.php/AudioServices

UIImage from AVCaptureSession

What I'm trying to achieve is grabbing a still frame from a AVCaptureSession for something like a QR Code scanner. I have a view with a AVCaptureVideoPreviewLayer sublayer.
I already tried using AVCaptureStillImageOutput, which worked, but that function makes the shutter sound. Since there's no way to mute that I can't use it. After that I tried to make a screenshot of the entire screen, which also failed, because it can't capture a AVCaptureVideoPreviewLayer. Now I'm kinda lost, the only real way to do this would be to feed a video feed into my OCR library but that would lag to much/be a lot of work.
Are there any other options?
Here's a tech note describing exactly what you want to achieve:
How to capture video frames from the camera as images using AV Foundation on iOS

Change iPhone Camera Shutter Sound in App

How can I change the sound that plays when an image is captured with an iPhone? I am using AVCapture and I want to capture still images (rather than grabbing frames from video) for image quality sake.
Thanks in advance!
After researching it appears that the standard camera shutter sound is next to impossible to change via SDK.
This answer supports that. You can replace your own sound, but not in an app.
As for AVCapture, it also appears that you can't change the shutter sound as capturing images covertly is against the App Store policy. See this answer.
The only way to take a silent picture is to use a video screen grab, which you said you don't want to do for image quality reasons.
So AFAIK, there is no way to change the shutter sound not using video screen grabs.

Resources