<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PhotoKit",
  "identifier" : "/documentation/Photos/PHLivePhotoEditingContext",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Photos"
    ],
    "preciseIdentifier" : "c:objc(cs)PHLivePhotoEditingContext"
  },
  "title" : "PHLivePhotoEditingContext"
}
-->

# PHLivePhotoEditingContext

An editing session for modifying the photo, video, and audio content of a Live Photo.

```
class PHLivePhotoEditingContext
```

## Overview

A Live Photo is a picture, captured by a supported iOS device, that includes motion and sound from the moments just before and after it was taken. Editing the content of a Live Photo works much like editing other asset types:

1. In an app using the Photos framework, fetch a [`PHAsset`](/documentation/Photos/PHAsset) object that represents the Live Photo to edit, and use that object’s [`requestContentEditingInput(with:completionHandler:)`](/documentation/Photos/PHAsset/requestContentEditingInput(with:completionHandler:)) method to retrieve a [`PHContentEditingInput`](/documentation/Photos/PHContentEditingInput) object.

In a photo editing extension that runs within the Photos app, your extension’s main view controller (which adopts the [`PHContentEditingController`](/documentation/PhotosUI/PHContentEditingController) protocol) receives a [`PHContentEditingInput`](/documentation/Photos/PHContentEditingInput) object when the user chooses to edit a Live Photo with your extension.
2. Create a Live Photo editing context with the [`init(livePhotoEditingInput:)`](/documentation/Photos/PHLivePhotoEditingContext/init(livePhotoEditingInput:)) initializer.

You can create a Live Photo editing context only from [`PHContentEditingInput`](/documentation/Photos/PHContentEditingInput) object that represents a Live Photo. Use the [`livePhoto`](/documentation/Photos/PHContentEditingInput/livePhoto) property of the editing input to verify that it has live Photo content.
3. Use the [`frameProcessor`](/documentation/Photos/PHLivePhotoEditingContext/frameProcessor) property to define a block to be used in processing the Live Photo’s visual content. Photos will call this block repeatedly to process each frame of the Live Photo’s video and still photo content.
4. Create a [`PHContentEditingOutput`](/documentation/Photos/PHContentEditingOutput) object to store the results of your edit, then call the [`saveLivePhoto(to:options:completionHandler:)`](/documentation/Photos/PHLivePhotoEditingContext/saveLivePhoto(to:options:completionHandler:)) to process the Live Photo and save it to your editing output object. This method applies your [`frameProcessor`](/documentation/Photos/PHLivePhotoEditingContext/frameProcessor) to each frame.

> Note:
> You can also use the ``doc://com.apple.photokit/documentation/Photos/PHLivePhotoEditingContext/prepareLivePhotoForPlayback(withTargetSize:options:completionHandler:)`` method to process a preview-quality version of the Live Photo to display in your app’s UI during editing.

1. To allow a user to continue working with the edit later (for example, to adjust the parameters of a filter), create a [`PHAdjustmentData`](/documentation/Photos/PHAdjustmentData) object describing your changes, and store it in the [`adjustmentData`](/documentation/Photos/PHContentEditingOutput/adjustmentData) property of your editing output.
2. In an app using the Photos framework, use a photo library change block to commit the edit. (For details, see [`PHPhotoLibrary`](/documentation/Photos/PHPhotoLibrary).) In the block, create a [`PHAssetChangeRequest`](/documentation/Photos/PHAssetChangeRequest) object and set its [`contentEditingOutput`](/documentation/Photos/PHAssetChangeRequest/contentEditingOutput) property to the editing output that you created.

In a photo editing extension, provide the [`PHContentEditingOutput`](/documentation/Photos/PHContentEditingOutput) object that you created in your main view controller’s [`finishContentEditing(completionHandler:)`](/documentation/PhotosUI/PHContentEditingController/finishContentEditing(completionHandler:)) method.

When you use either of the methods listed in Processing an Editing Context’s Live Photo, Photos calls your [`frameProcessor`](/documentation/Photos/PHLivePhotoEditingContext/frameProcessor) block repeatedly to process each frame of the Live Photo’s video and still photo content. In that block, a [`PHLivePhotoFrame`](/documentation/Photos/PHLivePhotoFrame) object provides the Live Photo’s existing content as a <doc://com.apple.documentation/documentation/CoreImage/CIImage> object. You use Core Image to modify the image, then provide the result of your edits by returning a <doc://com.apple.documentation/documentation/CoreImage/CIImage> object representing the result of processing the input image.

> Tip:
> Core Image provides several ways to process the Live Photo’s visual content. You can use the built-in filters listed in [Core Image Filter Reference](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/uid/TP40004346) or create <doc://com.apple.documentation/documentation/CoreImage/CIFilter-swift.class> subclasses using custom graphics kernel code. Or, to use other image processing technologies, you can directly access and modify image content in pixel buffers, Metal textures, or `IOSurfaceRef` objects with a custom <doc://com.apple.documentation/documentation/CoreImage/CIImageProcessorKernel> subclass.

## Topics

### Creating a Live Photo Editing Context

[`init(livePhotoEditingInput:)`](/documentation/Photos/PHLivePhotoEditingContext/init(livePhotoEditingInput:))

Creates a Live Photo editing context for the specified editing input.

### Preparing an Editing Context for Processing

[`frameProcessor`](/documentation/Photos/PHLivePhotoEditingContext/frameProcessor)

A block to be called by Photos for processing each frame of the Live Photo’s visual content.

[`PHLivePhotoFrameProcessingBlock`](/documentation/Photos/PHLivePhotoFrameProcessingBlock)

The signature for a block Photos calls to process Live Photo frames.

[`audioVolume`](/documentation/Photos/PHLivePhotoEditingContext/audioVolume)

The audio gain to apply to the processed Live Photo.

### Processing an Editing Context’s Live Photo

[`saveLivePhoto(to:options:completionHandler:)`](/documentation/Photos/PHLivePhotoEditingContext/saveLivePhoto(to:options:completionHandler:))

Processes and saves a full-quality Live Photo as the output of your editing session.

[`prepareLivePhotoForPlayback(withTargetSize:options:completionHandler:)`](/documentation/Photos/PHLivePhotoEditingContext/prepareLivePhotoForPlayback(withTargetSize:options:completionHandler:))

Processes a Live Photo with your edits for viewing.

[`PHLivePhotoEditingOption`](/documentation/Photos/PHLivePhotoEditingOption)

Keys for the `options` dictionary used with the methods listed in Processing an Editing Context’s Live Photo.

[`cancel()`](/documentation/Photos/PHLivePhotoEditingContext/cancel())

Aborts any Live Photo processing in progress.

### Examining an Editing Context’s Live Photo

[`fullSizeImage`](/documentation/Photos/PHLivePhotoEditingContext/fullSizeImage)

The unedited still photo content of the Live Photo.

[`duration`](/documentation/Photos/PHLivePhotoEditingContext/duration)

The duration, in seconds, of the Live Photo.

[`photoTime`](/documentation/Photos/PHLivePhotoEditingContext/photoTime)

The offset, in seconds, from the beginning of the Live Photo’s duration to the time corresponding to its still photo.

[`orientation`](/documentation/Photos/PHLivePhotoEditingContext/orientation)

The image orientation of the Live Photo.

### Errors

[`PHLivePhotoEditingErrorDomain`](/documentation/Photos/PHLivePhotoEditingErrorDomain)

The domain value for error objects produced by a Live Photo editing context.

[`PHLivePhotoEditingErrorCode`](/documentation/Photos/PHLivePhotoEditingErrorCode)

Error codes for Live Photo editing errors.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)