Last active
April 4, 2024 11:35
-
-
Save S-trace/c8964488287b3a33b561a1eb29c6aae6 to your computer and use it in GitHub Desktop.
Revisions
-
S-trace revised this gist
Nov 11, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ case "$COMMAND" in echo " Commands:" echo " ass-outline: Add outline to all ASS subtitles in current directory" echo " ass-to-srt: Convert all ASS subtitles in current directory to SRT (use to fix broken subtitles or prepare subtitles for MiPad4)" echo " srt-to-ass: Convert all SRT subtitles in current directory to ASS (use before $(basename "$0") ass-outline)" exit 1 ;; esac -
S-trace revised this gist
Nov 11, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ case "$COMMAND" in done ;; srt-to-ass) # Convert all SRT subtitles in current directory to ASS (use before $0 ass-outline) for file in *.srt; do echo "$COMMAND: Processing $file" ffmpeg -i "$file" "$(basename "$file" srt)ass" -
S-trace created this gist
Nov 11, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #!/usr/bin/env sh COMMAND=$1 case "$COMMAND" in ass-outline) # Add outline to all ASS subtitles in current directory for file in *.ass; do echo "$COMMAND: Processing $file" perl -pe 's/(^Dialogue: ([^{]*?,){9})(?=[^{])/\1\{\\bord3}\{\\blur14}/g' <"$file" >temp mv temp "$file" done echo "$COMMAND: Finalizing" sed -E 's/^(Style: sp_.+),[0-9]+,([0-9]+\r?)$/\1,0,\2/g' -i ./*.ass sed -E 's/^(Style: Default.+),[0-9]+,([0-9]+\r?)$/\1,0,\2/g' -i ./*.ass ;; ass-to-srt) # Convert all ASS subtitles in current directory to SRT (use to fix broken subtitles or prepare subtitles for tablet) for file in *.ass; do echo "$COMMAND: Processing $file" ffmpeg -i "$file" "$(basename "$file" ass)srt" done ;; srt-to-ass) # Convert all SRT subtitles in current directory to ASS (use before $0 ass) for file in *.srt; do echo "$COMMAND: Processing $file" ffmpeg -i "$file" "$(basename "$file" srt)ass" done ;; *) echo "Usage: $(basename "$0") {command}" echo " Commands:" echo " ass-outline: Add outline to all ASS subtitles in current directory" echo " ass-to-srt: Convert all ASS subtitles in current directory to SRT (use to fix broken subtitles or prepare subtitles for MiPad4)" echo " srt-to-ass: Convert all SRT subtitles in current directory to ASS (use before $(basename "$0") ass)" exit 1 ;; esac