|
|
@ -18,8 +18,9 @@ workDIR="$PWD/transcode" |
|
|
|
function encode { |
|
|
|
local tmpFL=$1 |
|
|
|
local outFL=$2 |
|
|
|
ffmpeg -hide_banner -loglevel error -stats -re -i "$tmpFL" -map 0 -c copy \ |
|
|
|
-c:v libx265 -preset slow -x265-params crf=23 -map_metadata 0 \ |
|
|
|
ffmpeg -hide_banner -loglevel error -stats -re -i "$tmpFL" -map 0 \ |
|
|
|
-map_metadata 0 -c copy \ |
|
|
|
-c:v libx265 -preset slow -x265-params crf=23 \ |
|
|
|
-use_wallclock_as_timestamps 1 \ |
|
|
|
-map_chapters 0 -max_muxing_queue_size 9999 "$outFL" |
|
|
|
} |
|
|
@ -35,7 +36,6 @@ function burnSubs { |
|
|
|
rm "$inFL" #SAVE SPACE |
|
|
|
|
|
|
|
#EVIDTNELY NECESSARY SO THAT FILES AREN'T 198+ HRS IN LEN. AT THE END |
|
|
|
#(not that I'd complain abt 200+ hrs of Tanya [test file /shrug]) |
|
|
|
local DURATION=$( ffprobe -loglevel error -show_entries format=duration \ |
|
|
|
-of default=noprint_wrappers=1:nokey=1 "$tmpFL" ) |
|
|
|
|
|
|
@ -95,7 +95,7 @@ do |
|
|
|
#PULL DOWN FILE |
|
|
|
if [ $( echo "$HostName"|tr [a-z] [A-Z] ) != "LOCALHOST" ] |
|
|
|
then |
|
|
|
scp -T $HostName:"$( echo $filePATH | sed "s/[][!@#$%^&*( ;)]/\\\&/g" )" "$tmpDIR" |
|
|
|
scp $HostName:"$( echo $filePATH | sed "s/[][!@#$%^&*( ;)]/\\\&/g" )" "$tmpDIR" |
|
|
|
else |
|
|
|
rsync -a --progress "$filePATH" "$tmpDIR/" |
|
|
|
fi |
|
|
@ -132,7 +132,8 @@ do |
|
|
|
if [ $engCounter -lt 2 ] |
|
|
|
then |
|
|
|
#ONLY ONE ENG. SUB TRACK |
|
|
|
encode "$tmpDIR/$fileNAME" "$workDIR/$fileNAME" |
|
|
|
echo "ONE ENG. SUB TRACK" |
|
|
|
encode "$tmpDIR/$fileNAME" "$workDIR/$fileNAME" |
|
|
|
else |
|
|
|
#TEST SUBTITLE TYPE; IF NOT PGS SKIP IT; FEEL FREE TO FILL IN |
|
|
|
if grep -qi "pgs" <<< $( ffprobe -loglevel error -select_streams s \ |
|
|
@ -175,16 +176,15 @@ do |
|
|
|
let ++indexITER |
|
|
|
fi |
|
|
|
done |
|
|
|
unset SUBTITLEINDEX |
|
|
|
SUBTITLEINDEX=$(expr $minINDEX - ${streamNUMBERS[0]}) |
|
|
|
#TEST FRAMES IN SUB TRACK, IF < 50% MAX MOST LIKELY ISN'T FOR. AUD. |
|
|
|
currFrames=$( ffprobe -loglevel error -select_streams s:$SUBTITLEINDEX \ |
|
|
|
-show_entries stream_tags=NUMBER_OF_FRAMES-eng -of csv=p=0 \ |
|
|
|
"$tmpDIR/$fileNAME") |
|
|
|
if [ $( echo "($currFrames / $maxFrames) < 0.50"|bc ) ] |
|
|
|
if [ ! $( echo "($currFrames / $maxFrames) < 0.50"|bc -l ) ] |
|
|
|
then |
|
|
|
echo "BURNING STREAM $SUBTITLEINDEX (STREAM $minINDEX) from $fileNAME" |
|
|
|
#2 PASS 1ST ALTERS VIDEO 2ND DOES SUB BURNING yes this was done dumb |
|
|
|
#but in my defense I didn't know how to burn before this logic mess. |
|
|
|
burnSubs "$tmpDIR/$fileNAME" "$tmpDIR/TMP$fileNAME" "$workDIR/$fileNAME" $SUBTITLEINDEX |
|
|
|
else |
|
|
|
echo "MIN. SUB TRACK ($SUBTITLEINDEX [$minINDEX])) DUR. > 50% FILM, NOT BURNING" |
|
|
@ -225,7 +225,7 @@ do |
|
|
|
#UPLOAD AND REMOVE THE TRANSCODED FILE |
|
|
|
if [ $( echo "$HostName"|tr [a-z] [A-Z] ) != "LOCALHOST" ] |
|
|
|
then |
|
|
|
scp -T "$workDIR/$fileNAME" $HostName:"$( echo $filePATH | sed "s/[][!@#$%^&*( ;)]/\\\&/g" )" |
|
|
|
scp "$workDIR/$fileNAME" $HostName:"$( echo $filePATH | sed "s/[][!@#$%^&*( ;)]/\\\&/g" )" |
|
|
|
else |
|
|
|
rsync -a --progress "$workDIR/$fileNAME" "$filePATH" |
|
|
|
fi |
|
|
|