PetrVys / MotionPhoto2

Mux HEIC and JPG Live Photos into Google/Samsung Motion Photos
MIT License
29 stars 5 forks source link

Orientation (portrait or landscape) of Image and video are not aligned in resulted motion photo #5

Open 4Urban opened 3 days ago

4Urban commented 3 days ago

First, thank you for the great script. I've faced the same below problem with doodspav/motionphoto and MotionPhoto2.


While converting the live photo (from iPhone) to motion photo, I've got a trivial problem.

[Backgroud]

[Demo: Not Real Live Photo]

Sorry for the language Korean ("모션 포토 보기" means "View motion photo").

Files on File Explorer Files on File Explorer

Portrait Image Portrait Image

Landscape Video Landscape Video

[Question and Request]

PetrVys commented 2 days ago

Thanks for the link to the Samsung Gallery app, I haven't realized they have Windows version as well (I do not have any Samsung phone around, only Pixels).

The root cause is very obviously the Samsung Gallery app, as the motion video is not changed at all and retains all the Apple tags (including its portrait orientation). Apparently Samsung Gallery ignores the portrait orientation exif tag as written by iPhone. Can you please send me a portrait orientation Motion Photo from a Samsung phone, if possible? Ideally it should be possible to just copy the orientation tag into a Samsung-compatible one using ExifTool...

As far as compatibility of the resulting MotionPhoto with Samsung Gallery on Android - most likely the reason is that the video is in QuickTime MOV format and the android app cannot play back QT MOVs. If you first remux it into MP4 using ffmpeg, it may make it compatible even with the app. But it'll lose most of the metadata tags in the process...

I'll see if I manage to install Samsung Gallery on my android phones to test it - I only have quite ancient Pixels around :-).

PetrVys commented 2 days ago

Ok, installed Samsung Gallery on my PC and the results are weird...

At first, it worked completely fine on the merged photos (including the ones taken in portrait). After a while (and presumably some updates in background), it now plays only audio and video is completely missing. So the recommendation is to update HEVC media extensions, try to maybe use different ones, update GPU drivers etc.

I'll investigate the remux to pure MP4 next, that may definitely help...

4Urban commented 2 days ago

The root cause is very obviously the Samsung Gallery app, as the motion video is not changed at all and retains all the Apple tags (including its portrait orientation). Apparently Samsung Gallery ignores the portrait orientation exif tag as written by iPhone. Can you please send me a portrait orientation Motion Photo from a Samsung phone, if possible? Ideally it should be possible to just copy the orientation tag into a Samsung-compatible one using ExifTool...

You can get the portrait orientation Motion Photo shot by Samsung phone below. sample_samsung_motion_photo_portrait.zip (Though I checked it normally shows video in Samsung Gallery Windows app, I'm not sure that the uploaded & downloaded one can be viewed as well. If you have a problem, let me know.)

4Urban commented 2 days ago

At first, it worked completely fine on the merged photos (including the ones taken in portrait). After a while (and presumably some updates in background), it now plays only audio and video is completely missing. So the recommendation is to update HEVC media extensions, try to maybe use different ones, update GPU drivers etc.

It has been same for me. Just audio with the grey background. But, there's one tricky solution. Restarting the Samsung Gallery program entirely helps sometimes. When turning on the program again, merged Motion Photo with both video and audio normally plays (not including the portrait problem; still image shows portrait, video shows landscape). (But I don't know the exact reason.)

PetrVys commented 2 days ago

Thanks for the photo, I was able to download it.

I'm starting to give up on the Samsung Gallery app, though - the first time it saw your file, it refused to open it. After restart, it works. Sometimes it opens old JPG type motion photos, other time it does not.

But as far as HEIC style photos from iPhone, they now seem to just work. The difference was an update of "HEVC Video Extensions from Device Manufacturer" in MS Store. Everything works, and the portrait videos are correctly rotated according to EXIF flags. My computer is RyZen 5000 series notebook with iGPU, if it makes any difference.

The resolution of the iPhone HEVC pictures seems to be significantly lower than the native 12MPix, though (I'd say it's roughly 1/4th at 3MPix). The HDR gainmaps are unsurprisingly ignored. Also, thumbnails are not generated for iPhone pictures (both jpg and hevc), but your photo does get a thumbnail (that is, if it can be openned at all, depending on how the application feels).

Really hard to pinpoint the issue when the thing behaves completely differently every time I start it :-(.