Last active
July 5, 2025 04:00
-
-
Save singularitti/4f67fe2a3764fb0102e6d9047c7b9595 to your computer and use it in GitHub Desktop.
Remove video metadata #Shell #metadata
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
| # See https://exiftool.org/forum/index.php?topic=11977.0 | |
| strip_video_metadata() { | |
| local infile="$1" # First argument: input filename | |
| local outfile="${2:-$infile}" # Second argument: output filename (defaults to input if not given) | |
| local ext="${infile##*.}" # Extract file extension from input (everything after last '.') | |
| local tmpfile # Will hold the temporary filename | |
| if [[ "$outfile" == "$infile" ]]; then # If output is same as input (in-place operation)... | |
| tmpfile="${infile}.tmp.${ext}" # ...use a temp file with proper extension | |
| ffmpeg -i "$infile" -vcodec copy -acodec copy "$tmpfile" -y -loglevel error | |
| # ffmpeg strips metadata by remuxing; writes to temp file | |
| mv -f "$tmpfile" "$infile" # Move temp file over the original file | |
| else | |
| ffmpeg -i "$infile" -vcodec copy -acodec copy "$outfile" -y -loglevel error | |
| # If output is different, just write directly | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment