This is a copy of the Github readme.
Find the original on https://github.com/bestia-dev/split_samsung_motion_jpg

split_samsung_motion_jpg

Split -Samsung 3 seconds motion jpg- into still photo and video (2025-02)
version: 1.0.30 date: 2025-02-09 author: bestia.dev repository: GitHub

ready-for-use maintained samsung motion jpg

Lines in Rust code Lines in Doc comments Lines in Comments Lines in examples Lines in tests

License Rust split_samsung_motion_jpg

Hashtags: #rustlang #tutorial #cli
My projects on GitHub are more like a tutorial than a finished product: bestia-dev tutorials.

Motivation

My Samsung S23 phone can take motion photos. It is a combination of a jpg photo with attached a short 3 seconds video mp4. Most computers cannot play this strange format yet.

I want to split these files into a normal jpg and a normal mp4 file.

Original code

The original script is in python from https://github.com/chlete/samsung-motion-photo-splitter.

Samsung's S7 Motion Photo splitter.
S7 generates a container which encapsulates picture and video. The first part
is a JPEG with its usual footer plus Samsung's own (MotionPhoto_Data). Second
part is the video.

Algorithm:
Count the bytes for each offset and write the files.
JPEG: byte zero to samsung footer end
MP4: JPEG's footer + 1 to end of file (size of the file)

I just translated it to Rust. I even used an AI translator to help with the initial translation. But it didn't work on first try. I needed to correct it a bit.

Open-source and free as a beer

My open-source projects are free as a beer (MIT license).
I just love programming.
But I need also to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my PayPal.
You know the price of a beer in your local bar ;-)
So I can drink a free beer for your health :-)
Na zdravje! Alla salute! Prost! Nazdravlje! 🍻

//bestia.dev
//github.com/bestia-dev
//bestiadev.substack.com
//youtube.com/@bestia-dev-tutorials