Skip to content

Instantly share code, notes, and snippets.

@danilevy1212
Created January 23, 2026 15:36
Show Gist options
  • Select an option

  • Save danilevy1212/a06152f3818ef8bcb1d10979c9232b0e to your computer and use it in GitHub Desktop.

Select an option

Save danilevy1212/a06152f3818ef8bcb1d10979c9232b0e to your computer and use it in GitHub Desktop.
Convert .ass to .srt
#!/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