Extract videos from Google Motion Photos with ease!
Project description
MotionMiner
Extract videos from Google Motion Photos with ease!
MotionMiner is a powerful Python tool that extracts embedded MP4 videos from Google Motion Photos (JPG files) and converts them to various formats including MP4 and GIF animations.
๐ Features
- Extract MP4 videos from Google Motion Photos
- Convert to GIF animations with customizable quality settings
- Batch processing for multiple files
- Multiple output formats: MP4, GIF, or both
- Quality presets for GIF output (tiny, low, medium, high)
- File structure analysis to examine Motion Photo internals
- Cross-platform support (Windows, macOS, Linux)
๐ Requirements
- Python 3.6+
- FFmpeg (for video conversion)
๐ ๏ธ Installation
Method 1: Install from PyPI (Recommended)
pip install motionminer
Method 2: Install from Source
git clone https://github.com/yourusername/motionminer.git
cd motionminer
pip install -e .
Step 2: Install FFmpeg
FFmpeg is required for video processing. Choose your platform:
Windows
- Download FFmpeg from https://ffmpeg.org/download.html
- Extract to a folder (e.g.,
C:\ffmpeg) - Add the
binfolder to your system PATH - Test installation:
ffmpeg -version
macOS
# Using Homebrew
brew install ffmpeg
# Using MacPorts
port install ffmpeg
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install ffmpeg
Linux (CentOS/RHEL/Fedora)
# CentOS/RHEL
sudo yum install ffmpeg
# Fedora
sudo dnf install ffmpeg
Step 3: Verify Installation
Test that everything is working:
motionminer --help
Or use the alternative command:
motion-extract --help
๐ฏ Usage
Basic Usage
Extract MP4 from a single Motion Photo:
motionminer photo.jpg
Extract as GIF animation:
motionminer photo.jpg --gif
Extract both MP4 and GIF:
motionminer photo.jpg --both
Output Options
Specify custom output filename:
motionminer photo.jpg -o my_video.mp4
motionminer photo.jpg -o my_animation.gif --gif
GIF Quality Settings
MotionMiner offers 4 quality presets for GIF output:
| Quality | Colors | File Size | Description |
|---|---|---|---|
--gif-tiny |
64 | ~1-2MB | Maximum compression |
--gif-low |
128 | ~2-3MB | Heavy compression, decent quality |
--gif-medium |
192 | ~3-4MB | Balanced quality and size (default) |
--gif-high |
256 | ~5-7MB | Best quality |
Examples:
motionminer photo.jpg --gif-tiny # Small file size
motionminer photo.jpg --gif-high # Best quality
Custom GIF Width
Adjust GIF width (height is automatically calculated):
motionminer photo.jpg --gif --gif-width 640
GIF Looping Control
By default, GIFs loop infinitely. Use --gif-no-loop to create a GIF that plays once:
motionminer photo.jpg --gif --gif-no-loop # GIF plays once
motionminer photo.jpg --gif-high --gif-no-loop # High quality GIF that plays once
Batch Processing
Process all JPG files in a directory:
motionminer photos/ --batch
Batch process with custom output directory:
motionminer photos/ --batch --batch-output extracted_videos/
Batch convert to GIFs:
motionminer photos/ --batch --gif-low
File Analysis
Analyze Motion Photo structure without extracting:
motionminer photo.jpg --analyze
๐ Command Reference
Required Arguments
input- Input JPG file or directory containing JPG files
Optional Arguments
-o, --output [OUTPUT]- Output file path (auto-generated if not provided)-p, --photo [PATH]- Extract a standalone photo and save it to the specified PATH (PATH is optional, auto-generated if not provided)--mp4- Extract as MP4 video (default)--gif- Extract as GIF animation--both- Extract both MP4 and GIF--gif-tiny- Extract as tiny GIF (64 colors, ~1-2MB)--gif-low- Extract as low quality GIF (128 colors, ~2-3MB)--gif-medium- Extract as medium quality GIF (192 colors, ~3-4MB)--gif-high- Extract as high quality GIF (256 colors, ~5-7MB)--gif-width- GIF width in pixels (default: 480)--gif-no-loop- Create GIF that plays once instead of looping infinitely--batch- Process all JPG files in input directory--batch-output- Output directory for batch processing--analyze- Analyze file structure without extracting
๐ก Examples
Single File Examples
# Extract MP4 from Motion Photo
motionminer IMG_20231201_123456.jpg
# Extract MP4 and standalone JPEG
motionminer IMG_20231201_123456.jpg --photo
# Extract high-quality GIF
motionminer IMG_20231201_123456.jpg --gif-high
# Extract GIF that plays once (no loop)
motionminer IMG_20231201_123456.jpg --gif --gif-no-loop
# Extract both video formats with custom output
motionminer motion_photo.jpg --both -o my_video.mp4
# Extract both video formats and standalone JPEG with custom output
motionminer motion_photo.jpg --both -o my_video.mp4 -p my_photo.jpg
# Analyze file structure
motionminer motion_photo.jpg --analyze
Batch Processing Examples
# Process all photos in current directory
motionminer . --batch
# Process photos and save to specific directory
motionminer photos/ --batch --batch-output extracted/
# Batch convert to tiny GIFs for web use
motionminer photos/ --batch --gif-tiny --batch-output web_gifs/
# Process with custom GIF settings
motionminer photos/ --batch --gif --gif-width 320 --batch-output small_gifs/
# Batch convert to non-looping GIFs
motionminer photos/ --batch --gif-medium --gif-no-loop --batch-output single_play_gifs/
๐ง Troubleshooting
Common Issues
"No embedded MP4 video found"
- The file might not be a Google Motion Photo
- Some Motion Photos have different internal structures
- Use
--analyzeto examine the file structure
"FFmpeg not found"
- Make sure FFmpeg is installed and in your system PATH
- Test with
ffmpeg -versionin your terminal
"Permission denied"
- Check file permissions for input files
- Ensure you have write permissions in the output directory
Getting Help
View all available options:
motionminer --help
๐ Project Structure
MotionMiner/
โโโ motionminer/ # Main package directory
โ โโโ __init__.py # Package initialization
โ โโโ main.py # Main application entry point
โ โโโ cli.py # Command-line interface
โ โโโ extractor.py # Motion Photo extraction logic
โ โโโ converter.py # Video conversion utilities
โ โโโ analyzer.py # File structure analysis
โ โโโ config.py # Configuration and settings
โโโ tests/ # Test suite
โโโ pyproject.toml # Package configuration
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
๐ค Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
๐ License
This project is licensed under the terms specified in the LICENSE file.
๐ Acknowledgments
- Thanks to Google for creating Motion Photos
- FFmpeg community for excellent video processing tools
- Python community for amazing libraries
Happy extracting! ๐ฌโจ
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file motionminer-1.2.0.tar.gz.
File metadata
- Download URL: motionminer-1.2.0.tar.gz
- Upload date:
- Size: 265.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
362a1e37320b5216ffe976ede02eeb9a7540205106789a7fedc8b3d322c97a06
|
|
| MD5 |
2244d908152208e4def67aa41b15bda0
|
|
| BLAKE2b-256 |
dfb46b178064d085e8d27abc8ac7bdc37f9313c3ea55ff2ecb566efac9a1f623
|
Provenance
The following attestation bundles were made for motionminer-1.2.0.tar.gz:
Publisher:
ci-cd.yml on mlapaglia/MotionMiner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motionminer-1.2.0.tar.gz -
Subject digest:
362a1e37320b5216ffe976ede02eeb9a7540205106789a7fedc8b3d322c97a06 - Sigstore transparency entry: 910546003
- Sigstore integration time:
-
Permalink:
mlapaglia/MotionMiner@23d9342b80ad4a90e8c774f8f0b62865cf9932fa -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/mlapaglia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@23d9342b80ad4a90e8c774f8f0b62865cf9932fa -
Trigger Event:
release
-
Statement type:
File details
Details for the file motionminer-1.2.0-py3-none-any.whl.
File metadata
- Download URL: motionminer-1.2.0-py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b78968a9ee12d32b08b27a4f5a52feb2bc94795a9596be35f9716662d259e61b
|
|
| MD5 |
a952e47daefe0f4fc01d60a9979cbf07
|
|
| BLAKE2b-256 |
9e1ecb07927298400c7ee6aa173b60e69718e3947c9286f4a2e406dbebb75512
|
Provenance
The following attestation bundles were made for motionminer-1.2.0-py3-none-any.whl:
Publisher:
ci-cd.yml on mlapaglia/MotionMiner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motionminer-1.2.0-py3-none-any.whl -
Subject digest:
b78968a9ee12d32b08b27a4f5a52feb2bc94795a9596be35f9716662d259e61b - Sigstore transparency entry: 910546008
- Sigstore integration time:
-
Permalink:
mlapaglia/MotionMiner@23d9342b80ad4a90e8c774f8f0b62865cf9932fa -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/mlapaglia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@23d9342b80ad4a90e8c774f8f0b62865cf9932fa -
Trigger Event:
release
-
Statement type: