Last active
August 29, 2024 23:43
-
-
Save kowalcj0/ae0bdc43018e2718fb75290079b8839a to your computer and use it in GitHub Desktop.
Extract all subtitles from a movie using ffprobe & ffmpeg
This file contains 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
alias subs=subs | |
function subs() { | |
movie="${1}" | |
filename="${1%.*}" | |
mappings=`ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 "${movie}"` | |
OLDIFS=$IFS | |
IFS=, | |
( while read idx lang | |
do | |
echo "Exctracting ${lang} subtitle #${idx} from ${movie}" | |
ffmpeg -nostdin -hide_banner -loglevel quiet -i "${movie}" -map 0:"$idx" "${filename}_${lang}_${idx}.srt" | |
done <<< "${mappings}" ) | |
IFS=$OLDIFS | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The issue im having is this producing 0kb sub files.