Hi Folx.
Hm my old account don´t work. Created a new one.
I have a bigger update. I enhanced the Script.
The biggest news: Now you can encode with the Surcode DTS Encoder completely automatic. The script searches if the audio is dts and initiate the needed steps. Macros for the Mouse are managing the push of the needed buttons in Surcode DTS Encoder (which is completely GUI-Only .. suxx
)
You need this stuff:
- Wine (use Darwin Ports or search for a precompiled Package)
- eac3to (
http://forum.doom9.org/showthread.php?t=125966 )
- mediainfo CLI Version (
http://x7.to/hjb4w7 )
- mkvextract (
http://x7.to/tr77g2 )
- Surcode DTS Encoder DVD (look for it in the world wiiiiiiiide web (-; )
- For DTS-Encoding you need this too (
http://www.bluem.net/de/mac/cliclick/ ) .. copy this file at /opt/local/bin or if u want another path for this you must change the path in the surcode.sh too.
This 2 files you need to record again with Recorder (because you probably will have other coordinates of the buttons from Surcode Encoder (depends on the Display-Resolutionand place it inside the sabnzbd script folder too.
Ok now let´s show the updated script. U will need a 2nd script which depends on the first "big" script. Here is the big first.
Filename: As you want
Code: Select all
#!/bin/bash
################## Change to Unpack-Path ##################
base=`basename "$1"`
cd "$1"
###########################################################
######## Pathes to the needed Binaries (change this)#######
eac3to="/Users/luigi/.wine/drive_c/Programme/eac3to/eac3to.exe"
winebin="/opt/local/bin/wine"
mediainfo="/usr/local/bin/mediainfo"
mkvextract="/usr/local/bin/mkvextract"
surcode="/Volumes/TempI/Usenet/sabnzbd/scripts/"
###########################################################
################ Ignore upper and lowercase ###############
shopt -s nocaseglob
###########################################################
################## Scan every Sub-Folder ##################
find . -type d | while read VERZEICHNIS
do
cd "$VERZEICHNIS"
###########################################################
##### Decide if 25 FPS. If not … extract the MKV-File #####
for i in *.mkv; do
fps=`"$mediainfo" --Inform=Video\;%FrameRate% "$i"`
base=`basename "$i"`
if [ "$fps" = "25.000" ]; then
echo -e "\033[1;30mAlready 25 FPS\033[0m"
else
"$mediainfo" "$i" > "$base-info.txt"
"$mkvextract" tracks "$i" 1:video.264 2:1.ac3 3:2.ac3 4:3.ac3 5:4.ac3 6:5.ac3 7:8.ac3 8:9.ac3 9:10.ac3 10:11.ac3 11:12.ac3 12:13.ac3
fi
###########################################################
######### Recognize File-Type and rename suffix ###########
for t in *.ac3; do
type=$(head -n 1 "$t" | od -t x1 -An | tr -d '\n ' | cut -c 1-4)
if [ "$type" = "0b77" ]; then
echo ""
elif [ "$type" = "efbb" ]; then
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1srt/'`
elif [ "$type" = "fdd0" ]; then
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1mp_codec/'`
elif [ "$type" = "7ffe" ]; then
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1dts/'`
elif [ "$type" = "fe7f" ]; then
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1dts/'`
elif [ "$type" = "1fff" ]; then
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1dts/'`
elif [ "$type" = "ff1f" ]; then
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1dts/'`
else
mv $t `echo $t | sed 's/\(.*\.\)ac3/\1unknown/'`
fi
done
###########################################################
### Looking for the FPS and initiate the right speedup ####
if [ "$fps" = "23.976" ]; then
for a in *.ac3; do
if [ "$a" = "*.ac3" ]; then
echo "No AC3-File! Cancel AC3-Encoding."
else
echo "Found AC3-File. Start AC3-Encoding of" "$a"
"$winebin" "$eac3to" "$a" "$a-speedup.ac3" -speedup -keepDialnorm &
fi
done
for b in *.dts; do
if [ "$b" = "*.dts" ]; then
echo "No DTS-File. Cancel DTS-Encoding."
else
echo "Found DTS-File. Start DTS-Encoding of" "$b"
bit=`"$mediainfo" --Inform=Audio\;%BitRate% "$b"`
"$surcode"./surcode.sh &
if [ "$bit" -gt "900000" ]; then
"$winebin" "$eac3to" "$b" "$b-speedup.dts" -1536 -speedup -keepDialnorm
echo "Using 1536 to encode."
else
"$winebin" "$eac3to" "$b" "$b-speedup.dts" -768 -speedup -keepDialnorm
echo "Using 768 to encode."
fi
fi
done
elif [ "$fps" = "24.000" ]; then
for a in *.ac3; do
if [ "$a" = "*.ac3" ]; then
echo "No AC3-File! Cancel AC3-Encoding."
else
echo "Found AC3-File. Start AC3-Encoding of" "$a"
"$winebin" "$eac3to" "$a" "$a-speedup.ac3" -24.000 -speedup -keepDialnorm &
fi
done
for b in *.dts; do
if [ "$b" = "*.dts" ]; then
echo "No DTS-File. Cancel DTS-Encoding."
else
echo "Found DTS-File. Start DTS-Encoding of" "$b"
bit=`"$mediainfo" --Inform=Audio\;%BitRate% "$b"`
"$surcode"./surcode.sh &
if [ "$bit" -gt "900000" ]; then
"$winebin" "$eac3to" "$b" "$b-speedup.dts" -1536 -24.000 -speedup -keepDialnorm
echo "Using 1536 to encode."
else
"$winebin" "$eac3to" "$b" "$b-speedup.dts" -768 -24.000 -speedup -keepDialnorm
echo "Using 768 to encode."
fi
fi
done
elif [ "$fps" = "29.970" ]; then
for a in *.ac3; do
if [ "$a" = "*.ac3" ]; then
echo "No AC3-File! Cancel AC3-Encoding."
else
echo "Found AC3-File. Start AC3-Encoding of" "$a"
"$winebin" "$eac3to" "$a" "$a-speedup.ac3" -29.970 -changeTo30.000 -keepDialnorm &
fi
done
for b in *.dts; do
if [ "$b" = "*.dts" ]; then
echo "No DTS-File. Cancel DTS-Encoding."
else
echo "Found DTS-File. Start DTS-Encoding of" "$b"
bit=`"$mediainfo" --Inform=Audio\;%BitRate% "$b"`
"$surcode"./surcode.sh &
if [ "$bit" -gt "900000" ]; then
"$winebin" "$eac3to" "$b" "$b-speedup.dts" -1536 -29.970 -changeTo30.000 -keepDialnorm
echo "Using 1536 to encode."
else
"$winebin" "$eac3to" "$b" "$b-speedup.dts" -768 -29.970 -changeTo30.000 -keepDialnorm
echo "Using 768 to encode."
fi
fi
done
fi
rm *Log.txt*
###########################################################
done
cd -
done
Now the 2nd (new script for DTS-Encoding)
Filename MUST be "surcode.sh" and must be present in the sabnzbd script folder
Code: Select all
while [ true ]
do
run=`ps ax | grep "surcodedvd.exe" | grep -v grep`
if [ "$run" = "" ]; then
sleep 1
else
sleep 20
/opt/local/bin/cliclick 770 696
/opt/local/bin/cliclick 770 696
#open /Volumes/TempI/Usenet/sabnzbd/scripts/Start-Encoder.kamrd
sleep 5
while [ true ]
do
sleep 20
latest=`ls -1t *.dts|head -n1`
touch zeit
filetime=`perl -e '@d=localtime ((stat(shift))[9]); printf "%02d-%02d-%04d %02d:%02d:%02d\n", $d[3],$d[4]+1,$d[5]+190,$d[2],$d[1],$d[0]' "$latest" | cut -c 15-16`
systime=`perl -e '@d=localtime ((stat(shift))[9]); printf "%02d-%02d-%04d %02d:%02d:%02d\n", $d[3],$d[4]+1,$d[5]+190,$d[2],$d[1],$d[0]' zeit | cut -c 15-16`
if [ "$filetime" = "$systime" ]; then
sleep 1
else
rm zeit
pid=`ps -ef | grep -v grep | grep "libexec/wine/wine " | grep "surcodedvd.exe" | cut -c 7-12`
kill -TERM "$pid"
exit
fi
done
exit
fi
done
OK guys. I hope i could help a little bit. The Development of this thing needs a lot of hours. Have fun with that.
Test at what Coordinates your "Encode-Button" is. Press shift+cmd+4 and move the mouse in the middel of the Encode-Button of Surcode DTS and replace ist with my 770 696 in this script. 770x696 is at a Screen-Resolution of 1920x1080.