Created
October 10, 2019 14:56
-
-
Save Forceflow/e5e31515337b197ee25e66c466dcbe8f to your computer and use it in GitHub Desktop.
Strip all metadata from video file using ffmpeg
This file contains hidden or 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/bash | |
#Usage: ./stripmetadata.sh filename.mp4 (or whatever video format ffmpeg takes) | |
# Fancy colors | |
RED='\033[1;31m' | |
GREEN='\033[1;32m' | |
NC='\033[0m' | |
# Grab variables | |
filename="$1" | |
ffmpeg_version="$(ffmpeg -version | head -n 1)" | |
echo -e "${GREEN}INFO${NC}: Stripping metadata from ${filename} with ${ffmpeg_version}" | |
ffmpeg -hide_banner -loglevel warning -i "$filename" -map_metadata -1 -c:v copy -c:a copy "strip_${filename}" || { echo -e "${RED}ERR:${NC} ffmpeg reported an error - exiting" ; exit 1; } | |
echo -e "${GREEN}INFO${NC}: Removing original ${filename}" | |
rm "$filename" || { echo -e "${RED}ERR:${NC} Could not remove original file - exiting" ; exit 1; } | |
echo -e "${GREEN}INFO${NC}: Renaming strip_${filename} to ${filename}" | |
mv "strip_${filename}" "$filename" || { echo -e "${RED}ERR:${NC} Could not rename stripped version to original - exiting" ; exit 1; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment