Last active
October 28, 2019 05:44
-
-
Save danilvalov/77e8b0bc4938d31a833e100fda1fab96 to your computer and use it in GitHub Desktop.
Cyrillic subtitles: .ass to .srt converter (linux, mac os x)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IFS=$'\n'; set -f | |
for file in $(find ./ -name '*.ass'); | |
do | |
filename=${file%.ass}; | |
dir=$(dirname "${file}") | |
if [ -f "$filename".ass ] && [ ! -f "$filename".srt ]; | |
then | |
asstosrt -n -s utf-8 -o "$dir" "$file" > /dev/null; | |
if [ -f "$filename".srt ]; | |
then | |
iconv -c -f UTF-8 -t CP1251 "$filename".srt > "$filename".srt.new; | |
rm "$filename".srt; | |
mv "$filename".srt.new "$filename".srt; | |
echo Converted: "$filename".srt; | |
fi; | |
fi; | |
done; | |
unset IFS; set +f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.ass to .srt converter for cyrillic subtitles (for linux and mac os x)
Preparing:
ass2srt.sh
to any directoryUsing
cd /path/to/directory/with/subtitles
/path/to/script/ass2srt.sh
All
*.ass
files in the directory and subdirectories will be converted.