This also helps explain why my iPhone storage always seems to be at its limits, despite my obsessive management.
Anyway, we all know foss unix ftw :P
It's been possible to create a clip from a video file that merely changes what parts of the video are displayed without effecting the data in the original since the Classic Mac OS days.
If you want to completely remove unwanted portions of a video to reduce the size without a loss of quality, there are many options. LosslessCut is a cross platform option that is both free and open source.
Yup, the Photos app keeps the unmodified original file, and then any edits/crops are stored separately. You can always revert to the original file and redo your edits. So they might be storing multiple copies of the same image, with and without edits.
Which API were you looking at for "file size"?
I was able to get the size data from Photos.app with the PhotoKit API [1]. I've only tested it with my library of ~26k items, but it was useful for getting an indicator of the biggest items. (Although I didn't think to check whether exporting a 1GB video caused my iCloud usage to drop by 1GB.)
Do you know more? The introduction says "Retrieve asset metadata or request full asset content.", but I can't find clarification when it actually accesses full content.
AFAICT, PHAsset is only metadata. When I'm downloading the full-sized images, I use PHImageManager.requestImage() and pass in the PHAsset I'm looking at [1][2]. I know there's something similar for video, but I've never used it.
You can control the behaviour by passing a PHImageRequestOptions instance. This includes an isNetworkAccessAllowed bool which controls where Photos.app will download the file from iCloud if not present locally, and it defaults to false.
[1]: https://developer.apple.com/documentation/photokit/loading_a...
[2]: https://developer.apple.com/documentation/photokit/phimagema...
[3]: https://developer.apple.com/documentation/photokit/phimagere...
After all, the file might not be present locally, so opening it should go through the Photos.app. But once you call AppleScript to open the file, you might as well use the AppleScript to comb through the database like the script I linked to earlier.
"since" -> "some". ugh. I had a bad swiping day apparently.
osxphotos query --min-size 100MB --add-to-album "Big Files"
Finds all photos, videos > 100MB and adds them to the album "Big files"
`osxphotos query --help` for more info or `osxphotos docs` to open docs in the browser.
Disclaimer: I'm the author.
Turns out that the API doesn't expose "file size", at least I didn't find a straight-forward way.
I think that all "photos" or "videos" are just a view of the underlying "photo or video object". If you crop a video, the full-size video will remain. Only if you export the video, it will be cropped and the smaller file size will manifest.
I guess that's why the file sizes differ.
[Edit: someone created an AppleScript to query file sizes - I didn't test it, yet: https://discussions.apple.com/docs/DOC-250000422 ]