joemck / ExtractMotionPhotos

Extract Motion Photos created by Samsung phones to mp4 videos and plain jpg photos
MIT License
143 stars 20 forks source link

HEIC Support #4

Closed JM-Lemmi closed 2 years ago

JM-Lemmi commented 4 years ago

Hey, since the newer Galaxys now shoot in HEIC, it'd be a great addition to expand the extraction to HEIC files. I will gladly help with example files or things.

shayaknyc commented 4 years ago

Came here for this! Nearly all my photos are saved as heic files....unless I convert them from the Samsung Gallery app first......

guoyiang commented 3 years ago

Had a quick look at HEIC format and the same marker is used. A quick workaround is rename .heic to .jpg. This program was able to extract the video out (.mp4). However, the generated photo (photo.jpg) didn't work in my photo viewer, after rename back to .heic. Maybe heic format needs some special handling. So, before everything is sorted out, please keep the original .heic file for your photo. And to extract the video, simply rename the file to .jpg and use this program as usual.

joemck commented 3 years ago

Interesting. So Samsung separates the photo and video portions of an HEIC motion photo the same way they do with JPEG ones. I have no idea what I'm looking at in an HEIC file though or why they become unusable when the appended video data is removed.

daan944 commented 2 years ago

It does work on .heic files, and the exported image also works. But rename is necessary for the extractor to work. Also, I see .jpg is necessary and .jpeg is unsupported? Could be nice to fix that as well.

https://github.com/joemck/ExtractMotionPhotos/blob/master/main.c#L256

Sadly my C knowledge is read-only ;)

joemck commented 2 years ago

I've updated the filename extension processing, it should work with .heic and .jpeg now. My phone only produces normal .jpg motion photos, so I was only able to test by renaming a normal jpg to .heic, so I haven't tested it with an actual HEIC file -- please tell me if it works for you. Also, in case it works for you and not someone else, what phone produced your HEIC motion photo?

EDIT: I meant to mention, the fix is in the new release, 2.2.

daan944 commented 2 years ago

Thanks, this works perfectly! My photos are coming from a Samsung S10.

joemck commented 2 years ago

Is this solved? I'd previously been shown an HEIC file that didn't work anymore after the mp4 video data was removed.

guoyiang commented 2 years ago

I just tried with a recent photo I got from my phone (Samsung Galaxy S10+), it works great. Both photo and video works.

Thank you for writing and maintaining this tool!

JM-Lemmi commented 2 years ago

Yes, tried it with Release 2.2 and it works! Thanks!