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.
- 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)
- Python 3.6+
- FFmpeg (for video conversion)
pip install motionminergit clone https://github.com/yourusername/motionminer.git
cd motionminer
pip install -e .FFmpeg is required for video processing. Choose your platform:
- 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
# Using Homebrew
brew install ffmpeg
# Using MacPorts
port install ffmpegsudo apt update
sudo apt install ffmpeg# CentOS/RHEL
sudo yum install ffmpeg
# Fedora
sudo dnf install ffmpegTest that everything is working:
motionminer --helpOr use the alternative command:
motion-extract --helpExtract MP4 from a single Motion Photo:
motionminer photo.jpgExtract as GIF animation:
motionminer photo.jpg --gifExtract both MP4 and GIF:
motionminer photo.jpg --bothSpecify custom output filename:
motionminer photo.jpg -o my_video.mp4
motionminer photo.jpg -o my_animation.gif --gifMotionMiner 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 qualityAdjust GIF width (height is automatically calculated):
motionminer photo.jpg --gif --gif-width 640By 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 onceProcess all JPG files in a directory:
motionminer photos/ --batchBatch process with custom output directory:
motionminer photos/ --batch --batch-output extracted_videos/Batch convert to GIFs:
motionminer photos/ --batch --gif-lowAnalyze Motion Photo structure without extracting:
motionminer photo.jpg --analyzeinput- Input JPG file or directory containing JPG files
-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
# 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# 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/"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
View all available options:
motionminer --helpMotionMiner/
βββ 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
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
This project is licensed under the terms specified in the LICENSE file.
- Thanks to Google for creating Motion Photos
- FFmpeg community for excellent video processing tools
- Python community for amazing libraries
Happy extracting! π¬β¨
