Skip to content

Instantly share code, notes, and snippets.

@TeroKeso
Last active January 24, 2024 12:34
Show Gist options
  • Save TeroKeso/4f5dc9c6be1bece97d04222784fe2039 to your computer and use it in GitHub Desktop.
Save TeroKeso/4f5dc9c6be1bece97d04222784fe2039 to your computer and use it in GitHub Desktop.
Auto-subtitle(-plus) Ubuntu 20.04 WSL and Windows

Install

sudo apt update && sudo apt install ffmpeg python3-pip 
pip install ffmpeg-python
pip install git+https://github.com/m1guelpf/auto-subtitle.git

Install Linux

sudo apt update && sudo apt install ffmpeg python3-pip 
pip install ffmpeg-python
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
pip install git+https://github.com/Sectumsempra82/auto-subtitle-plus.git
echo 'export PATH="$HOME/bin:$PATH"' >> .bashrc
echo 'export PATH="$HOME/.local/bin:$PATH"' >> .bashrc
echo 'export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH' >> .bashrc
##Install Nvidia Cuda!

Install Windows

Winget install git.git
Winget install winget install --id=Gyan.FFmpeg  -e --accept-source-agreements
winget install -e --id Python.Python.3.0
winget install -e --id Nvidia.CUDA
winget remove 9NBLGGH4QZ94
exit

pip install ffmpeg-python
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
pip install git+https://github.com/TeroKeso/auto-subtitle/tree/auto-subtitle-plus.git

Use

auto_subtitle_plus *.mp4 --output-srt --model medium --output-srt --language Finnish
auto_subtitle_plus *.mp4 --output-srt --model medium --output-srt --language English

Bash

Finnish

find ./ -type d \( -iname "0 RAW" -o -iname "tuntitallenteet" \) -prune -o -type f \( -iname "*.mkv" -o -iname "*.mp4" \) -exec sh -c 'for file; do if [ -f "$(basename "${file%.*}.srt")" ] || [ -f "./srt/$(basename "${file%.*}.srt")" ]; then echo "The file already exists $file"; else auto_subtitle_plus --output-srt --model medium --language Finnish "$file"; fi; done' _ {} \+
mkdir -p ./srt
mv *.srt ./srt

English

find ./ -type d \( -iname "0 RAW" -o -iname "tuntitallenteet" \) -prune -o -type f \( -iname "*.mkv" -o -iname "*.mp4" \) -exec sh -c 'for file; do if [ -f "$(basename "${file%.*}.srt")" ] || [ -f "./srt/$(basename "${file%.*}.srt")" ]; then echo "The file already exists $file"; else auto_subtitle_plus --output-srt --model medium --language English "$file"; fi; done' _ {} \+
mkdir -p ./srt
mv *.srt ./srt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment