Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
|
80ed1d3156 | ||
|
9c814327f9 |
1 changed files with 14 additions and 5 deletions
19
ts-to-mkv.sh
19
ts-to-mkv.sh
|
@ -42,7 +42,7 @@ ffmpegcheck(){
|
||||||
## Env ##
|
## Env ##
|
||||||
SAVEIFS=$IFS
|
SAVEIFS=$IFS
|
||||||
IFS=$(echo -en "\n\b")
|
IFS=$(echo -en "\n\b")
|
||||||
loglevel="level+info"
|
loglevel="-loglevel level+info"
|
||||||
FFMPEG="/data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg"
|
FFMPEG="/data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg"
|
||||||
if [[ ! -f "$FFMPEG" ]]; then
|
if [[ ! -f "$FFMPEG" ]]; then
|
||||||
FFMPEG=$(/usr/bin/env which ffmpeg)
|
FFMPEG=$(/usr/bin/env which ffmpeg)
|
||||||
|
@ -60,7 +60,7 @@ version="2"
|
||||||
|
|
||||||
## Start ##
|
## Start ##
|
||||||
echo "[info] $0 -- v$version"
|
echo "[info] $0 -- v$version"
|
||||||
while getopts d:p:fnhkq OPT; do
|
while getopts d:p:fnXhkq OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
d)
|
d)
|
||||||
if [[ -e "$OPTARG" ]]; then
|
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] -k, keep the original ts file"
|
||||||
echo "[help] -q, disable output from ffmpeg (default: info)"
|
echo "[help] -q, disable output from ffmpeg (default: info)"
|
||||||
echo "[help] -p, custom path to scan recursively (default: $WORKPATH)"
|
echo "[help] -p, custom path to scan recursively (default: $WORKPATH)"
|
||||||
|
echo "[help] -X, dry run"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
k)
|
k)
|
||||||
echo "[debug] keeping the original file"
|
echo "[debug] keeping the original file"
|
||||||
|
@ -94,8 +95,11 @@ while getopts d:p:fnhkq OPT; do
|
||||||
echo "[debug] no custom pathing; using $WORKPATH"
|
echo "[debug] no custom pathing; using $WORKPATH"
|
||||||
fi ;;
|
fi ;;
|
||||||
q)
|
q)
|
||||||
loglevel="quiet"
|
loglevel="-loglevel quiet"
|
||||||
echo "[debug] disabling ffmpeg output" ;;
|
echo "[debug] disabling ffmpeg output" ;;
|
||||||
|
X)
|
||||||
|
dryrun="1"
|
||||||
|
echo "[debug] dry run enabled";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -108,7 +112,12 @@ if [[ "$filelist" ]]; then
|
||||||
echo "[info] working on $i"
|
echo "[info] working on $i"
|
||||||
INFILE="$i"
|
INFILE="$i"
|
||||||
echo "[debug] Infile: $INFILE"
|
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"
|
echo "[debug] Outfile: $OUTFILE"
|
||||||
sleep 2
|
sleep 2
|
||||||
INFILE2="${INFILE//\'/\'\\\\\\\'\'}"
|
INFILE2="${INFILE//\'/\'\\\\\\\'\'}"
|
||||||
|
@ -121,7 +130,7 @@ if [[ "$filelist" ]]; then
|
||||||
-codec:s srt \
|
-codec:s srt \
|
||||||
-metadata:s:s:0 language=eng \
|
-metadata:s:s:0 language=eng \
|
||||||
$force \
|
$force \
|
||||||
-loglevel "$loglevel" \
|
$loglevel \
|
||||||
"${OUTFILE}"
|
"${OUTFILE}"
|
||||||
|
|
||||||
exitcode="$?"
|
exitcode="$?"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue