If you remove metadata in a script or a pipeline, you're probably using ffmpeg for video and ExifTool for everything else. Both are excellent tools. Both have defaults that look like they remove everything and don't. We tested them on real files while building our own cleaner. This post lists what they miss, the commands that fix it, and when it's worth handing the job to an API that checks its own output.
Video with ffmpeg
The commonly shared command:
ffmpeg -i in.mov -map_metadata -1 -c copy out.mov
What it misses:
- Per-stream tags.
-map_metadata -1clears the file-level metadata only. Tags on individual streams (a handler name like "Pixel 8 Camera", encoder names) survive. Add-map_metadata:s -1. - Extra tracks, or not, depending on mapping. By default ffmpeg picks one video and one audio stream, which happens to drop other tracks. But a common "fix" for multi-audio files is
-map 0, which copies every track, including iPhone's timed-metadata tracks. On a real iPhone 13 Pro video, those held face detection for 1,876 frames (face IDs, positions, angles), plus scene light levels and Live Photo data. Map only what you want:-map 0:v -map 0:a?. - Chapters, which can carry titles. Add
-map_chapters -1. - Dates. Container and track dates get the time of the rewrite unless you add
-fflags +bitexact(and-flags:v +bitexact -flags:a +bitexact), which zeroes them instead. - Cover art, which counts as a video stream.
-map 0:V(capital V) skips attached pictures.
A better baseline:
ffmpeg -i in.mov -map 0:V -map 0:a? -map_metadata -1 -map_metadata:s -1 -map_chapters -1 \
-fflags +bitexact -flags:v +bitexact -flags:a +bitexact -c copy -movflags +faststart out.mov
It copies without re-encoding. In our tests the video and audio packets were byte-identical before and after (checked with ffmpeg's streamhash), on H.264 and HEVC MOV/MP4, WebM and MKV. One residue: a generic "Lavf" writer label that names ffmpeg, not you.
AVI is a problem case: AAC audio in AVI can't be stream-copied back into AVI cleanly. Convert to MP4.
Video with ExifTool
exiftool -all= video.mp4 is often suggested for video too. In our tests it left the recording dates and Apple's device labels in place. It's fine for editing video tags. For removing them, ffmpeg is more thorough.
PDFs with ExifTool
exiftool -all:all= file.pdf is reversible, and ExifTool warns about it itself: "ExifTool PDF edits are reversible". It appends an incremental update rather than rewriting the file. We tested it on a Word-generated PDF: the author name was still in the bytes afterwards, and exiftool -PDF-update:all= restored it.
ExifTool's documentation gives the fix: rewrite the file with qpdf.
exiftool -all:all= in.pdf && qpdf --linearize in.pdf out.pdf
That makes it permanent. It still misses two things:
- Embedded images keep their own EXIF, GPS and XMP. A photo placed in a document brings its metadata with it.
- C2PA in a PDF isn't metadata. Content Credentials are stored as an attached file (with the
C2PA_Manifestrelationship) plus per-image manifests in page resources. Metadata tools don't touch them.
To handle both you need a real PDF library, such as pikepdf: drop /Info, every /Metadata stream, /PieceInfo, C2PA attachments and resources, and strip APP segments from embedded JPEGs.
RAW files with ExifTool
This is where the default is dangerous. exiftool -all= on a Sony-derived DNG shrank it from 35.7MB to 14.5MB and changed the render: it deleted data the raw converter needs. Never blunt-strip a RAW.
A targeted strip works, with traps:
- Maker notes can't be deleted as a block in a RAW, and many fields inside are "Permanent". Overwrite them:
-Canon:SerialNumber=0,-Sony:ShutterCount=0,-FujiFilm:ImageCount=0. - Some need the raw write form.
-Sony:InternalSerialNumber#=0 0 0 0 0 0and-Sony:SonyDateTime#=0000:00:00 00:00:00fail silently in their printed form, especially under-m. - Nikon: never touch
Nikon:SerialNumberorNikon:ShutterCount. They're the key for Nikon's encrypted colour data, and removing them wrecked the white balance in our test. A bare-SerialNumber=hits them, so scope it:-ExifIFD:SerialNumber=. - Use
-wm wso brand-specific arguments never create tags in other brands' files. - DNG has
RawDataUniqueID, which links a copy to its original.
Verify by decoding the sensor data (for example with rawpy/LibRaw) before and after, and comparing the raw pixels and as-shot white balance. Don't compare renders: Fujifilm X-Trans demosaicing isn't deterministic.
The part scripts usually skip: verification
Every trap above fails silently. The command exits 0 and the metadata is still there, or the file is quietly damaged. If files leave your system automatically, a pipeline needs to re-read its own output: confirm nothing identifying remains, and that the content is intact.
Or use an API that does it for you
Our metadata removal API runs the checked recipes above for video (MP4, MOV, M4V, 3GP, MKV, WebM), PDF, RAW (CR2, CR3, NEF, ARW, RAF, RW2, DNG) and images (JPEG, PNG, WebP):
curl -X POST https://api.aimetadatacleaner.com/v1/clean \
-H "Authorization: Bearer $AMC_API_KEY" \
-F [email protected]
Each response is a report: status is clean, unverified or failed, with lists of what was removed, what was kept on purpose (such as RAW make and model), and anything left. A file is only clean if the output was re-read and found clean, and content checks passed (video and audio packets identical, RAW sensor data and white balance identical, image pixels identical, PDF readable). Damage means failed and no file. The download link works once and expires after 15 minutes; files are deleted after cleaning.
The API is part of the Business plan: $49/month for 10,000 files and 1TB a month, files up to 2GB. Keys are created on your account page. The docs have Python and JavaScript examples.
Frequently asked questions
How do I remove all metadata from a video with ffmpeg?
Use -map 0:V -map 0:a? -map_metadata -1 -map_metadata:s -1 -map_chapters -1 -c copy, plus the bitexact flags to zero the dates. Plain -map_metadata -1 misses per-stream tags, and -map 0 copies hidden data tracks.
Does exiftool -all= remove all metadata?
For JPEGs, essentially yes. For PDFs, no: the edit is reversible until the file is rewritten with qpdf. For RAW files, it removes data the converter needs and can change the image. For video, it leaves dates and some device labels.
How do I permanently remove metadata from a PDF on the command line?
Run exiftool -all:all= and then qpdf --linearize to rewrite the file. Embedded images and C2PA manifests need a PDF library such as pikepdf.
Is there an API for removing metadata?
Yes. Ours cleans video, PDF, RAW and images, verifies each output and returns a report of what was removed. It's included in the Business plan.
Why not just re-encode the video?
Re-encoding loses quality and takes time, and many encoders copy metadata across anyway. Stream-copying with the right flags removes the metadata without touching a frame.
