Skip to content

Instantly share code, notes, and snippets.

@popstas
Created September 1, 2024 22:03
Show Gist options
  • Save popstas/5300b7975c3243a68f4413df02f5e08d to your computer and use it in GitHub Desktop.
Save popstas/5300b7975c3243a68f4413df02f5e08d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
n="$n"
cd /media/media/video
if [ -z "$n" ]; then
n="$(ls -1 *.mkv | fzf | sed 's/\.mkv$//')"
fi
subslist="$(ffprobe "$n.mkv" 2>&1 | grep -A 2 Subtitle)"
echo "$subslist"; sleep 3
count="$(ffprobe "$n.mkv" 2>&1 | grep Subtitle | wc -l)"
lastind="$(( $count - 1 ))"
rusind="$(seq 0 "$lastind" | fzf --prompt="select rus subtitles:" --header="$subslist")"
engind="$(seq 0 "$lastind" | fzf --prompt="select eng subtitles:" --header="$subslist")"
ffmpeg -y -i "$n.mkv" -map 0:s:$rusind "$n.rus.srt" && ffmpeg -y -i "$n.mkv" -map 0:s:$engind "$n.eng.srt"
ls -lh | grep "$n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment