You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
767 B
28 lines
767 B
#!/bin/bash
|
|
|
|
# Check if mkvmerge is installed
|
|
if ! command -v mkvmerge &> /dev/null; then
|
|
echo "Error: mkvmerge not found. Please install mkvtoolnix."
|
|
exit 1
|
|
fi
|
|
|
|
# Process each .mkv file in the current directory
|
|
for mkv in *.mkv; do
|
|
# Skip if no .mkv files exist
|
|
[[ -e "$mkv" ]] || continue
|
|
|
|
base_name="${mkv%.mkv}"
|
|
|
|
# Execute the mkvmerge command with a simplified approach
|
|
echo "Executing command: mkvmerge -o out.mkv \"$mkv\" \"${base_name}\"*.srt"
|
|
if mkvmerge -o out.mkv "$mkv" "${base_name}"*.srt; then
|
|
echo "Muxing successful, replacing original file and deleting subtitles."
|
|
mv out.mkv "$mkv"
|
|
rm -f "${base_name}"*.srt
|
|
else
|
|
echo "Muxing failed, keeping original files."
|
|
fi
|
|
|
|
done
|
|
|