Member-only story
How to make Live Photo and save it in photo library in iOS.
8 min readJun 17, 2018
A feature of iPhone 6s cameras that records three seconds of video (MOV) along with the still JPEG photo. When the picture is taken, the previous 1.5 seconds of the continuously recorded video are retained along with the subsequent 1.5 seconds.
As we understand. Apple saves JPEG as well as MOV in it’s media folder. So the JPEG file need to have some sort of information about relevant MOV file and vice versa.
Following are Items we require to create a live image.
Picture(JPEG)
Metadata:
{ “{MakerApple}” : { “17” : “<Identifier>” } }
Video(MOV)
- H.264 encoding
- YUV420P color coding
- Top level metadata (Metadata)
{ "com.apple.quicktime.content.identifier" : "<Identifier>" }
- Metadata Track
{ "MetadataIdentifier" : "mdta/com.apple.quicktime.still-image-time" , "MetadataDataType" : "com.apple.metadata.datatype.int8" }
- Metadata in the metadata track
{ "com.apple.quicktime.still-image-time" : 0 }
*pictures and videos <Identifier>
must be the same.
Adding metadata using code:
We need to add pictures and video with there corresponding metadata.