AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection?

turn off camera sound iphone
camera sound off
iphone camera shutter sound won't turn off
avcapturephotosettings
silent camera app for japanese iphone
swift play system sound
ios audioservicesplayalertsound
ios system sounds

I am trying to capture an image during a live preview from the camera, by AVFoundation captureStillImageAsynchronouslyFromConnection. So far the program works as expected. However, how can I mute the shutter sound?

I used this code once to capture iOS default shutter sound (here is list of sound file names https://github.com/TUNER88/iOSSystemSoundsLibrary):

NSString *path = @"/System/Library/Audio/UISounds/photoShutter.caf";
NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSData *data = [NSData dataWithContentsOfFile:path];
[data writeToFile:[docs stringByAppendingPathComponent:@"photoShutter.caf"] atomically:YES];

Then I used third-party app to extract photoShutter.caf from Documents directory (DiskAid for Mac). Next step I opened photoShutter.caf in Audacity audio editor and applied inversion effect, it looks like this on high zoom:

Then I saved this sound as photoShutter2.caf and tried to play this sound right before captureStillImageAsynchronouslyFromConnection:

static SystemSoundID soundID = 0;
if (soundID == 0) {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"photoShutter2" ofType:@"caf"];
    NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
}
AudioServicesPlaySystemSound(soundID);

[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:
...

And this really works! I runs test several times, every time I hear no shutter sound :)

You can get already inverted sound, captured on iPhone 5S iOS 7.1.1 from this link: https://www.dropbox.com/s/1echsi6ivbb85bv/photoShutter2.caf

AVFoundation, how to turn off the shutter sound , AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? Posted by: admin November 25,  Questions: I am trying to capture an image during a live preview from the camera, by AVFoundation captureStillImageAsynchronouslyFromConnection. So far the program

AVFoundation, how to turn off the shutter sound when , I am trying to capture an image during a live preview from the camera, by AVFoundation captureStillImageAsynchronouslyFromConnection. In Japan for example you can't do that. There the shutter sound always plays even if you muted the phone. (Some weird rules to prevent privacy infringement, aka upskirt photography are in place in Japan as far as i know) So I don't think there is a way to do that.

Method 1: Not sure if this will work, but try playing a blank audio file right before you send the capture event.

To play a clip, add the Audio Toolbox framework, #include <AudioToolbox/AudioToolbox.h> and play the audio file like this immediately before you take the picture:

 NSString *path = [[NSBundle mainBundle] pathForResource:@"blank" ofType:@"wav"];
 SystemSoundID soundID;
 NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
 AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
 AudioServicesPlaySystemSound(soundID);

Here is a blank audio file if you need it. https://d1sz9tkli0lfjq.cloudfront.net/items/0Y3Z0A1j1H2r1c0z3n3t/blank.wav

________________________________________________________________________________________________________________________________________

Method 2: There's also an alternative if this doesn't work. As long as you don't need to have a good resolution, you can grab a frame from the video stream, thus avoiding the picture sound altogether.

________________________________________________________________________________________________________________________________________

Method 3: Another way to do this would be to take a "screenshot" of your application. Do it this way:

UIGraphicsBeginImageContext(self.window.bounds.size);
[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * data = UIImagePNGRepresentation(image);
[data writeToFile:@"foo.png" atomically:YES];

If you're wanting this to fill the whole screen with a preview of the video stream so that your screenshot looks good:

AVCaptureSession *captureSession = yourcapturesession;
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession];
UIView *aView = theViewYouWantTheLayerIn;
previewLayer.frame = aView.bounds; // Assume you want the preview layer to fill the view.
[aView.layer addSublayer:previewLayer];

How to turn off shutter sound while taking picture |Apple Developer , Now, I want to disable shutter sound while taking picture from captureStillImageAsynchronouslyFromConnection. Please give me ideas. You saved my butt :D If you want quality pictures w/ muted sound just play a blank sound right before taking the picture and for some reason it stop's Apple's shutter sound. If you want BURST photos, this is the only method I've seen for muting the sound.

I was able to get this to work by using this code in the snapStillImage function and it works perfectly for me on iOS 8.3 iPhone 5. I have also confirmed that Apple won't reject your app if you use this (they didn't reject mine)

MPVolumeView* volumeView = [[MPVolumeView alloc] init];
//find the volumeSlider
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
    if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
        volumeViewSlider = (UISlider*)view;
        break;
    }
}
// mute it here:
[volumeViewSlider setValue:0.0f animated:YES];
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];

Just remember to be nice and unmute it when your app returns!

Capture image via , There are a lot of questions about this problem on SO: AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? How to turn off the camera shutter sound on an Honor On newer Honor devices like Honor 20, you can change the settings within the camera app by tapping the gear icon, then turning the Mute option on.

I live in in Japan, so I can not mute the audio when we take photos for security reason. In video, however audio turns off. I don't understand why.

The only way I take a photo without shutter sound is using AVCaptureVideoDataOutput or AVCaptureMovieFileOutput. For analyze still image AVCaptureVideoDataOutput is only way. In AVFoundatation sample code,

AVCaptureVideoDataOutput *output = [[[AVCaptureVideoDataOutput alloc] init] autorelease];
// If you wish to cap the frame rate to a known value, such as 15 fps, set 
// minFrameDuration.
output.minFrameDuration = CMTimeMake(1, 15);

In my 3GS it is very heavy when I set CMTimeMake(1, 1); // One frame per second.

In WWDC 2010 Sample code, FindMyiCone, I found following code,

[output setAlwaysDiscardsLateVideoFrames:YES];

When this API is used, the timing is not granted, but API is called sequentially. I this it is best solutions.

How to mute a photo shutter sound. · GitHub, There is no way to remove the shutter sound, unless your user has put the that uses AVFoundation captureStillImageAsynchronouslyFromConnection to take  AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? (6)

Is it possible to load UIImagePickerController.Camera with attribute , AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? Created: 23-05-2014 21:34. Muting AVCapture shutter sound on iPhone . You have to use an AVCaptureVideoDataOutput if you want to avoid the shutter sound. Note that covertly capturing images is against App Store policy. You need to make sure you user is told in some way that your taking a picture.

AVFoundation, how to turn off the shutter sound when , I am trying to capture an image during a live preview from the camera, by AVFoundation captureStillImageAsynchronouslyFromConnection. So far the program  When Apple added Live Photos to the iPhone, the camera sound that played when a picture was taken disappeared by default, even with all the phone sounds on. This change proved beneficial because a Live Photo captures a few seconds of sound while recording a picture, and if the camera plays the shutter sound, that’s all you’d hear when viewing that Live Photo.

AVFoundation, how to turn off the shutter sound when , Iphone - AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? - Stack Overflow How to mute a photo shutter sound. GitHub Gist: instantly share code, notes, and snippets.

Comments
  • In Japan for example you can't do that. There the shutter sound always plays even if you muted the phone. (Some weird rules to prevent privacy infringement, aka upskirt photography are in place in Japan as far as i know) So I don't think there is a way to do that.
  • Yeah, it might be that your iPhone doesn't allow for muted camera shots. I'm in the US and my iPhone doesn't make a sound when I take a picture with the phone muted; my girlfriend's, on the other hand, does make a sound (hers is from Korea).
  • To be clear, this is a solution for when the phone is not muted / vibrate mode. In that mode, no sound is made when taking a picture.
  • @NewAlexandria I heard in Japan shutter sounds in vibration mode too. This is law requirement.
  • Btw AudioServicesPlaySystemSound will not play if device is muted. So Japanese devices will still make a sound when muted, but not when non-muted...
  • Very cool. Only caveat is that when flash is turned on, this will result in a double shutter sound because the default system sound is not played when captureStillImageAsynchronouslyFromConnection: is called, but rather when image is actually captured (during flash sequence). Instead add a key-value observer on self.stillImageOutput for keyPath 'capturingStillImage' to detect when capture truly starts, then play inverse sound in callback method.
  • This is how modern military aircraft defeat radar. This is why you don't see the "stealth shape" silhouette on new fighter designs: There is an electronics package that handles what is basically a radar-defeating phase shift that broadcasts an "inverted" (phase-shifted) duplicate signal.
  • @L0j1k: It depends on what kind of stealth ship you are talking about. The F22 an ilk aren't interested in being undetected but in being unlockable. Problem with phase shift technology is you are incredibly obvious from every other position, since they won't see the same shift.
  • This is how noise-cancelling headphones work, except they capture the sound in realtime
  • This was great for iOS7, but it no longer works on iOS8, any idea how to solve this on iOS8 ?