ReagentX / imessage-exporter

Export iMessage data + run iMessage Diagnostics
GNU General Public License v3.0
3.08k stars 135 forks source link

Videos exported in compatibility mode don't work in Firefox or Chromium on Linux #346

Closed presto8 closed 2 days ago

presto8 commented 2 months ago

In compatibility mode, any exported videos are saved as attachments in .MOV format. However, Firefox and Chromium do not recognize this, resulting in "No video with supported format and MIME type found." I used ffmpeg to transcode the MOV to MP4, and then added and it worked.

Maybe "-c compatible" should transcode .mov to .mp4 for maximum compatibility?

ReagentX commented 2 months ago

This is very reasonable.

presto8 commented 2 months ago

Thanks a lot! I should have added, I tested this on Linux, I am not sure if .MOV works on MacOS with those browsers.

ReagentX commented 2 months ago

Whether it does or not, compatible mode is meant to work on as many platforms as possible. Thanks for the report.

ReagentX commented 1 week ago

Solving this may also solve #371.

ReagentX commented 5 days ago

@presto8, if instead of re-encoding the video, you change the video type from quicktime to mp4 in the HTML, does the original .mov video play?

ReagentX commented 5 days ago

I think this is related to #73.

presto8 commented 5 days ago

@presto8, if instead of re-encoding the video, you change the video type from quicktime to mp4 in the HTML, does the original .mov video play?

I tried just now changing

<div class="attachment"><video controls> <source src="attachments/385/ee9591ec-41b1-4fa2-9012-c038798221f2.MOV" type="video/quicktime"> <source          >src="attachments/385/ee9591ec-41b1-4fa2-9012-c038798221f2.MOV"> </video></div>

to

<div class="attachment"><video controls> <source src="attachments/385/ee9591ec-41b1-4fa2-9012-c038798221f2.MOV" type="video/mp4"> <source          >src="attachments/385/ee9591ec-41b1-4fa2-9012-c038798221f2.MOV"> </video></div>

And it didn't work. Firefox on Linux still reports the same "No video with supported format or MIME type" error.

ReagentX commented 5 days ago

Thanks, appreciate it!

ldexterldesign commented 4 days ago

99% sure you'll have 1% chance of success with .mov in a browser

Screenshot 2024-11-21 at 11 21 48

Hope this helps!

ReagentX commented 4 days ago

Per https://en.wikipedia.org/wiki/HTML_audio#Supported_audio_coding_formats and https://en.wikipedia.org/wiki/HTML_video#Browser_support, mp3 (audio/mpeg) and mp4 (video/mp4) have the broadest compatibility.

One problem here is performance–iMessage lets you attach any type of file you want; it would be too cumbersome to attempt to transcode all of them for every single attachment. For now, only .mov (i.e., shared video files from the photos app) and .caf (audio messages) will be supported for automatic transcoding.

presto8 commented 3 days ago

I have a hunch that mp4 (container format) with h.264 main profile (video codec) and mp3 (audio codec) will be the most compatible. I don't have any data to back that up however, and I'm sure somebody will correct me if wrong :)

ReagentX commented 3 days ago

If either of you have the time to try out the feature branch (diff), let me know how it works for you!

If you run with -d, it should emit what software it finds in your environment:

Detected converters:
    Image converter: sips
    Audio converter: afconvert
    Video converter: ffmpeg
ReagentX commented 2 days ago

I added a HEICS → GIF (HEIC sequence) converter as part of this PR. Per ffmpeg, HEICS contains 4 streams:

  Metadata:
    major_brand     : msf1
    minor_version   : 0
    compatible_brands: mif1MiHBmsf1MiHEMiPrheichevciso8miafMiAn
    creation_time   : 2024-11-21T19:57:55.000000Z
  Duration: 00:00:01.57, start: 0.000000, bitrate: 1919 kb/s
  Stream #0:0[0x1]: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, smpte170m/unknown/unknown), 524x600, 1 fps, 1 tbr, 1 tbn (default)
  Stream #0:1[0x2]: Video: hevc (Rext) (hvc1 / 0x31637668), gray(pc), 524x600, 1 fps, 1 tbr, 1 tbn
  Stream #0:2[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, smpte170m/unknown/unknown), 524x600, 1370 kb/s, 22.98 fps, 30 tbr, 600 tbn (default)
      Metadata:
        creation_time   : 2024-11-21T19:57:55.000000Z
        handler_name    : Core Media Picture
        vendor_id       : [0][0][0][0]
  Stream #0:3[0x2](und): Video: hevc (Rext) (hvc1 / 0x31637668), gray(pc), 524x600, 426 kb/s, 22.98 fps, 30 tbr, 600 tbn (default)
      Metadata:
        creation_time   : 2024-11-21T19:57:55.000000Z
        handler_name    : Core Media Auxiliary Picture
        vendor_id       : [0][0][0][0]

In order:

1) The first stream is a single frame video without transparency 2) The second stream is a single frame the alpha mask as a grayscale image 3) The third stream is the animation data without transparency 4) the fourth stream is the animation's alpha mask as a grayscale image

To reassemble the HEICS streams in to a GIF, we take the 3rd and 4th streams, extract them as frames, combine the frames to build frames that are transparent, then reassemble those transparent frames into a GIF.

presto8 commented 2 days ago

If either of you have the time to try out the feature branch (diff), let me know how it works for you!

If you run with -d, it should emit what software it finds in your environment:

Sure, I'll try! I don't have many iMessages left though as I migrated to Android :) I'll report back if I'm able to test.

ldexterldesign commented 1 day ago

If either of you have the time to try out the feature branch (diff), let me know how it works for you!

Hmm, one of those links is dead now

Is this the correct branch to test?: if yes then please confirm and I'll try it

Cheers

PS even better if you're in the mind / confident enough to update brew so I don't have to mess around with git (bit rusty/lazy)! 🤞

ReagentX commented 1 day ago

Yes, it got merged; you can use the develop branch now. I've tested it and it seems to be working. I have it slated for release today.