When adding a new video to MKVToolNix, is it possible to automatically remove (clear) all metadata, such as language tags, file titles, chapters, track names, etc.?
Welcome!
No, there’s no functionality for doing this automatically.
OK, thx for the answer.
How does one do it manually? In one fell swoop?
Right now I have to go to each field and right-mouse click and then highlight swipe to delete each field separately. It’s tedious doing it that way.
Try this .
#!/bin/bash
FILE=${@}
echo "FILE: ${FILE}"
# Batch avi, mp4, m4v files.
if [[ $FILE =~ \.(avi|mp4|m4v)$ ]]; then
echo ${FILE}
ffmpeg -i ${FILE} -map_metadata -c:v copy -c:a copy ${FILE}"-out".m4v
#mkvpropedit "${FILE}" -d title
else
# Batch mkv files.
find -name '*.mkv' | while read FILE; do
echo $FILE
mkvpropedit "$FILE" -d title
#Optional batch rename to m4v, (Jellyfin) uncomment below.
# find -name '*.mkv' | mv $FILE ${FILE%.mkv}.mkv
done
fi
if you want to rename mp4, mkv. m4v or avi.. try this.
#!/bin/bash
#(X-Seti) Mooheda 25/Mar25
#Dependences; mkvpropedit and exiftool
#removed; ffmpeg -i ${FILE} -map_metadata -c:v copy -c:a copy ${FILE}.m4v
# Function to strip metadata from MP4/AVI/M4V files
strip_metadata() {
local file="$1"
echo "Stripping metadata from: $file"
# Create temporary file
local temp="${file}.temp"
# Process the file
if exiftool -overwrite_original -All= "$file"; then
#mv new_name="${file%.mp4}.m4v"
# Replace original with the processed file
echo "✓ Successfully processed: $file"
else
echo "✗ Failed to process: $file"
fi
}
# Function to process MKV files
process_mkv() {
local file="$1"
echo "Processing MKV: $file"
# Remove title metadata
if mkvpropedit "$file" -d title; then
# Create new filename
local new_name="${file%.mkv}.m4v"
# Rename file
mv "$file" "$new_name"
echo "✓ Renamed to: $new_name"
else
echo "✗ Failed to process: $file"
fi
}
# Main script
echo "Video File Processor"
echo "===================="
# Process files provided as arguments
if [ $# -gt 0 ]; then
echo "Processing specified files..."
for file in "$@"; do
if [ ! -f "$file" ]; then
echo "File not found: $file"
continue
fi
# Get lowercase extension
ext="${file##*.}"
ext=$(echo "$ext" | tr '[:upper:]' '[:lower:]')
case "$ext" in
mp4|avi|m4v)
strip_metadata "$file"
;;
mkv)
process_mkv "$file"
;;
*)
echo "Unsupported file type: $file"
;;
esac
done
else
echo "No files specified, processing all video files in current directory..."
# Process MP4/AVI/M4V files
find . -type f \( -name "*.mp4" -o -name "*.avi" -o -name "*.m4v" \) -print0 |
while IFS= read -r -d $'\0' file; do
strip_metadata "$file"
done
# Process MKV files
find . -type f -name "*.mkv" -print0 |
while IFS= read -r -d $'\0' file; do
process_mkv "$file"
done
fi
echo "===================="
echo "Processing complete."