Motion and Live Photos

Apple’s Live Photos and Android equivalent, Motion Photos, initially seemed a bit like a gimmick when they were announced. However, there are a number of times now where the Live Photos on the iPhone has been of good use - mainly to capture amusing antics before or after the photo occurred!

With playing with Android, I was surprised that this didn’t appear to have the same. However, after some googling, I discovered it does, and it’s called Motion Photos.

However, there are some major differences between the tow, being:

  • Motion photos don’t record sound and are silent.
  • The motion part is a lower resolution than the main photo.

Both of these make them a bit less useful than the live photo counterparts.

One of the other issues I came across is that whilst I can upload my live photos using the excellent Photosync and this splits the live section off in to a separate movie file that I can view elsewhere, but this doesn’t work on Motion Photos. Searching online suggests that this is because the movie is encoded in to the image on the Motion Photo, after the end of image signature.

I did find a way to split the two in to separate files though, using a PHP script I found on Android Stackexchange. The following script is able to split the original JPG with motion photo in to a single photo and separate MP4 video file. It keeps the original photo in place and splits the video file and image in to two separate new files.

<?php

  $src_arg = $argv[1];
  $src_dir = realpath(pathinfo($src_arg, PATHINFO_DIRNAME)); 

  echo "Scanning for files...\n";

  foreach (glob($src_arg) as $src) {

    $file = realpath($src);

    if (!is_dir($file) && in_array(strtoupper(pathinfo($file, PATHINFO_EXTENSION)), ["JPEG", "JPG"])) {

      echo "\tProcessing: " . $file . "\n";

      $filesize = filesize($file);
      echo "\t\tFile size: " . $filesize . "\n";

      $handle = fopen($file, "rb");
      $data = fread($handle, $filesize);
      fclose($handle);

      $eoi_pos = strpos($data, "\xFF\xD9\x00\x00\x00\x18");
      echo "\t\tEOI segment position: " . $eoi_pos . "\n";

      if ($eoi_pos !== FALSE) {
        $output_base = $src_dir . DIRECTORY_SEPARATOR . pathinfo($file, PATHINFO_FILENAME);
        echo "\t\tSaving photo...\n";
        file_put_contents($output_base . "_photo.jpg", substr($data, 0, $eoi_pos + 2));
        echo "\t\tSaving video...\n";
        file_put_contents($output_base . "_video.mp4", substr($data, $eoi_pos + 2));
      } else {
        echo "\t\tSKIPPING - File does not appear to be a Google motion photo.\n";
      }

    }

  }

  echo "Done.\n";

?>

Example

To demonstrate, this can be seen on the following photo of my NAS. I took this photo with Motion Photo turned on1.

Viewing the file on Windows shows a 6.74MB file.

Running this image through the PHP script gives the following output, showing that the file has been split in to a video and photo file.

Reopening the explorer folder, we now have the original photo, the new reduced in size photo (as the video has been removed) and the video file. The new photo file shows that this is now 2.52MB, a reduction of 4.22MB. It appears that this is a lossless operation, which makes sense as the video is located after the end of the JPG data2.

This turns out to be the size of the video file that is created3. In addition, we can see that the video file is a 1024 x 768 video file, compared to the 3024 x 4032 resolution of the original photo.

A video of the photo can be seen here on Youtube, which shows the access lights flashing - not very exciting, but serves a demonstration purpose. The video file can then be viewed in your video player of choice.

Conclusion

Overall, I’m less impressed with Motion Photos than I am with Live Photos. The fact that Live photos are the full resolution but also include sound make things a lot better. In addition, they seem better supported and at least Photosync splits these apart, so nothing further has to be done. Having to split the files apart with a PHP script is fine, but a bit of a hassle.

It also seems like that on Windows there is no easy way to view the motion photos - using Google Photos online works, but only if you upload the photos there for safekeeping and viewing. I haven’t seen a way to view these on Windows, whilst I know Photos on the Mac can happily play Live Photos.

It’s probably a setting that I’ll keep turned off on the phone to be honest. I generally keep Live Photos off as well on the iPhone, so this wouldn’t be that different, though for some occasions, turning on Live Photos can be good4.


  1. The image displayed here has been resized, with GPS data stripped and therefore isn’t the actual image with the video attached. ↩︎

  2. And appears to be confirmed by using the Compare command in Imagemagick to compare the two photos. ↩︎

  3. A slight difference in file size (the video file is 4.21MB in Explorer) is likely due to rounding differences. ↩︎

  4. Photographing moving objects it comes in handy ↩︎