Precision-focused offline CLI for viewing, editing, and stripping metadata from any media or document file
Project description
Media Metadata Surgery v0.1.2
Precision-focused, fully offline CLI for viewing, editing, and stripping metadata from any media or document file.
The core engine is Go โ fast, correct, zero dependencies. Distribution via pip.
What's new in v0.1.2
v0.1.1 supported only JPEG read-only.
v0.1.2 expands to 28 formats across 4 media categories:
| Category | Formats |
|---|---|
| ๐ผ Image | JPEG, PNG, GIF, WebP, TIFF, BMP, HEIC/HEIF, SVG |
| ๐ต Audio | MP3, FLAC, OGG, Opus, M4A/AAC, WAV, AIFF |
| ๐ฌ Video | MP4, MOV, MKV, WebM, AVI, WMV, FLV |
| ๐ Document | PDF, DOCX, XLSX, PPTX, ODT, EPUB |
Installation
pip install surgery
Or build from source (requires Go 1.21+):
git clone https://github.com/ankit-chaubey/media-metadata-surgery
cd media-metadata-surgery
go build -o surgery ./cli
Commands
| Command | Description |
|---|---|
view |
View all metadata for a file |
edit |
Add or update metadata fields |
strip |
Remove metadata from a file |
info |
Show format detection and capabilities |
formats |
List all supported formats |
batch |
Process all files in a directory |
version |
Print version |
view โ read metadata
surgery view photo.jpg
surgery view --json audio.mp3
surgery view --verbose document.pdf
Output (JPEG):
File : photo.jpg
Format: JPEG
โโ EXIF โโ
Make: vivo [editable]
Model: vivo T1 5G [editable]
DateTimeOriginal: 2026:02:04 18:44:10
GPSLatitude: 18 deg 20' 47.19"
GPSLongitude: 84 deg 25' 25.39"
โโ IPTC โโ
Keywords: travel, india
Output (MP3):
File : song.mp3
Format: MP3
โโ ID3v2.4.0 โโ
Title: Bohemian Rhapsody [editable]
Artist: Queen [editable]
Album: A Night at the Opera [editable]
Year: 1975
Genre: Rock
edit โ update metadata
# Set fields (in-place)
surgery edit --set "Artist=John Doe" --set "Title=My Song" audio.mp3
# Write to new file
surgery edit --set "Make=Canon" --out edited.jpg photo.jpg
# Delete a field
surgery edit --delete UserComment photo.jpg
# Preview without writing
surgery edit --dry-run --set "Title=Report 2024" document.docx
Editable fields by format
| Format | Fields |
|---|---|
| JPEG | Make, Model, Software, Artist, Copyright, ImageDescription, UserComment, DateTime, DateTimeOriginal, DateTimeDigitized |
| PNG | Title, Author, Description, Copyright, Comment, Creation Time, Source, Software |
| MP3 | Title, Artist, Album, Year, Genre, Comment, TrackNumber, AlbumArtist, Composer, Lyrics, Copyright |
| FLAC | TITLE, ARTIST, ALBUM, DATE, GENRE, COMMENT, TRACKNUMBER, ALBUMARTIST, COMPOSER, COPYRIGHT |
| MP4/MOV | title, artist, album, comment, year, genre, description, copyright |
| Title, Author, Subject, Keywords, Creator, Producer | |
| DOCX/XLSX/PPTX | Title, Subject, Author, Keywords, Description, LastModifiedBy, Category |
strip โ remove metadata
# Remove all metadata (in-place)
surgery strip photo.jpg
# Remove to new file
surgery strip --out clean.jpg photo.jpg
# Remove only GPS coordinates
surgery strip --gps-only photo.jpg
# Remove all EXCEPT EXIF
surgery strip --keep exif photo.jpg
# Preview
surgery strip --dry-run audio.mp3
Privacy use-case โ strip location before uploading:
surgery strip --gps-only holiday_photo.jpg
info โ detect format
surgery info video.mkv
File : video.mkv
Detected Format : Matroska MKV (id: mkv)
Media Type : video
Can View : true
Can Edit : false
Can Strip : false
Notes : EBML-based container. View only in v0.1.2.
formats โ list all formats
surgery formats
surgery formats --type audio
Format ID Name Type View Edit Strip Extensions
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
jpeg JPEG image โ โ โ .jpg .jpeg
png PNG image โ โ โ .png
mp3 MP3 audio โ โ โ .mp3
flac FLAC audio โ โ โ .flac
mp4 MP4 video โ โ โ .mp4
pdf PDF document โ โ โ .pdf
docx DOCX document โ โ โ .docx
...
TOTAL 28 9 13 (28 formats)
batch โ process directories
# View all files
surgery batch view ./photos
# View recursively as JSON
surgery batch view --json --recursive ./media
# Strip all files, output to new directory
surgery batch strip --out ./clean ./photos
# Strip recursively in-place
surgery batch strip --recursive ./photos
# Apply copyright to all editable files
surgery batch edit --set "Copyright=ACME Corp 2024" ./docs
# Dry-run
surgery batch edit --dry-run --set "Author=Ankit" ./documents
Capability matrix
| Format | View | Edit | Strip | Metadata types |
|---|---|---|---|---|
| JPEG | โ | โ | โ | EXIF, XMP, IPTC |
| PNG | โ | โ | โ | tEXt, iTXt, eXIf |
| GIF | โ | โ | โ | Comment blocks |
| WebP | โ | โ | โ | EXIF, XMP |
| TIFF | โ | โ | โ | EXIF IFDs |
| BMP | โ | โ | โ | Header fields |
| HEIC | โ | โ | โ | EXIF (ISOBMFF) |
| SVG | โ | โ | โ | title, desc, XMP |
| MP3 | โ | โ | โ | ID3v1, ID3v2 |
| FLAC | โ | โ | โ | Vorbis Comments |
| OGG | โ | โ | โ | Vorbis Comments |
| Opus | โ | โ | โ | Vorbis Comments |
| M4A | โ | โ | โ | iTunes atoms |
| WAV | โ | โ | โ | LIST INFO |
| AIFF | โ | โ | โ | NAME, AUTH, ANNO |
| MP4 | โ | โ | โ | iTunes atoms |
| MOV | โ | โ | โ | udta atoms |
| MKV | โ | โ | โ | EBML tags |
| WebM | โ | โ | โ | EBML tags |
| AVI | โ | โ | โ | RIFF INFO |
| WMV | โ | โ | โ | ASF Content Desc |
| FLV | โ | โ | โ | onMetaData AMF |
| โ | โ | โ | Info dict, XMP | |
| DOCX | โ | โ | โ | OPC core/app props |
| XLSX | โ | โ | โ | OPC core/app props |
| PPTX | โ | โ | โ | OPC core/app props |
| ODT | โ | โ | โ | ODF meta.xml |
| EPUB | โ | โ | โ | OPF package metadata |
Security & privacy
- All operations are fully offline โ no network access
- No background processes, no telemetry
- Viewing never modifies files
--outalways writes to a new file--dry-runpreviews changes before any write
Project structure
media-metadata-surgery/
โโโ cli/main.go # Commands: view, edit, strip, info, formats, batch
โโโ core/
โ โโโ types.go # Handler interface, Metadata, MetaField, options
โ โโโ detect.go # Magic-byte + extension format detection (28 formats)
โ โโโ output.go # Text + JSON printer
โ โโโ image/image.go # JPEG/PNG/GIF/WebP/TIFF/BMP/HEIC/SVG handlers
โ โโโ audio/audio.go # MP3/FLAC/OGG/Opus/M4A/WAV/AIFF handlers
โ โโโ video/video.go # MP4/MOV/MKV/WebM/AVI/WMV/FLV handlers
โ โโโ document/document.go # PDF/DOCX/XLSX/PPTX/ODT/EPUB handlers
โโโ surgery/
โ โโโ __init__.py
โ โโโ __main__.py
โ โโโ bin/surgery # Compiled binary (bundled at release)
โโโ go.mod / go.sum
โโโ setup.py / pyproject.toml
โโโ README.md
License
Apache License 2.0
Author
Ankit Chaubey โ https://github.com/ankit-chaubey
Philosophy
Precision over features. Correctness over speed. Transparency over magic.
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 surgery-0.1.2.tar.gz.
File metadata
- Download URL: surgery-0.1.2.tar.gz
- Upload date:
- Size: 9.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0c124f78e75a62d4c1fa3e2fb96f47936fc6ae2b8ac15f421189dfa1de728ad
|
|
| MD5 |
222bd30a4ea9b0a87f999c3dbdf9f76b
|
|
| BLAKE2b-256 |
73ec274b23149503a68f8b2fcc0d4407cd52d9ac54ab04938939c3aedca31d0b
|
Provenance
The following attestation bundles were made for surgery-0.1.2.tar.gz:
Publisher:
publish.yml on ankit-chaubey/media-metadata-surgery
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
surgery-0.1.2.tar.gz -
Subject digest:
f0c124f78e75a62d4c1fa3e2fb96f47936fc6ae2b8ac15f421189dfa1de728ad - Sigstore transparency entry: 972498478
- Sigstore integration time:
-
Permalink:
ankit-chaubey/media-metadata-surgery@737812649a2dfe7f3c89edb169c670b8424525f2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ankit-chaubey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@737812649a2dfe7f3c89edb169c670b8424525f2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file surgery-0.1.2-py3-none-any.whl.
File metadata
- Download URL: surgery-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a25517a0f8afef5583cf5cac0695fb58526e3efb7d0558f892401637f9fceb66
|
|
| MD5 |
1d3c9b912ceda14802c504e3812a07f5
|
|
| BLAKE2b-256 |
90944a73f3a753b226843c0a44a8ecc92159222e25ca9d0ee70a767b75447d24
|
Provenance
The following attestation bundles were made for surgery-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on ankit-chaubey/media-metadata-surgery
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
surgery-0.1.2-py3-none-any.whl -
Subject digest:
a25517a0f8afef5583cf5cac0695fb58526e3efb7d0558f892401637f9fceb66 - Sigstore transparency entry: 972498486
- Sigstore integration time:
-
Permalink:
ankit-chaubey/media-metadata-surgery@737812649a2dfe7f3c89edb169c670b8424525f2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ankit-chaubey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@737812649a2dfe7f3c89edb169c670b8424525f2 -
Trigger Event:
push
-
Statement type: