Answers:
我已经找到了使用mkvtoolnixmkvpropedit
一部分的方法。
mkvpropedit "foo.mkv" -e info -s title="This Is The Title"
官方网站上提供了此应用程序的GUI包装程序以及其他Mac安装说明。
另外,可以mkvpropedit
在bash脚本中使用它来设置目录中所有mkv文件的标题。(鉴于文件名是所需的标题。)
#!/bin/bash
# This script takes all mkv files in the current directory and sets the filename
# (without .mkv) as its title in metadata
for mkvfile in *.mkv; do
mkvpropedit "$mkvfile" -e info -s title="${mkvfile::-4}"
done
只需在VLC播放器中打开文件,按Ctrl + I,选择所需的元数据,标题等,进行更改,然后在底部单击“保存数据”。就这样。
无需其他外部编辑器。
该MKVToolNix
GUI方式:
打开mkv
文件。
在下面segment information
有一个title
项目,根据需要更改标题。
下载了一大堆文件,其中许多文件的标题都带有***,作为对另一个答案的扩展,它使我自己编写了脚本。
它会更改.mkv
目录(及其子目录)中所有文件的标题,同时要求采取适当的措施。动作为“保留名称?[1] /键入新名称?[2] /使用文件名作为电影名称?[3]”。
稍后可能会在github上对其进行更新,这是现在的内容:
#!/bin/sh
# This script takes all mkv files in the (sub)directory and sets it's Movie name/Title
# Requires mkvtools (mkvpropedit) and mediainfo installed
#
# param1 Starting directory (defaults to current)
# param2 Default action to do with files
# (Keep the name?[1] / Type a new name?[2] / Use the filename as a movie name?[3])
# Be carefaul with param2 since this script doesn't (atm) back up the existing movie names.
IFS=$'\n'; set -f
updateTitle() {
mkvpropedit "${1}" -e info -s title="${2}"
echo "✅ Updated to \"${2}\"";
}
getMovieTitle() {
echo "$(mediainfo ${1} | grep "Movie name" | sed 's/^.*: //')";
}
parseFilename() {
filename=${1##*/}
filename=${filename%.*}
echo ${filename}
}
chooseAction() {
f="${1}"
curFilename="${2}"
defaultAction="${3}"
if [[ -n "${defaultAction}" ]]; then
ans="${defaultAction}"
else
read -p "Keep the name?[1] / Type a new name?[2] / Use the filename as a movie name?[3] : " -n 1 ans
echo
fi
case "${ans}" in
1)
echo "Keeping the old name"
;;
2)
read -p "New movie name: " newName
updateTitle ${f} ${newName}
;;
3)
updateTitle ${f} ${curFilename}
;;
*)
echo "Invalid char \"${ans}\""
chooseAction $@
;;
esac
echo
}
renameMovies() {
for f in $(find ${1} -name '*.mkv'); do
curTitle="$(getMovieTitle ${f})"
curFilename="$(parseFilename ${f})"
echo "File location - ${f}"
echo "File name - ${curFilename}"
echo "Movie name - ${curTitle}"
chooseAction ${f} ${curFilename} ${2}
done
echo "Done"
}
renameMovies ${1:-$(pwd)} ${2}
unset IFS; set +f