From 9c814327f9e3c2284b492b74a2ebc9cdf2ed4f11 Mon Sep 17 00:00:00 2001 From: Cody Cook Date: Fri, 31 May 2019 15:53:21 -0700 Subject: [PATCH 1/3] Update ts-to-mkv.sh --- ts-to-mkv.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ts-to-mkv.sh b/ts-to-mkv.sh index 536c047..38e47be 100644 --- a/ts-to-mkv.sh +++ b/ts-to-mkv.sh @@ -60,7 +60,7 @@ version="2" ## Start ## echo "[info] $0 -- v$version" -while getopts d:p:fnhkq OPT; do +while getopts d:p:fnXhkq OPT; do case "$OPT" in d) if [[ -e "$OPTARG" ]]; then @@ -79,6 +79,7 @@ while getopts d:p:fnhkq OPT; do echo "[help] -k, keep the original ts file" echo "[help] -q, disable output from ffmpeg (default: info)" echo "[help] -p, custom path to scan recursively (default: $WORKPATH)" + echo "[help] -X, dry run" exit 0 ;; k) echo "[debug] keeping the original file" @@ -96,6 +97,9 @@ while getopts d:p:fnhkq OPT; do q) loglevel="quiet" echo "[debug] disabling ffmpeg output" ;; + X) + dryrun="1" + echo "[debug] dry run enabled";; esac done @@ -108,7 +112,12 @@ if [[ "$filelist" ]]; then echo "[info] working on $i" INFILE="$i" echo "[debug] Infile: $INFILE" - OUTFILE="${i//.ts/.mkv}" + if [[ "$dryrun" == "1" ]]; then + OUTFILE="/dev/null" + echo "[debug] overriding OUTFILE to $OUTFILE" + else + OUTFILE="${i//.ts/.mkv}" + fi echo "[debug] Outfile: $OUTFILE" sleep 2 INFILE2="${INFILE//\'/\'\\\\\\\'\'}" From 80ed1d3156b81135327f65752be6cd7a4bd92748 Mon Sep 17 00:00:00 2001 From: Cody Cook Date: Fri, 31 May 2019 16:49:17 -0700 Subject: [PATCH 2/3] fix variables for loglevel dryrun doesn't work, doesn't like /dev/null or null... the examples use -f but this command doesn't... have to reconsider --- ts-to-mkv.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ts-to-mkv.sh b/ts-to-mkv.sh index 38e47be..b597bc7 100644 --- a/ts-to-mkv.sh +++ b/ts-to-mkv.sh @@ -42,7 +42,7 @@ ffmpegcheck(){ ## Env ## SAVEIFS=$IFS IFS=$(echo -en "\n\b") -loglevel="level+info" +loglevel="-loglevel level+info" FFMPEG="/data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg" if [[ ! -f "$FFMPEG" ]]; then FFMPEG=$(/usr/bin/env which ffmpeg) @@ -95,7 +95,7 @@ while getopts d:p:fnXhkq OPT; do echo "[debug] no custom pathing; using $WORKPATH" fi ;; q) - loglevel="quiet" + loglevel="-loglevel quiet" echo "[debug] disabling ffmpeg output" ;; X) dryrun="1" @@ -130,7 +130,7 @@ if [[ "$filelist" ]]; then -codec:s srt \ -metadata:s:s:0 language=eng \ $force \ - -loglevel "$loglevel" \ + $loglevel \ "${OUTFILE}" exitcode="$?" From d82af9e80911e736aa933e67a56ac8fd09a23090 Mon Sep 17 00:00:00 2001 From: Cody Cook Date: Fri, 31 May 2019 20:15:38 -0700 Subject: [PATCH 3/3] fixing ffmpeg; didn't accept my custom ffmpeg when I was not on linux --- ts-to-mkv.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ts-to-mkv.sh b/ts-to-mkv.sh index 536c047..d7d39ae 100644 --- a/ts-to-mkv.sh +++ b/ts-to-mkv.sh @@ -47,12 +47,6 @@ FFMPEG="/data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg" if [[ ! -f "$FFMPEG" ]]; then FFMPEG=$(/usr/bin/env which ffmpeg) fi - -ffmpegcheck -if [[ "$?" == "2" ]]; then - echo "[error] ffmpeg version too low, need to use version 4.0.0 or newer." - exit 1 -fi WORKPATH="./" keepsource="0" version="2" @@ -99,6 +93,12 @@ while getopts d:p:fnhkq OPT; do esac done +ffmpegcheck +if [[ "$?" == "2" ]]; then + echo "[error] ffmpeg version too low, need to use version 4.0.0 or newer." + exit 1 +fi + shift $((OPTIND-1)) echo "[info] finding files" filelist="$(find "$WORKPATH" -name "*.ts")"