diff --git a/Get-VideoSubtitles.cmd b/Get-VideoSubtitles.cmd new file mode 100644 index 0000000..cd1d368 --- /dev/null +++ b/Get-VideoSubtitles.cmd @@ -0,0 +1,2 @@ +@echo off +pwsh.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Get-VideoSubtitles.ps1" %* diff --git a/Get-VideoSubtitles.ps1 b/Get-VideoSubtitles.ps1 new file mode 100644 index 0000000..d20de2d --- /dev/null +++ b/Get-VideoSubtitles.ps1 @@ -0,0 +1,104 @@ +<# +.SYNOPSIS + Extracts the embedded subtitle tracks of a video file into the current directory. +.PARAMETER Video + Path to the input video file. Can be absolute or relative to current directory. +.PARAMETER List + When present, lists the subtitle tracks instead of extracting them. Creates no files. +.DESCRIPTION + This script uses ffprobe to list the subtitle streams of a video file and ffmpeg to copy each one out: + - Text subtitles (SubRip, WebVTT and mov_text, found in MKV, WebM, MP4, MOV and M4V) are written as .srt. + - ASS/SSA subtitles (MKV) are written as .ass, keeping their styling. + - Blu-ray PGS subtitles (hdmv_pgs_subtitle, found in MKV, M2TS and TS) are copied unchanged to .sup. + - Bitmap DVD subtitles (dvd_subtitle, found in MKV and VOB) and DVB subtitles (dvb_subtitle, found in TS) are listed but not extracted, because ffmpeg cannot write them as text or as a standalone file. + - AVI files have no standard subtitle track, so nothing is extracted from them. + Bitmap subtitles can only be turned into text with OCR, which this script does not do. + Each file is named "