Created
January 23, 2026 15:36
-
-
Save danilevy1212/a06152f3818ef8bcb1d10979c9232b0e to your computer and use it in GitHub Desktop.
Convert .ass to .srt
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
| #!/usr/bin/env bash | |
| # Script to convert ASS files to SRT using ffmpeg | |
| # Usage: ./convert_ass_to_srt_fixed.sh | |
| echo "Converting ASS files to SRT..." | |
| # Check if ffmpeg is available | |
| if ! command -v ffmpeg &>/dev/null; then | |
| echo "Error: ffmpeg is not installed or not in PATH" | |
| exit 1 | |
| fi | |
| # Find all .ass files in current directory only (no subdirectories) | |
| while IFS= read -r -d '' file; do | |
| # Skip if file doesn't exist | |
| if [ ! -f "$file" ]; then | |
| echo "Skipping non-existent file: $file" | |
| continue | |
| fi | |
| # Get filename without extension | |
| base=$(basename "$file" ".ass") | |
| output="${base}.srt" | |
| echo "Converting: $file -> $output" | |
| # Convert ASS to SRT using ffmpeg | |
| ffmpeg -i "$file" -c:s srt "$output" -y -loglevel error < /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo "Successfully converted: $output" | |
| else | |
| echo "Failed to convert: $file" | |
| fi | |
| done < <(find . -maxdepth 1 -name "*.ass" -type f -print0) | |
| echo "Done! All ASS files have been converted to SRT format." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment