Page 4 of 9

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 3:01 pm
by sweetie
Ugh.

Comment out:

Code: Select all

for tmp in "mkvinfo.log" "tsMuxeR.log" "$inputbase.meta" "$inputbase.dts" "$inputbase.ac3"; do
[ -f "$tmp" ] || continue
rm -f "$tmp"; done
Run the script manually, (in download directory with MKV.)

Post the log files and the .meta file to pastebin and link here. We'll sort this tonight.

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 3:47 pm
by stabu
mkvinfo.log -http://pastebin.com/m190092a0

the.middle.s01e08.720p.hdtv.x264-2hd.meta - http://pastebin.com/m5aca4669

tsMuxeR.log is a empty file

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 3:56 pm
by sweetie
Oh. Seems tsMuxeR isn't installed then.

try:

Code: Select all

which tsMuxeR

Code: Select all

#!/bin/bash

cd "$1"

echo_process () { echo -e "\e[1;33m##\e[0;39;49m" "$1"; }
echo_prompt () { echo -e "\e[1;34m??\e[0;39;49m" "$1"; }
echo_success () { echo -e "\e[1;32m>>\e[0;39;49m" "$1"; }
echo_error () { echo -e "\e[1;31m@@\e[0;39;49m" "$1"; }

tsMuxeR=`which tsMuxeR`
CWD="${PWD##*/}"
SAVE_MUX_INPUT="0"

subfont="/usr/share/fonts/TTF/DejaVuSans.ttf"
if [ ! -f "$subfont" ]; then echo_error "Font '"$subfont"' not found. Exiting."; exit; fi

allmkv=`find -type f -name "*.mkv" | wc -l`

inputcount="0"
for input in *.mkv; do
if [ -f "$input" ]; then

((inputcount++))
inputfs=`stat -c %s "$input"`

inputbase="${input%.*}"
if [ "$inputfs" -gt "104857600" -a "$allmkv" -le "1" ]; then output="$CWD.m2ts"
elif [ "$inputfs" -lt "104857600" ]; then output="$CWD-Sample-$inputfs.m2ts"
elif [ "$inputfs" -gt "104857600" -a "$allmkv" -ge "2" ]; then output="$CWD-$inputcount.m2ts"; fi

mkvinfo "$input" > "mkvinfo.log"

lang=`grep -i "Track type: audio" -B2 -C12 "mkvinfo.log" | grep -ie "Language: \(und\|eng\|fre\|ger\|jpn\)" | head -n 1 | cut -d' ' -f5`

mpeg4_track=`grep -i "Codec ID: V_MPEG4/ISO/AVC" -B10 "mkvinfo.log" | grep -i "Track number:" | cut -d' ' -f6`

audio_codec=`grep -i "Track type: audio" -B2 -C9 "mkvinfo.log" | grep -ie "A_AC3\|A_DTS\|A_AAC\|A_MP3" | head -n 1 | cut -d' ' -f6`
audio_track=`grep -i "Codec ID: $audio_codec" -B10 -C3 "mkvinfo.log" | grep -i "Language: $lang" -B13 | grep -i "Track number:" | cut -d' ' -f6`

subs_track=`grep -i "S_TEXT/UTF8" -B10 -C3 "mkvinfo.log" | grep -i "Language: $lang" -B13  | grep -i "Track number:" | cut -d' ' -f6`


if [ "$mpeg4_track" -gt "0" ]; then echo "MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr" >> "$inputbase.meta"
echo "V_MPEG4/ISO/AVC, $input, level=4.1, insertSEI, contSPS, track=$mpeg4_track, lang=$lang" >> "$inputbase.meta"
else echo "Incompatible video codec found. Exiting."; exit; fi

 
if [ "$audio_codec" = "A_AC3" -o "$audio_codec" = "A_AAC" -o "$audio_codec" = "A_MP3" ]; then
	echo "$audio_codec, $input, track=$audio_track, lang=$lang" >> "$inputbase.meta"
