Add unmodified from last perfect script.
This commit is contained in:
parent
901c4f8fd6
commit
2f42f759b6
1 changed files with 45 additions and 0 deletions
45
ts-to-mkv.sh
Normal file
45
ts-to-mkv.sh
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
|
||||||
|
echo "[info] convert .ts to .mkv; v1 start"
|
||||||
|
echo "[info] finding files"
|
||||||
|
filelist="$(find ./ -name "*.ts")"
|
||||||
|
if [[ "$filelist" ]]; then
|
||||||
|
for i in $filelist;
|
||||||
|
do
|
||||||
|
if [[ "$i" == "./*/*.ts" ]] || [[ "$i" == "./*.ts" ]] || [[ "$i" == "./*/*/*.ts" ]]; then
|
||||||
|
echo "[exit] no files found."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
echo "[info] working on $i"
|
||||||
|
INFILE="$i"
|
||||||
|
echo "[debug] Infile: $INFILE"
|
||||||
|
OUTFILE="${i//.ts/.mkv}"
|
||||||
|
echo "[debug] Outfile: $OUTFILE"
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
INFILE2="${INFILE//\'/\'\\\\\\\'\'}"
|
||||||
|
/data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg \
|
||||||
|
-i "${INFILE}" \
|
||||||
|
-f lavfi -i movie="'${INFILE2}'[out+subcc]" \
|
||||||
|
-map 0 -map 1:s \
|
||||||
|
-codec:v libx264 \
|
||||||
|
-codec:a copy \
|
||||||
|
-codec:s srt \
|
||||||
|
-metadata:s:s:0 language=eng \
|
||||||
|
"${OUTFILE}"
|
||||||
|
|
||||||
|
exitcode="$?"
|
||||||
|
if [[ $exitcode -eq 0 ]]; then
|
||||||
|
rm -v "$INFILE"
|
||||||
|
else
|
||||||
|
echo "[error] PROBLEM FOUND IN $INFILE, moving on..."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "[info] no files found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$SAVEIFS
|
Loading…
Add table
Add a link
Reference in a new issue