Skip to main content

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
PDF 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
PDF โœ“ โœ“ โœ“ 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
  • --out always writes to a new file
  • --dry-run previews 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

surgery-0.1.2.tar.gz (9.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

surgery-0.1.2-py3-none-any.whl (9.8 MB view details)

Uploaded Python 3

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

Hashes for surgery-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f0c124f78e75a62d4c1fa3e2fb96f47936fc6ae2b8ac15f421189dfa1de728ad
MD5 222bd30a4ea9b0a87f999c3dbdf9f76b
BLAKE2b-256 73ec274b23149503a68f8b2fcc0d4407cd52d9ac54ab04938939c3aedca31d0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for surgery-0.1.2.tar.gz:

Publisher: publish.yml on ankit-chaubey/media-metadata-surgery

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for surgery-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a25517a0f8afef5583cf5cac0695fb58526e3efb7d0558f892401637f9fceb66
MD5 1d3c9b912ceda14802c504e3812a07f5
BLAKE2b-256 90944a73f3a753b226843c0a44a8ecc92159222e25ca9d0ee70a767b75447d24

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page