elif [ "$audio_codec" = "A_DTS" ]; then
	mkvextract tracks "$input" "$audio_track":"$inputbase.dts"
	dcadec -o wavall "$inputbase.dts" | aften -v 0 -readtoeof 1 - "$inputbase.ac3"
	echo "A_AC3, $inputbase.ac3, track=$audio_track, lang=$lang" >> "$inputbase.meta"
else echo_error "Incomptible audio codec found. Exiting."; exit; fi

if [ "$subs_track" != "" ]; then if [ "$mpeg4_track" -lt "$audio_track" ]; then
fps=`grep "Frame rate" "mkvinfo.log" | sed -n 1p | cut -d'(' -f2 | cut -d' ' -f1`; else
fps=`grep "Frame rate" "mkvinfo.log" | sed -n 2p | cut -d'(' -f2 | cut -d' ' -f1`; fi
if [ "$fps" = "" ]; then fps="23.976"; fi ##this isn't ideal, though few releases contain fps field.
width=`grep "Pixel width:" "mkvinfo.log" | cut -d':' -f2 | tr -d ' '`
height=`grep "Pixel height:" "mkvinfo.log" | cut -d':' -f2 | tr -d ' '`
echo "S_TEXT/UTF8, "$input", font-name="$subfont", font-size="65", font-color="0x00ffffff", bottom-offset="24", font-border="2", text-align="center", video-width="$width", video-height="$height", fps="$fps", track="$subs_track", lang="$subs_lang"" >> "$inputbase.meta"
fi
	echo_process "Attempting to mux: $input"
	"$tsMuxeR" "$inputbase.meta" "$output" > "tsMuxeR.log"

	if grep -q "Mux successful complete." "tsMuxeR.log"; then echo_success "Mux successful complete."
	else echo_error "Error muxing: "$input""; exit; fi

	if [ "$SAVE_MUX_INPUT" = "0" ]; then rm -f "$input"; fi

	for tmp in "mkvinfo.log" "tsMuxeR.log" "$inputbase.meta" "$inputbase.dts" "$inputbase.ac3"; do
	[ -f "$tmp" ] || continue
	rm -f "$tmp"; done

else echo_error "No MKVs found. Unrared?"; fi

done

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:08 pm
by stabu
crc@slavebox:~/Files/Download/The.Middle.S01E08.720p.HDTV.x264-2HD$ which tsMuxeR
/usr/bin/tsMuxeR
crc@slavebox:~/Files/Download/The.Middle.S01E08.720p.HDTV.x264-2HD$

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:13 pm
by sweetie
Try the script above, it should point to that file now.

try 'tsMuxeR' in terminal, should give:
SmartLabs tsMuxeR.  Version 1.10.6  http://www.smlabs.net
Usage:
For start muxing: tsMuxeR
For detect stream params: tsMuxeR
For more information about meta file see readme.txt

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:19 pm
by stabu
hrmm take it i  didnt install it right

crc@slavebox:~/Files/Download/The.Middle.S01E08.720p.HDTV.x264-2HD$ tsMuxeR
crc@slavebox:~/Files/Download/The.Middle.S01E08.720p.HDTV.x264-2HD$

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:20 pm
by sweetie
try:

Code: Select all

chmod +x /usr/bin/tsMuxeR

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:23 pm
by stabu
stll dont get tsmuxer program info

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:25 pm
by sweetie
Does:

Code: Select all

/usr/bin/tsMuxeR
run alright?

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:26 pm
by stabu
crc@slavebox:~/Files/Download/The.Middle.S01E08.720p.HDTV.x264-2HD$ /usr/bin/tsMuxeR
crc@slavebox:~/Files/Download/The.Middle.S01E08.720p.HDTV.x264-2HD$

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:28 pm
by sweetie
Try instructions from OP:

Code: Select all

