Git Product home page Git Product logo

sm_motion_photo's Introduction

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.

Supports photos saved in JPEG and HEIF (HEIC) format.

Usage

use std::fs::File;
use sm_motion_photo::SmMotion;

// open file
let photo_file = File::open("photo.jpg").unwrap();
let mut sm = SmMotion::with(&photo_file).unwrap();
println!("JPEG file contains video? {:?}", sm.has_video());
let mut video_file = File::create("video.mp4").unwrap();
// dump mp4 from jpeg
sm.dump_video_file(&mut video_file).unwrap();
// get video duration (no dump needed)
println!("{:?}", sm.get_video_file_duration());
// get MP4 file context
println!("{:?}", sm.find_video_context());
// You can also save index and use it afterwards
let mut sm_cached = SmMotion::with_precalculated(&photo_file, 3366251).unwrap();
println!("{:?}", sm_cached.get_video_file_duration());

sm_motion_photo's People

Contributors

g0ddest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sm_motion_photo's Issues

Please make this easy to run for someone with no Rust experience

I don't know how to run this and get this issue with crate build:


error[E0599]: no function or associated item named new found for struct MediaContext in the current scope
--> /Users/..../.cargo/git/checkouts/sm_motion_photo-5b585e73924016bc/9890a0e/src/lib.rs:125:59
|
125 | let mut context = mp4parse::MediaContext::new();
| ^^^ function or associated item not found in MediaContext

error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> /Users/..../.cargo/git/checkouts/sm_motion_photo-5b585e73924016bc/9890a0e/src/lib.rs:126:25
|
126 | let _ = mp4parse::read_mp4(&mut video_content, &mut context);
| ^^^^^^^^^^^^^^^^^^ ------------------ ------------ supplied 2 arguments
| |
| expected 1 argument


I don't know how else to contact you so I am marking this as an issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.