This commit is contained in:
Luke 2019-11-07 07:43:25 -08:00
parent 1823bcab3f
commit e5b5ea6f80

39
burnSubs Normal file → Executable file
View file

@ -5,12 +5,11 @@ set -o errexit
################################################################################
# burnSubs
# version 0.9.1
# version 0.9.2
#################3
# Wishlist:
# queue encodes
# finish TODOs
# list subtitles flag
# finish help flag
# audio recode flag
################################################################################
@ -48,7 +47,7 @@ function machineSetup() {
if [[ "$(hostname)" == "Kusanagi" ]]; then
echo " > Hostname: 草薙素子"
export OPTS_ENC="nvidia"
echo "FIX FFMPEG!"
echo "---> FIX FFMPEG!"
#export FFMPEG="/opt/ffmpeg-nvenc/bin/ffmpeg"
export LD_LIBRARY_PATH="/opt/ffmpeg-nvenc/lib"
export FF_EXT="${FF_EXT} -pix_fmt yuv420p"
@ -312,7 +311,9 @@ function selectSubs() {
# TODO: handle multiple subtitle files
# TODO: verify the the subtitle index is legal
if [[ $SUB_COUNT -eq 0 ]]; then
echo " > ERROR: No subtitles! Todo!"
echo " > ERROR: No subtitles!"
echo " > Reverting to a dry run."
export OPTS_DRYRUN=true
export SUBTITLE_INDEX=-1
else
if [[ $OPTS_SELSUB -lt 0 && $SUB_COUNT -gt 1 ]]; then
@ -343,8 +344,13 @@ function selectSubs() {
function extractSubs() {
echo " > extracting subtitles"
export SUBTITLE_FILE="${TMP}/ripped.ass"
if [[ $SUBTITLE_INDEX -lt 0 ]]; then
echo " > skipping subtitles (TODO: tidy cleanup)"
return
else
echo " > extracting subtitles"
fi
extractIndex="$1"
"$FFMPEG" -i "${INPUT_VIDEO}" -map 0:"${extractIndex}" -vn -an -c:s copy -c:a copy \
"$SUBTITLE_FILE" 2>/dev/null
@ -522,7 +528,26 @@ while true; do
"-h" | "--help")
# TODO: Display help
shift # all arguments parsed
echo "TODO: HELP!" # Display HELP
echo "$(basename $0) [args] <input> <output>"
#echo "TODO: HELP!" # Display HELP
cat << _EOT
----------------------------------------------------------------------------
-k auto-klobber when ffmpeg asks
-t <t> ffmpeg encoding time limit
--crf <#> override CRF setting
--soft force software decode and encode
--psoft use software encoding (allow hardware decode when available)
--audiofix transcode audio
--audio transcode audio, and low-pass filter as well
-l list subtitles (no encoding)
-s <#> select specific subtitle track number
#TODO: verify legal subtitle track number convention
-d debug (no cleanup)
--dry dry run (no encoding)
_EOT
exit
;;
*)
@ -536,7 +561,7 @@ done
# Now parse POSITIONAL ARGUMENTS
if [[ $# -ne 2 ]]; then
echo "ERROR: Incorrect number of positional arguments. Expected 2, got $#"
echo " $0 [args] <input> <output>"
echo " $(basename $0) [args] <input> <output>"
exit
else
INPUT_VIDEO="$(readlink -f "$1")"