wget http://www.smlabs.net/tsMuxer/tsMuxeR_1.10.6.tar.gz
tar -xf tsMuxeR_1.10.6.tar.gz
mv -fv tsMuxeR /usr/bin
rm -f tsMuxeR_1.10.6.tar.gz tsMuxeRGUI readme.rus.txt license.txt

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:31 pm
by stabu
crc@slavebox:~$ wget http://www.smlabs.net/tsMuxer/tsMuxeR_1.10.6.tar.gz
--2009-11-25 16:24:38--  http://www.smlabs.net/tsMuxer/tsMuxeR_1.10.6.tar.gz
Resolving www.smlabs.net... 69.163.135.139
Connecting to www.smlabs.net|69.163.135.139|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5489146 (5.2M) [application/x-tar]
Saving to: `tsMuxeR_1.10.6.tar.gz'

100%[======================================>] 5,489,146    339K/s  in 13s   

2009-11-25 16:24:51 (427 KB/s) - `tsMuxeR_1.10.6.tar.gz' saved [5489146/5489146]

crc@slavebox:~$ tar -xf tsMuxeR_1.10.6.tar.gz
crc@slavebox:~$ mv -fv tsMuxeR /usr/bin
`tsMuxeR' -> `/usr/bin/tsMuxeR'
mv: cannot move `tsMuxeR' to `/usr/bin/tsMuxeR': Permission denied
crc@slavebox:~$ sudo mv -fv tsMuxeR /usr/bin
`tsMuxeR' -> `/usr/bin/tsMuxeR'
crc@slavebox:~$ rm -f tsMuxeR_1.10.6.tar.gz tsMuxeRGUI readme.rus.txt license.txt
crc@slavebox:~$ tsMuxeR
crc@slavebox:~$

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:35 pm
by sweetie
The version posted before (the oither topic) worked before right?

Don't understand why it won't run.

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 4:42 pm
by sweetie
Try Windows build with WINE:

Code: Select all

wget http://www.smlabs.net/tsMuxer/tsMuxeR_shared_1.10.6.zip
unzip tsMuxeR_shared_1.10.6.zip
mv -fv tsMuxeR.exe /usr/bin
rm -f tsMuxeR_shared_1.10.6.zip tsMuxeRGUI.exe readme.rus.txt license.txt

Code: Select all

#!/bin/bash

cd "$1"

echo_process () { echo -e "\e[1;33m##\e[0;39;49m" "$1"; }
echo_prompt () { echo -e "\e[1;34m??\e[0;39;49m" "$1"; }
echo_success () { echo -e "\e[1;32m>>\e[0;39;49m" "$1"; }
echo_error () { echo -e "\e[1;31m@@\e[0;39;49m" "$1"; }

tsMuxeR="wine /usr/bin/tsMuxeR.exe"
CWD="${PWD##*/}"
SAVE_MUX_INPUT="0"

subfont="/usr/share/fonts/TTF/DejaVuSans.ttf"
if [ ! -f "$subfont" ]; then echo_error "Font '"$subfont"' not found. Exiting."; exit; fi

allmkv=`find -type f -name "*.mkv" | wc -l`

inputcount="0"
for input in *.mkv; do
if [ -f "$input" ]; then

((inputcount++))
inputfs=`stat -c %s "$input"`

inputbase="${input%.*}"
if [ "$inputfs" -gt "104857600" -a "$allmkv" -le "1" ]; then output="$CWD.m2ts"
elif [ "$inputfs" -lt "104857600" ]; then output="$CWD-Sample-$inputfs.m2ts"
elif [ "$inputfs" -gt "104857600" -a "$allmkv" -ge "2" ]; then output="$CWD-$inputcount.m2ts"; fi

mkvinfo "$input" > "mkvinfo.log"

lang=`grep -i "Track type: audio" -B2 -C12 "mkvinfo.log" | grep -ie "Language: \(und\|eng\|fre\|ger\|jpn\)" | head -n 1 | cut -d' ' -f5`

