Last active
December 10, 2021 05:03
-
-
Save hexpunk/33c5832099873be2c2d48cef39ecab49 to your computer and use it in GitHub Desktop.
Remove metadata from videos using ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
for target in "$@"; do | |
original=$target.original | |
if mv "$target" "$original"; then | |
if ! ffmpeg -hide_banner \ | |
-i "$original" \ | |
-map_metadata -1 \ | |
-map_chapters -1 \ | |
-c:v copy \ | |
-c:a copy \ | |
-fflags +bitexact \ | |
-flags:v +bitexact \ | |
-flags:a +bitexact \ | |
"$target"; then | |
mv "$original" "$target" | |
exit 1 | |
fi | |
if ! rm "$original"; then | |
echo "Could not delete \"$original\"" | |
exit 1 | |
fi | |
else | |
echo "Could not move \"$target\" to \"$original\"" | |
exit 1 | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment