SM Motion Photo

Build Status codecov docs crates

This crate provides functions for extracting video from Motion Photos and getting meta-information from the video. It is a feature of Samsung phones, a JPEG file with a video file embedded.

This feature is available on Galaxy S20, S20+, S20 Ultra, Z Flip, Note10, Note10+, S10e, S10, S10+, Fold, Note9, S9, S9+, Note8, S8, S8+, S7, and S7 edge.

Usage

```rust use std::fs::File; use smmotionphoto::SmMotion;

// open file let photofile = File::open("photo.jpg").unwrap(); let mut sm = SmMotion::with(&photofile).unwrap(); println!("JPEG file contains video? {:?}", sm.hasvideo()); let mut videofile = File::create("video.mp4").unwrap(); // dump mp4 from jpeg sm.dumpvideofile(&mut videofile).unwrap(); // get video duration (no dump needed) println!("{:?}", sm.getvideofileduration()); // get MP4 file context println!("{:?}", sm.findvideocontext()); // You can also save index and use it afterwards let mut smcached = SmMotion::withprecalculated(&photofile, 3366251).unwrap(); println!("{:?}", smcached.getvideofile_duration()); ```