mpeg4_track=`grep -i "Codec ID: V_MPEG4/ISO/AVC" -B10 "mkvinfo.log" | grep -i "Track number:" | cut -d' ' -f6`

audio_codec=`grep -i "Track type: audio" -B2 -C9 "mkvinfo.log" | grep -ie "A_AC3\|A_DTS\|A_AAC\|A_MP3" | head -n 1 | cut -d' ' -f6`
audio_track=`grep -i "Codec ID: $audio_codec" -B10 -C3 "mkvinfo.log" | grep -i "Language: $lang" -B13 | grep -i "Track number:" | cut -d' ' -f6`

subs_track=`grep -i "S_TEXT/UTF8" -B10 -C3 "mkvinfo.log" | grep -i "Language: $lang" -B13  | grep -i "Track number:" | cut -d' ' -f6`


if [ "$mpeg4_track" -gt "0" ]; then echo "MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr" >> "$inputbase.meta"
echo "V_MPEG4/ISO/AVC, $input, level=4.1, insertSEI, contSPS, track=$mpeg4_track, lang=$lang" >> "$inputbase.meta"
else echo "Incompatible video codec found. Exiting."; exit; fi

 
if [ "$audio_codec" = "A_AC3" -o "$audio_codec" = "A_AAC" -o "$audio_codec" = "A_MP3" ]; then
	echo "$audio_codec, $input, track=$audio_track, lang=$lang" >> "$inputbase.meta"
elif [ "$audio_codec" = "A_DTS" ]; then
	mkvextract tracks "$input" "$audio_track":"$inputbase.dts"
	dcadec -o wavall "$inputbase.dts" | aften -v 0 -readtoeof 1 - "$inputbase.ac3"
	echo "A_AC3, $inputbase.ac3, track=$audio_track, lang=$lang" >> "$inputbase.meta"
else echo_error "Incomptible audio codec found. Exiting."; exit; fi

if [ "$subs_track" != "" ]; then if [ "$mpeg4_track" -lt "$audio_track" ]; then
fps=`grep "Frame rate" "mkvinfo.log" | sed -n 1p | cut -d'(' -f2 | cut -d' ' -f1`; else
fps=`grep "Frame rate" "mkvinfo.log" | sed -n 2p | cut -d'(' -f2 | cut -d' ' -f1`; fi
if [ "$fps" = "" ]; then fps="23.976"; fi ##this isn't ideal, though few releases contain fps field.
width=`grep "Pixel width:" "mkvinfo.log" | cut -d':' -f2 | tr -d ' '`
height=`grep "Pixel height:" "mkvinfo.log" | cut -d':' -f2 | tr -d ' '`
echo "S_TEXT/UTF8, "$input", font-name="$subfont", font-size="65", font-color="0x00ffffff", bottom-offset="24", font-border="2", text-align="center", video-width="$width", video-height="$height", fps="$fps", track="$subs_track", lang="$subs_lang"" >> "$inputbase.meta"
fi
	echo_process "Attempting to mux: $input"
	"$tsMuxeR" "$inputbase.meta" "$output" > "tsMuxeR.log"

	if grep -q "Mux successful complete." "tsMuxeR.log"; then echo_success "Mux successful complete."
	else echo_error "Error muxing: "$input""; exit; fi

	if [ "$SAVE_MUX_INPUT" = "0" ]; then rm -f "$input"; fi

	for tmp in "mkvinfo.log" "tsMuxeR.log" "$inputbase.meta" "$inputbase.dts" "$inputbase.ac3"; do
	[ -f "$tmp" ] || continue
	rm -f "$tmp"; done

else echo_error "No MKVs found. Unrared?"; fi

done

Re: [Linux/OSX - Bash] scenesort script. [v3 - AIO post-post-processor.]

Posted: November 25th, 2009, 5:17 pm
by stabu
yeah everything worked the old way you had setup but i did reformat so who knows.