RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2.17k stars 100 forks source link

Unable to Export Edited Video/Photo #1077

Closed joeld1 closed 1 year ago

joeld1 commented 1 year ago

The video that I'm trying to export has a value for the hasadjustments attribute, unfortunately it doesn't export the edited video to the current directory.

exported = p.export(".", edited=True)

When run in a Jupyter notebook, it returns an empty list.

I am able to export it with the parameteruse_photos_export=True though.

RhetTbull commented 1 year ago

It sounds like the video's not in the local library. Do you have "optimize Mac storage" on? If so, Photos will decide to keep some items in iCloud only depending on available disk space. When you use use_photos_export Photos will download the file from iCloud if needed. What's the value of ismissing for this video.

joeld1 commented 1 year ago

Here are some properties in the photo. Also, let me double-check optimize Mac storage.

hidden': 0, 'favorite': 0, 'originalFilename': 'RPReplay_Final1684407728.mp4', 'filename': 'ABC727CE-380E-4AFD-B868-DCF4A1450C8B.mp4', 'directory': 'A', 'latitude': None, 'longitude': None, 'hasAdjustments': 1, 'cloudbatchpublishdate': None, 'shared': False, 'extendedDescription': None, 'localAvailability': 1, 'remoteAvailability': 1, 'isMissing': 0, 'adjustmentUuid': None, 'adjustmentFormatID': 'com.apple.photo', 'type': 1, 'UTI': 'public.mpeg-4', 'UTI_original': None, 'burstUUID': None, 'burstPickType': 0, 'burst': False, 'subtype': 103, 'live_photo': False, 'screenshot': False, 'slow_mo': False, 'time_lapse': False, 'customRenderedValue': 0, 'hdr': False, 'depth_state': 0, 'portrait': False, 'panorama': False, 'selfie': False, 'cloudAssetGUID': 'ABC727CE-380E-4AFD-B868-DCF4A1450C8B', 'cloudLocalState': 3, 'incloud': True, 'cloudLibraryState': None, 'cloudStatus': None, 'cloudAvailable': None, 'cloudMasterGUID': 'ARnK+nZgvr3MyeHQSpgoUaPdxSCD', 'reverse_geolocation': None, 'placeIDs': None, 'placeNames': None, 'countryCode': None, 'momentID': 5349, 'original_resource_choice': 0, 'raw_is_original': False, 'intrash': False, 'trasheddate_timestamp': None, 'trasheddate': None, 'height': 1440, 'width': 1920, 'orientation': 1, 'original_height': 1440, 'original_width': 1920, 'original_orientation': 1, 'original_filesize': 178139794, 'visibility_state': 0, 'visible': True, 'saved_asset_type': 3, 'isreference': False, 'added_date': datetime.datetime(2023, 5, 18, 7, 47, 45, 193358), 'pk': 41440, 'cloudownerhashedpersonid': None, 'import_session': None, 'fok_import_session': None, 'import_uuid': None, 'has_raw': False, 'raw_data_length': None, 'UTI_raw': None, 'datastore_subtype': None, 'resource_type': None, 'raw_master_uuid': None, 'non_raw_master_uuid': None, 'alt_master_uuid': None, 'raw_info': None, 'edit_resource_id_photo': None, 'edit_resource_id_video': None, 'UTI_edited_photo': None, 'UTI_edited_video': None,

Yes, Optimize Mac Storage is on

RhetTbull commented 1 year ago

What's p.path, p.path_edited?

joeld1 commented 1 year ago

p.path = '/Users/jd/Pictures/Photos Library.photoslibrary/originals/A/ABC727CE-380E-4AFD-B868-DCF4A1450C8B.mp4'

p.path_edited doesn't return anything

RhetTbull commented 1 year ago

p.path_edited doesn't return anything

That's the issue. Photos isn't caching a local copy of the edited video (due to optimize mac storage) so there's nothing to export. You'll need to use use_photos_export to force download from iCloud.

RhetTbull commented 1 year ago

This isn't really a bug as far as I can tell. With Optimize Mac Storage osxphotos can make no guarantees about the availability of any asset as that's handled by Photos.