Skip to content

Instantly share code, notes, and snippets.

@rdegges
Created December 10, 2022 08:42
Show Gist options
  • Save rdegges/3f516a787b6b90009216aaf7003189a9 to your computer and use it in GitHub Desktop.
Save rdegges/3f516a787b6b90009216aaf7003189a9 to your computer and use it in GitHub Desktop.
Given a directory full of video files, strip all metadata from the videos using ffmpeg.
#!/usr/bin/bash
#
# This script will remove the metata from all video files in the given
# directory.
#
# @requires ffmpeg
# @usage ./strip-video-metadata.sh </path/to/folder>
# Loop through all files in the directory
for f in "$1"/*
do
# Use ffmpeg to remove all metadata from the file and save the output to a new file
ffmpeg -i "$f" -map_metadata -1 -c:v copy -c:a copy "${f%.*}-temp.${f##*.}"
# Move the new file to replace the original file
mv "${f%.*}-temp.${f##*.}" "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment