I am using AVFoundation
to display a Video in my UIView
via an AVCaptureVideoPreviewOverlay
.
I then use AVStillImageOutput
's -
captureStillImageAsynchronouslyFromConnection:
to capture a still Image from the Video with the AVCaptureSessionPresetPhoto
preset.
I am freezing the video using AVCaptureSession
's -
stopRunning in the -
captureStillImageAsynchronouslyFromConnection completion block mentioned earlier. However, it's too late and the video has continued running while the still image is taken, so the freeze is a second or two later. When I display the image there is a jump.
How can I freeze the video at the exact moment the photo is taken?
Press ALT+PRINT SCREEN. Play the video and pause it at the point you want to take a still from it. Press PRINT SCREEN or ALT+PRINT SCREEN, depending on whether the video is playing full screen or in an active window.
Tap the Record button at the bottom to begin recording. When you need to pause, just tap the Pause button that has replaced the record button. Tap the Record button to pick back up where you left off. Once you've finished recording, tap the checkmark icon in the top right corner.
Almost a year later...Your approach is all wrong. Instead of trying to pause the video at the precise moment that the image is captured why don't you pause the video and then capture that paused image. To a user it makes no difference, to a developer you don't have to worry about exact precision.
To reiterate my idea, if you pause a video and flash white visual and play a click the user will think you have just captured that frame regardless if you are or not. Actually, you could consider pausing video the same as capturing an image without saving it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With