Compare commits

...

4 Commits

3 changed files with 32 additions and 5 deletions

19
delete_video_track_titles.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
SCRIPT_NAME=$(basename "$0")
test -z "${1}" && echo "File not specified or doesn't exist, aborting. Usage: $SCRIPT_NAME \$FILENAME" && exit 1
FILE=$1
# TODO: use -J and jq '.tracks[] | [.properties.number, .type, .codec, .properties.track_name]'
TRACKS=$(mkvmerge --identify "$FILE" | awk -F"[: ]" '$0 ~ /Track ID/{print $3}')
# capture JSON output and remove the excessively large code_private_data field
JSON_OUTPUT=$(mkvmerge -J "$FILE" | jq '.tracks[] | del(.properties.codec_private_data)')
for TRACK in $TRACKS; do
TRACK_NAME=$(echo "$JSON_OUTPUT" | jq "select(.id == $TRACK).properties.track_name")
echo -n "Track no. ${TRACK} currently set to $TRACK_NAME... "
shopt -s nocasematch
[[ $TRACK_NAME =~ full|\stitles|comment|director|sdh|sign ]] && echo "includes whitelisted word, not deleting." && continue
echo "deleting."
# mkvmerge --identify indexes tracks from 0, while mkvpropedit indexes from 1
mkvpropedit "$FILE" --edit track:"$((TRACK+1))" --delete name
done
echo "Deleting file title..."
mkvpropedit "$FILE" --edit info --delete title

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# usage: $scriptname $files $output_sub_format
output_sub_format=${@: -1}
for i in $@
for i in "$@"
do
if [ ! -e "$i" ];
then
@ -9,16 +9,16 @@ do
continue
fi
index=$(ffprobe -v 8 -show_streams -select_streams s "$i" | grep index | cut --delimiter="=" -f 2)
if [ -z $index ];
if [ -z "$index" ];
then
echo "No subtitle streams found."
exit
fi
ffprobe -v 8 -show_streams -select_streams "$i"
filename=${i%.*}
mkvextract "$i" tracks $index:"${filename}.en.ass"
if [ ! -z $1 ];
mkvextract "$i" tracks "$index":"${filename}.en.ass"
if [ -n "$1" ];
then
subtitleedit /convert "${filename}.en.ass" $output_sub_format 2>/dev/null | grep --color=none ass
subtitleedit /convert "${filename}.en.ass" "$output_sub_format" 2>/dev/null | grep --color=none ass
fi
done

8
video_convert_normalize Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [ ! -e "$1" ];
then
echo "File ${1} does not exist."
exit 1
fi
filename=${1%.*}
ffmpeg -i "$1" -metadata title="" -map 0:v -map 0:a:m:language:jpn -c:v copy -c:a ac3 "${filename}.converted.mkv"