Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 28 lines (20 sloc) 655 Bytes
#!/usr/bin/env bash
# ffsubshot: Take a screenshot at the given timestamp, with subtitles.
set -eo pipefail
# By default, assume subtitles are baked into the input.
# Users can override this to use an external subtitle file.
SUB_FILE="${SUB_FILE:-${1}}"
function help {
echo "Usage: ffsubshot <input> <timestamp> <output>"
exit
}
function installed {
cmd=$(command -v "${1}")
[[ -n "${cmd}" ]] && [[ -f "${cmd}" ]]
return ${?}
}
[[ $# -eq 3 && -f $1 && -n $2 && ! -f $3 ]] || help
installed ffmpeg || { >&2 echo "Missing ffmpeg."; exit 1; }
ffmpeg -ss "${2}" -copyts \
-i "${1}" -vf subtitles="${SUB_FILE}" \
-vframes 1 "${3}"