The Pixel and Pixel 2 phones, especially the Pixel 2 XL, have been faulted for many things. But most owners are willing to forgive Google its lapses because of one thing: the phones’ unbelievably good camera performance. One of the tricks that Google has to spice up the Pixel 2’s camera is Motion Photos and now the company is sharing some of the secrets behind it. Unsurprisingly, it has a good amount of machine learning and sophisticated algorithms involved. For the majority of the world who don’t have a Pixel 2 or Pixel 2 XL, Motion Photos is pretty much like the Live Photos feature Apple introduced back in iOS 9. For those who don’t know what either of those means, it’s basically a feature that records a video or series of photos before and after you press the shutter button. It’s basically a fun way to capture candid moments before taking a shot, presented in moving pictures format.Naturally, Google’s Motion Photos does things differently. For one, it only captures a few seconds, up to 3 seconds, before the picture is taken and not after. It also uses some stabilization magic to make it look like the background is barely moving or not at all. Google actually already has something with the same effect in the Motion Stills app for iOS and Android but Motion Photos is a step up from that.Motion Stills is purely software-based and relies on solely on computer vision, machine learning, and algorithms to distinguish foreground elements from the background. It can be tripped by noisy backgrounds or complex scenes. In contrast, Motion Photos relies on both software and hardware to do its work. It processes the motion data gathered by the Pixel 2’s gyroscope as well as its optical image stabilization, which is probably why the feature is only available on the Pixel 2 pair.Using that data, Motion Photos can compensate for the background motion of a video clip. It also trims the video to remove the few seconds when you suddenly put down your phone. Motion Photos clips can be viewed by anyone as long as they’re viewing it on Google Photos. Or in a huge exported GIF file.