To automatically and recursively download subtitles for all videos in a directory on Arch Linux, you have several options. Here's a comprehensive approach using some of the tools mentioned in the search results:
Using Subliminal
Subliminal is a powerful command-line tool that can recursively search for video files and download subtitles for them[1].
- Install Subliminal:
sudo pacman -S subliminal
- Use the following command to download subtitles recursively:
subliminal download -l en /path/to/your/video/directory
Replace "en" with your preferred language code and adjust the directory path as needed.
Using QNapi
QNapi is another excellent option for downloading subtitles[5].
- Install QNapi:
sudo pacman -S qnapi
- Use QNapi in console mode to download subtitles recursively:
find /path/to/your/video/directory -type f \( -name "*.mp4" -o -name "*.mkv" -o -name "*.avi" \) -exec qnapi -c {} +
This command finds all video files with .mp4, .mkv, or .avi extensions and passes them to QNapi for subtitle download.
Using yt-dlp
While primarily used for downloading videos, yt-dlp can also download subtitles for local video files[2].
- Install yt-dlp:
sudo pacman -S yt-dlp
- Use the following command to download subtitles recursively:
find /path/to/your/video/directory -type f \( -name "*.mp4" -o -name "*.mkv" -o -name "*.avi" \) -exec yt-dlp --write-sub --sub-lang en --skip-download {} +
Replace "en" with your preferred language code.
Using OpenSubtitlesDownload
OpenSubtitlesDownload is a Python script that can be used to download subtitles[3][4].
- Install OpenSubtitlesDownload:
yay -S opensubtitlesdownload
- Use the following command to download subtitles recursively:
find /path/to/your/video/directory -type f \( -name "*.mp4" -o -name "*.mkv" -o -name "*.avi" \) -exec OpenSubtitlesDownload.py {} +
Additional Tips
- For all these methods, you may need to adjust the file extensions in the
find
command to match your video file types. - Some of these tools may require you to create an account on the subtitle service they use (e.g., OpenSubtitles.org).
- If you encounter rate limiting issues, you may need to add delays between downloads or use a tool that handles this automatically.
Remember to respect copyright laws and the terms of service of the subtitle providers when downloading subtitles.
Citations: [1] https://www.tecmint.com/best-linux-movie-subtitles-player-software/ [2] https://wiki.archlinux.org/title/Yt-dlp [3] https://aur.archlinux.org/packages/opensubtitlesdownload [4] https://bbs.archlinux.org/viewtopic.php?id=162416 [5] https://man.archlinux.org/man/qnapi.1.en