1#!/usr/local/bin/bash 2# 3# mkxvcd version: 2.0.2 4# 5# Usage: mkxvcd movieyouwanttoconvert.whateverextensionmplayercanread 6# 7# Instalation: make this script executeable (chmod 755) and place it in your path. 8# 9# This script is for creating a kvcd mpeg1 video-cd to fit up to 2 hours of movie on a 80 min. cdr. 10# If your movie is longer as that it will be split over more cdr's. 11# The tools used for this are minimal mplayer-0.9.x and mjpegtools-1.6.0 and optionaly mpgtx. 12# The actual video is a (almost) standard vcd pal one, only with vbr instead of cbr, and adapted the gop and video buffer size 13# and using the kvcd intra and non-intra matrixes if available in mjpegtools version. 14# Furthermore I adapted the audio bitrate to sqeeze the size a bit more. 15# BTW, a 80 min. cdr can contain 807,5Mb. of video... So don't be fooled with the 700 Mb. printed on it! 16# Info: 17# http://www.kvcd.net 18# http://www.mplayerhq.hu 19# http://mjpeg.sourceforge.net 20# http://mpgtx.sourceforge.net 21# http://zebra.fh-weingarten.de/~transcode 22# 23# Script written by Thomas, use and adapt as you please ;-) 24# Codec config by Japie, you may also use and adapt them too! 25# 26# thnx2: Karl,Hunter,Alex,Ted,Manuel,Mike and Nicolas. 27 28# localisation settings will make the script fail 29LANG=en_US 30LC_ALL=en_US 31export LANG LC_ALL 32 33################################################# 34# User settings # 35################################################# 36MPLAYER=1 # Set to 0 if you want transcode as default 37bypass_fullscreen=1 # ByPass fullscreen prompt 38Log=1 # 0 For Removal of Log, 1 to Keep Stats Log 39log_cmds=0 # 1 Log Command line to stats file 40dvd_a_delay="--dvd_access_delay 3" # Make number larger if you have a slow drive 41mode288=0 # Make all encoding to the Pal Standard. 42modedashZ=1 # 1 for Lanczos3 resize (SLOW) 43Fast=1 # 0 for Lanczos3 Resize, 1 for New Fast Resize Transcode 0.6.11 or newer 44mode528=0 # 0 for 352x240/288, 1 for 528x480 45modestandard=0 # 1 for VCD, SVCD mode Options. # 0 for KVCD only Mode 46mod_quant_vcdbitrate=0 # Modify Quantisation and Max_bitrate before Conversion 47audio_compat=0 # For the DvD players out there that seems to skip or start and stop Set this to 1 48 # This Seems to help on my JVC DvD Player 49 # What setting this to 1 does is uses Transcode for Audio when using Mplayer Mode. 50 # 51preview=0 # Set to 1 for PreView of Video via Mplayer 52nice_level=10 # Nice Level to run Programs at. 53alt_scale=0 # Use y4mscaler instead of yuvscaler Mplayer Mode only. 54advanced=0 # Set to 1 to get Prompted for Wide Screen or 0 for Default by source aspect 55cpus="-M 1" # Sets Multi-Threading for mpeg2enc [0..32], 0=no multithreading, (default: 1) 56# 57# 58################################################# 59 60# System settings... 61MkxVcd_Version="Mkxvcd-2.0.2" 62started=`date +%s` 63max_bitrate=1152 64quantisation=4 65video_buffer=40 66gopmin_size=6 67gopmax_size=18 68audio_bitrate=112 69RATIO=RESAMPLE 70Format=n 71aspect=2 72dashy="-Y 0,0,0,0" 73mpeg_type=2 74altfps=0 75dashx= 76dashj= 77dashs="-s 1.234" 78export= 79cflag=0 80mpgtxflag=0 81dvdcd=0 82dashm="-M 0" 83dashd= 84dashD= 85dashJ="-J " 86dasht= 87dashh= 88dasha= 89dvd_aspect=0 90subs= 91vop= 92export_aspect="--export_asr 2" 93aspect_flag=1 94angles=0 95dashE= 96dashR= 97dashV="-V" 98dashZ= 99pulld= 100wflag=0 101matrices= 102output_size="795" 103dashP= #"-P" #Preserve two B frames between I/P frames when placing GOP boundaries 104p_aspect= 105wide_flag=0 106filters=32detect=force_mode=3 107movie_aspect="0" 108dashaf= #"-af volume=-20" 109norm=NTSC 110present=vcd 111mdashD= 112 113# Colors 114black='\E[30;47m' 115red='\E[31;47m' 116green='\E[32;47m' 117yellow='\E[33;47m' 118blue='\E[34;47m' 119magenta='\E[35;47m' 120cyan='\E[36;47m' 121white='\E[37;47m' 122reset="tput sgr0" 123 124# Quantisation & Max_Bitrate Function 125select_quant () 126{ 127# Ogm Files have no length... 128 if [ $total -eq '0' ]; then 129 total=85 130 max_bitrate=1500 131 fi 132# Aspects 2 = WideScreen 133 if [ $Aspects -eq '2' ]; then 134# encoder settings for WideScreen... 135 if [ $total -gt '60' ]; then 136 quantisation=3 137 max_bitrate=1500 138 fi 139 if [ $total -gt '75' ]; then 140 quantisation=3 141 max_bitrate=1500 142 fi 143 if [ $total -gt '90' ]; then 144 quantisation=4 145 max_bitrate=1500 146 fi 147 if [ $total -gt '105' ]; then 148 quantisation=3 149 max_bitrate=1152 150 fi 151 fi 152 153 if [ $Aspects -eq '1' ]; then 154# encoder settings for FullScreen... 155 if [ $total -gt '60' ]; then 156 quantisation=4 157 max_bitrate=2400 158 fi 159 if [ $total -gt '75' ]; then 160 quantisation=4 161 max_bitrate=1500 162 fi 163 if [ $total -gt '90' ]; then 164 quantisation=3 165 max_bitrate=1152 166 fi 167 if [ $total -gt '105' ]; then 168 quantisation=6 169 max_bitrate=2400 170 fi 171 fi 172} 173 174videotype () 175{ 176 echo "" 177 if [ $mjpeg_version -gt '16190' -o $mjpeg_version -eq '16190' ]; then 178 matrices="-K kvcd" 179 else 180 matrices="-N -h" 181 fi 182 if [ $modestandard -eq '1' ]; then 183 select_vid_type=" Select Output Type (vcd/svcd/xvcd/kvcd/tmpgenc/hi-res) Default is "$red"kvcd " 184 echo -e -n "$select_vid_type" 185 $reset 186 read line 187 188 case $line in 189 'VCD') output_type="VCD" 190 audio_bitrate=224 191 mpeg_type=1 ;; 192 'vcd') output_type="VCD" 193 audio_bitrate=224 194 mpeg_type=1 ;; 195 'SVCD') output_type="SVCD" 196 vop="-vf scale=480:460,expand=480:480" 197 SIZE=SIZE_480x480 198 present=svcd 199 mpeg_type=5 ;; 200 'svcd') output_type="SVCD" 201 vop="-vf scale=480:460,expand=480:480" 202 SIZE=SIZE_480x480 203 present=svcd 204 mpeg_type=5 ;; 205 'KVCD') output_type="KVCD" 206 mpeg_type=2 ;; 207 'kvcd') output_type="KVCD" 208 mpeg_type=2 ;; 209 'xvcd') output_type="XVCD" 210 mpeg_type=2 211 matrices="-N -h" ;; 212 'XVCD') output_type="XVCD" 213 mpeg_type=2 214 matrices="-N -h" ;; 215 'TMPGENC') output_type="TMPGENC" 216 mpeg_type=2 217 matrices="-K tmpgenc" ;; 218 'tmpgenc') output_type="TMPGENC" 219 mpeg_type=2 220 matrices="-K tmpgenc" ;; 221 'hi-res') output_type="HI-RES" 222 mpeg_type=2 223 matrices="-K hi-res" ;; 224 'HI-RES') output_type="HI-RES" 225 mpeg_type=2 226 matrices="-K hi-res" ;; 227 *) output_type="KVCD" 228 mpeg_type=2 ;; 229 esac # 230 fi 231} 232 233crop_detect () 234{ 235 if [ $dvdcd -eq '0' ]; then 236 FILE="$FILE" 237 else 238 FILE=$FILE1 239 ext2=".vob" 240 fi 241 if [ $mplayerv1 -eq '0' ]; then 242 cropd="-vop cropdetect" 243 else 244 cropd="-vf cropdetect" 245 fi 246 if [ $ext2 == ".ogm" -o $ext2 == ".Ogm" -o $ext2 == ".OGM" ]; then 247mplayer -really-quiet -nosound -forceidx -vo null $cropd "$FILE" -frames 10 -sstep 10 -nocache > mplayer.info 248 else 249mplayer -really-quiet $cropd "$FILE" -nosound -vo null -frames 30 -sstep 202 -nocache > mplayer.info 250 fi 251 if [ $ext2 == ".vob" -o $ext2 == ".VOB" ]; then 252mplayer -really-quiet $cropd "$FILE" -nosound -frames 30 -sstep 102 -nocache > mplayer.info 253 fi 254 while read line; do 255 if [ "$line" != "${line#crop}" ]; then 256 vopc=${line#crop} 257 vopc=`echo $vopc | awk '{print $7}'` 258 vopc=`echo $vopc | sed 's/[(]//g' | sed 's/[)]//g'` 259 fi 260 done < mplayer.info 261 rm -f mplayer.info 262 if [ $vopc ]; then 263 scale1=`echo $vopc | awk -F : '{print $1":"$2}' | awk -F = '{print $2}'` 264 scale2=`echo $scale1 | grep "^-"` 265 if [ $scale2 ]; then 266 echo 267 vopc= 268 else 269 width_orig1=`echo $scale1 | awk -F : '{print $1}'` 270 height_orig1=`echo $scale1 | awk -F : '{print $2}'` 271 if [ $width -gt $width_orig1 -o $height -gt $height_orig1 ]; then 272 width=$width_orig1 273 height=$height_orig1 274 width_orig=$width_orig1 275 height_orig=$height_orig1 276 vopc="$vopc," 277 else 278 vopc= 279 fi 280 fi 281 fi 282} 283 284calctype () 285{ 286 287 height1=$[height_orig /8] 288 height1=$[height1 * 8] 289 height1=$[height_orig - $height1 ] 290 j1=$[height1 /2] 291 if [ $j1 -gt '0' -a $framerate -ne '25' ]; then 292 dashj="-j $j1,0,$j1,0" 293 fi 294 if [ $Aspects -eq '1' ]; then 295 b1=$[height-240] 296 dashy=$dashy 297 fi 298 if [ $Aspects -eq '2' -a $dvdcd -eq '1' ]; then 299 b1=$[height-240] 300 dashy="-Y 0,0,0,0" 301 export_aspect="--export_asr 3" 302 aspect_flag=2 303 fi 304 305 if [ $Aspects -eq '2' -a $dvdcd -eq '0' -a $vflag -gt '0' ]; then 306 b1=$[height-160] 307 dashy="-Y -40,0,-40,0" 308 export_aspect="--export_asr 2" 309 aspect_flag=1 310 fi 311 if [ $wide_flag -ne '1' ]; then 312select_wide 313 fi 314 b1=$[b1/8] 315 b2=$[width-352] 316 b2=$[b2/8] 317 dashB="-B $b1,$b2,8" 318 319 if [ $mode288 -eq '1' -a $Aspects -eq '2' -a $dvdcd -eq '0' -a $framerate -ne '25' ]; then 320 b1=$[height_orig-165] 321 dashy="-Y -68,0,-68,0" 322 SIZE=SIZE_352x288 323 if [ $modedashZ -eq '1' ]; then 324 dashy= 325 dashB= 326 if [ $mode528 -eq '1' ]; then 327 dashZ="-Z 528x400" 328 dashy="-Y -64,0,-64,0" 329 else 330 dashZ="-Z 352x200" 331 dashy="-Y -20,0,-20,0" 332 fi 333 fi 334 fi 335 336 if [ $modedashZ -eq '1' -a $mode288 -ne '1' -a $Aspects -eq '2' -a $dvdcd -eq '0' -a $framerate -ne '25' ]; then 337 dashy= 338 dashB= 339 if [ $mode528 -eq '1' -a $modedashZ -eq '1' ]; then 340 dashZ="-Z 528x400" 341 dashy="-Y -40,0,-40,0" 342 fi 343 if [ $mode528 -eq '0' -a $modedashZ -eq '1' ]; then 344 dashZ="-Z 352x240" 345 dashy="-Y 0,0,0,0" 346 fi 347 fi 348 if [ $modedashZ -eq '1' -a $mode288 -ne '1' -a $Aspects -eq '1' -a $dvdcd -eq '0' -a $framerate -ne '25' ]; then 349 dashy= 350 dashB= 351 if [ $mode528 -eq '1' ]; then 352 dashZ="-Z 528x480" 353 dashy= 354 else 355 if [ $altfps -eq '23' ]; then 356 dashZ="-Z 352x240" 357 dashy="-Y 0,0,0,0" 358 else 359 dashZ="-Z 352x240" 360 dashy="-Y 0,0,0,0" 361 fi 362 fi 363 fi 364 365 if [ $height_orig -lt '240' -a $modedashZ -ne '1' ]; then 366 dashy= 367 dashB= 368 alheight=$[240-$height_orig] 369 p1=$[alheight/2] 370 dashZ="-Z 352x$alheight" 371 dashy="-Y -$p1,0,-$p1,0" 372 dv=`echo "scale=1 ; ($alheight/4)"| bc -l` 373 dv=`echo $dv | awk -F . '{print $2}'` 374 if [ $dv -ne '0' ]; then 375 alheight=$[height_orig+2] 376 dashZ="-Z 352x$alheight" 377 p1=$[240-$alheight] 378 p1=$[p1/2] 379 dashy="-Y -$p1,0,-$p1,0" 380 fi 381 fi 382 383# format settings for pal or ntsc... 384 if [ "`expr $framerate`" -eq '29' ]; then 385 fps=4 386 gopmax_size=30 387 fi 388 if [ "`expr $framerate`" -eq '30' ]; then 389 fps=5 390 fi 391 if [ "`expr $framerate`" -eq '25' ]; then 392 fps=3 393 gopmax_size=25 394 Format=p 395 norm=PAL 396 if [ $mpeg_type -eq '5' ]; then 397 SIZE=SIZE_480x576 398 if [ $Aspects -eq '1' ]; then 399 vop="-vf scale=480:536,expand=480:576" 400 asp=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 401 p_aspect="-aspect $asp" 402 else 403 vop="-vf scale=480:496,expand=480:576" 404 asp=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 405 p_aspect="-aspect $asp" 406 fi 407 else 408 SIZE=SIZE_352x288 409 fi 410 height1=$[height_orig /8] 411 height1=$[height1 * 8] 412 height1=$[height_orig - $height1 ] 413 j1=$[height1 /2] 414 if [ $j1 -gt '0' ]; then 415 dashj="-j $j1,0,$j1,0" 416 fi 417 if [ $Aspects -eq '1' ]; then 418 b1=$[height-288] 419 dashy="-Y 0,0,0,0" 420 fi 421 if [ $Aspects -eq '2' -a $dvdcd -eq '1' ]; then 422 b1=$[height-288] 423 dashy="-Y 0,0,0,0" 424 export_aspect="--export_asr 3" 425 aspect_flag=2 426 fi 427 if [ $Aspects -eq '2' -a $dvdcd -eq '0' -a $vflag -eq '1' ]; then 428 b1=$[height-176] 429 dashy="-Y -56,0,-56,0" 430 export_aspect="--export_asr 2" 431 aspect_flag=1 432 fi 433 434 if [ $wide_flag -ne '1' ]; then 435select_wide 436 fi 437 if [ $vflag -eq '2' ]; then 438 b1=$[height-176] 439 aspect=2 440 dashy="-Y -56,0,-56,0" 441 fi 442 b1=$[b1/8] 443 b2=$[width-352] 444 b2=$[b2/8] 445 dashB="-B $b1,$b2,8" 446 447 if [ $height -lt '288' ]; then 448 dashy= 449 dashB= 450 alheight=$[288-$height_orig] 451 p1=$[alheight/2] 452 dashZ="-Z 352x$alheight" 453 dashy="-Y -$p1,0,-$p1,0" 454 dv=`echo "scale=1 ; ($alheight/4)"| bc -l` 455 dv=`echo $dv | awk -F . '{print $2}'` 456 if [ $dv -ne '0' ]; then 457 alheight=$[height_orig+2] 458 dashZ="-Z 352x$alheight" 459 p1=$[288-$alheight] 460 p1=$[p1/2] 461 dashy="-Y -$p1,0,-$p1,0" 462 fi 463 fi 464 if [ $modedashZ -eq '1' -a $Aspects -eq '2' ]; then 465 dashB= 466 dashZ="-Z 352x208" 467 dashy="-Y -40,0,-40,0" 468 469 fi 470 if [ $modedashZ -eq '1' -a $Aspects -eq '1' ]; then 471 dashB= 472 dashZ="-Z 352x248" 473 dashy="-Y -20,0,-20,0" 474 fi 475 if [ $modedashZ -eq '1' -a $vflag -eq '1' ]; then 476 dashB= 477 dashZ="-Z 352x248" 478 dashy="-Y -20,0,-20,0" 479 fi 480 481 fi 482 483 if [ "`expr $framerate`" -eq '24' ]; then 484 fps=2 485 gopmax_size=24 486 fi 487 if [ "`expr $framerate`" -eq '23' ]; then 488 fps=1 489 gopmax_size=24 490 if [ $mpeg_type -eq '5' -a $MPLAYER -eq '0' ]; then 491 pulld="--pulldown" 492 dashD="-d" 493 fi 494 if [ $mpeg_type -eq '5' -a $MPLAYER -eq '1' ]; then 495 pulld="-p -d" 496 fi 497 fi 498 if [ "`expr $framerate`" -eq '69' -o $altfps -ne '0' ]; then 499 framerate="23" 500 framerate_orig="23.976" 501 fps=1 502 gopmax_size=24 503 ivtc="-vf pp=fd:c,pp=tn:64:128:256" 504 filters=$filter4 505 fi 506 if [ $mode528 -eq '1' -a $modedashZ -eq '1' -a $vflag -ne '1' -a $framerate -ne '25' ]; then 507 dashZ="-Z 528x400" 508 dashy="-Y -40,0,-40,0" 509 fi 510 if [ $mode528 -eq '0' -a $modedashZ -eq '1' -a $vflag -ne '1' -a $framerate -ne '25' -a $Aspects -eq '2' -a $dvdcd -eq '0' ]; then 511 dashZ="-Z 352x200" 512 dashy="-Y -20,0,-20,0" 513 fi 514 if [ $mode528 -eq '0' -a $modedashZ -eq '1' -a $vflag -ne '1' -a $framerate -ne '25' -a $Aspects -eq '1' ]; then 515 dashZ="-Z 352x240" 516 dashy="-Y 0,0,0,0" 517 fi 518 if [ $mode288 -eq 1 ]; then 519 if [ $mode528 -eq '1' -a $modedashZ -eq '1' -a $vflag -ne '1' -a $framerate -ne '25' ]; then 520 dashZ="-Z 528x400" 521 dashy="-Y -64,0,-64,0" 522 fi 523 524 fi 525 526 if [ $dvdcd -eq '1' -o $modedashZ -eq '1' ]; then 527 if [ $mode528 -eq '1' -a $modedashZ -eq '1' -a $vflag -ne '1' -a $framerate -ne '25' ]; then 528 dashZ="-Z 528x480" 529 dashy= 530 fi 531 fi 532 533 if [ $width_orig -lt '352' -a $modedashZ -ne '1' ]; then 534 dashB="-B $b1,0,8" 535 width1=$[352-$width_orig] 536 j1=$[width1 /2] 537 if [ $j1 -gt '0' -a $framerate -ne '25' ]; then 538 dashj="-j 0,-$j1,0,-$j1" 539 fi 540 fi 541# SVCD Mode 542 if [ $mpeg_type -eq '5' -a $framerate -ne '25' ]; then 543 modedashZ=1 544 if [ $vflag -eq '1' ]; then 545 dashZ="-Z 480x400" 546 dashy="-Y -40,0,-40,0" 547 fi 548 if [ $wflag -eq '1' ]; then 549 dashZ="-Z 480x400" 550 dashy="-Y -40,0,-40,0" 551 else 552 dashZ="-Z 480x460" 553 dashy="-Y -10,0,-10,0" 554 fi 555 fi 556 if [ $mpeg_type -eq '5' -a $framerate -eq '25' ]; then 557 modedashZ=1 558 pulld= 559 if [ $vflag -eq '1' ]; then 560 dashZ="-Z 480x576" 561 dashy= 562 fi 563 if [ $wflag -eq '1' ]; then 564 dashZ="-Z 480x500" 565 dashy="-Y -38,0,-38,0" 566 else 567 dashZ="-Z 480x576" 568 dashy= 569 fi 570 fi 571# End SVCD Mode 572 if [ $modedashZ -eq '1' ]; then 573 dashB= 574 fi 575} 576 577# Transcode Coversion to 23.976 fps Function 578convert () 579{ 580 if [ $altfps -ne '23' -a $mpeg_type -ne '5' ]; then 581 echo " Current FPS is $framerate_orig " 582 FPS_PROMPT='Do you wish to convert to 23.98 fps Format? (y/n)' 583 584 echo -n "$FPS_PROMPT" 585 read line 586 587 case $line in 588 'y') 589 590 height1=$[height /8] 591 height=$[height1 * 8] 592 593 if [ $Aspects -eq '1' ]; then 594 b1=$[height-240] 595 b1=$[b1/8] 596 b2=$[width-352] 597 b2=$[b2/8] 598 dashB="-B $b1,$b2,8" 599 dashy="-Y 0,0,0,0" 600 fi 601 if [ $Aspects -eq '2' -a $dvdcd -eq '1' ]; then 602 b1=$[height-240] 603 b1=$[b1/8] 604 b2=$[width-352] 605 b2=$[b2/8] 606 dashB="-B $b1,$b2,8" 607 dashy="-Y 0,0,0,0" 608 fi 609 if [ $Aspects -eq '2' -a $dvdcd -eq '0' ]; then 610 b1=$[height-160] 611 b1=$[b1/8] 612 b2=$[width-352] 613 b2=$[b2/8] 614 dashB="-B $b1,$b2,8" 615 dashy="-Y -40,0,-40,0" 616 fi 617 cflag=1 618 export="--export_fps 23.98" 619 Format=n ;; 620 'Y') 621 622 height1=$[height /8] 623 height=$[height1 * 8] 624 625 if [ $Aspects -eq '1' ]; then 626 b1=$[height-240] 627 b1=$[b1/8] 628 b2=$[width-352] 629 b2=$[b2/8] 630 dashB="-B $b1,$b2,8" 631 dashy="-Y 0,0,0,0" 632 fi 633 if [ $Aspects -eq '2' -a $dvdcd -eq '1' ]; then 634 b1=$[height-240] 635 b1=$[b1/8] 636 b2=$[width-352] 637 b2=$[b2/8] 638 dashB="-B $b1,$b2,8" 639 dashy="-Y 0,0,0,0" 640 fi 641 if [ $Aspects -eq '2' -a $dvdcd -eq '0' ]; then 642 b1=$[height-160] 643 b1=$[b1/8] 644 b2=$[width-352] 645 b2=$[b2/8] 646 dashB="-B $b1,$b2,8" 647 dashy="-Y -40,0,-40,0" 648 fi 649 cflag=1 650 export="--export_fps 23.98" 651 Format=n ;; 652 'n') cflag=0 653 Mode= ;; 654 'N') cflag=0 655 Mode= ;; 656 *) cflag=0 657 Mode= ;; 658 esac # 659 660 if [ $height -lt '240' ]; then 661 dashy= 662 dashB= 663 alheight=$[240-$height_orig] 664 p1=$[alheight/2] 665 dashZ="-Z 352x$alheight" 666 dashy="-Y -$p1,0,-$p1,0" 667 dv=`echo "scale=1 ; ($alheight/4)"| bc -l` 668 dv=`echo $dv | awk -F . '{print $2}'` 669 670 if [ $dv -ne '0' ]; then 671 alheight=$[height_orig+2] 672 dashZ="-Z 352x$alheight" 673 p1=$[240-$alheight] 674 p1=$[p1/2] 675 dashy="-Y -$p1,0,-$p1,0" 676 fi 677 fi 678 fi 679} 680 681# Command Lines 682 683cmds () 684{ 685 686 filter1=modfps=mode=1 687 filter2=dnr 688 filter3=32detect=force_mode=3 689 filter4=ivtc 690 filter5=denoise3d=luma=-1 691 692 mjpeg2enc1="cat stream.yuv " 693 if [ $alt_scale -eq '1' ]; then 694 mjpeg2enc2="nice -n $nice_level y4mscaler -v 0 -S option=box -I norm=$norm -I sar=$norm -O preset=$present" 695 else 696 mjpeg2enc2="nice -n $nice_level yuvscaler -M $RATIO -v 0 -n $Format " 697 fi 698 mjpeg2enc3="nice -n $nice_level mpeg2enc -S 10000 -v 0 -f $mpeg_type $matrices -b $max_bitrate \ 699 $Quantisation -V $video_buffer -n $Format -F $fps -a $aspect \ 700 -g $gopmin_size -G $gopmax_size $pulld $dashP $dashE -d $cpus $mdashD -o $FILE2.$mpeg_extention " 701 702 mp2enc1="cat stream.pcm " 703 mp2enc2="nice -n $nice_level mp2enc -v 0 -b $audio_bitrate -r 44100 -s -o $FILE2.mpa" 704 snd="transcode -H 10 -F 2 -b 128 -M 0 --a52_drc_off -V -s 1.234 -y null,mpeg \ 705 -E 44100 -o $FILE2 -q 0 -x null --nice $nice_level --write_pid $FILE2.pid --print_status 0 -i" 706 707 mplay="nice -n $nice_level mplayer -really-quiet $dashaf $ivtc $vop -noframedrop -ao pcm -aofile stream.pcm -vo yuv4mpeg \ 708 -osdlevel 0 " 709 mplay1="nice -n $nice_level mplayer -really-quiet -nosound $ivtc $vop -noframedrop -vo yuv4mpeg -osdlevel 0 " 710 711 mux="mplex -v 0 -V -r 3000 -b 224 -f 2 -S $output_size \ 712 -o $FILE2-$output_type%d.mpg $FILE2.$mpeg_extention $FILE2.mpa" 713 714 mux1="mplex -v 0 -f $mpeg_type -S $output_size \ 715 -o $FILE2-$output_type%d.mpg $FILE2.$mpeg_extention $FILE2.mpa" 716 717 trans1="transcode -F $mpeg_type," 718 trans2=`echo -S 10000 -g $gopmin_size -G $gopmax_size $matrices $Quantisation -V $video_buffer \ 719 -n $Format $dashP $dashD $dashE $dashR $cpus $mdashD ` 720 trans3=" $export_aspect -b $audio_bitrate --a52_drc_off $dashd 721 $dashJ $filters $dashV $dashZ -f $framerate_orig $export $dashs -g $hxw $dashm $dashj $dashB 722 -y mpeg2enc,mpeg -E 44100 -o $FILE2 -q 1 -w $max_bitrate 723 $dashx $Nice $dashy $pulld $dashh $dasha $dasht --print_status 20 $subs $dvd_a_delay -i " 724 725} # Function declaration must precede call. 726 727dvdread () 728 729{ 730tcprobe -H 20 -T $ii -i "$FILE" >& tcprobe.info 731 while read line; do 732 line=`echo $line | sed 's/[[]//g'` 733 line=`echo $line | sed 's/[]]//g'` 734 if [ "$line" != "${line#(dvd_reader.c) DVD title}" ]; then 735 angle=${line#(dvd_reader.c) DVD title} 736 angle=`echo $angle | awk '{print $4}'` 737 fi 738 if [ "$line" != "${line#import}" ]; then 739 dashg=${line#import} 740 dashg=`echo $dashg | awk '{print $4}'` 741 width=`echo $dashg | awk -F x '{print $1}'` 742 height=`echo $dashg | awk -F x '{print $2}'` 743 dashg=`echo $dashg | awk '{print "-g "$1}'` 744 hxw="$width"x"$height" 745 fi 746 if [ "$line" != "${line#aspect}" ]; then 747 aspect=${line#aspect} 748 aspect=`echo $aspect | awk '{print $2}'` 749 fi 750 if [ "$line" != "${line#frame}" ]; then 751 framerate=${line#frame} 752 framerate=`echo $framerate | awk '{print $3}'` 753 fi 754 if [ "$line" != "${line#tcprobe V:}" ]; then 755 frames=${line#tcprobe V:} 756 frames=`echo $frames | awk '{print $1}'` 757 fi 758 done < tcprobe.info 759 quant=`echo "scale=0 ; ($frames / $framerate)"| bc -l` 760 quant1=$quant 761 HOURS=`echo "scale=0 ; ($frames / $framerate /60 / 60)"| bc -l` 762 MINUTES=`echo "scale=0 ; ($frames / $framerate / 60 - $HOURS*60 )"| bc -l` 763 total=$[HOURS * 60 + $MINUTES] 764 if [ $aspect == "4:3" ]; then 765 Aspects=1 766 dvd_aspect=1 767 else 768 Aspects=2 769 dvd_aspect=2 770 fi 771} 772 773dvdcdrom () 774{ 775err=0 776i=1 777t=0 778 while [ "$i" -lt "98" ] ; do 779 780 tcprobe -H 10 -T $i -i "$FILE" >& tcprobe.info 781 782 while read line; do 783 # detect movie format... 784 line=`echo $line | sed 's/[[]//g'` 785 line=`echo $line | sed 's/[]]//g'` 786 if [ "$line" != "${line#Invalid title}" ]; then 787 err=1 788 fi 789 if [ "$line" != "${line#(iodump.c) unable}" ]; then 790 echo "Error Reading DvD Drive!" 791 exit 792 fi 793 if [ "$line" != "${line#(dvd_reader.c) DVD title}" ]; then 794 angle=${line#(dvd_reader.c) DVD title} 795 title=${line#(dvd_reader.c) DVD} 796 title=`echo $title |sed 's/[:]//g'| awk '{print $1" "$2}'` 797 dtitle=`echo $title | awk -F / '{print $2}'` 798 ti="DVD "$title 799 angle=`echo $angle | awk '{print $4}'` 800 pflag=0 801 if [ $i -eq '1' -a $pflag -eq '0' ]; then 802 echo "" 803 echo " Processing $dtitle DvD Titles, This May take a few Seconds" 804 echo "" 805 pflag=1 806 fi 807 fi 808 if [ "$line" != "${line#import}" ]; then 809 dashg=${line#import} 810 dashg=`echo $dashg | awk '{print $4}'` 811 hxw=$dashg 812 width=`echo $dashg | awk -F x '{print $1}'` 813 height=`echo $dashg | awk -F x '{print $2}'` 814 dashg=`echo $dashg | awk '{print "-g "$1}'` 815 hxw="$width"x"$height" 816 fi 817 if [ "$line" != "${line#aspect}" ]; then 818 aspect=${line#aspect} 819 aspect=`echo $aspect | awk '{print $2}'` 820 fi 821 if [ "$line" != "${line#frame}" ]; then 822 framerate=${line#frame} 823 framerate=`echo $framerate | awk '{print $3}'` 824 fi 825 if [ "$line" != "${line#tcprobe V:}" ]; then 826 frames=${line#tcprobe V:} 827 frames=`echo $frames | awk '{print $1}'` 828 fi 829 done < tcprobe.info 830 rm -f tcprobe.info 831 quant=`echo "scale=0 ; ($frames / $framerate /60)"| bc -l` 832 if [ $err -eq '1' ]; then 833 i=100 834 quant=0 835 fi 836 837 if [ $quant -gt '30' ]; then 838 quant=`echo "scale=0 ; ($frames / $framerate)"| bc -l` 839 quant1=$quant 840 HOURS=`echo "scale=0 ; ($frames / $framerate /60 / 60)"| bc -l` 841 MINUTES=`echo "scale=0 ; ($frames / $framerate / 60 - $HOURS*60 )"| bc -l` 842 total=$[HOURS * 60 + $MINUTES] 843 ii=$i 844 if [ $ii -lt '10' ]; then 845 echo $ii" ) $ti $total Minutes" >>titles.select 846 angles=$angle 847 t=$[t+1] 848 else 849 echo $ii") $ti $total Minutes" >>titles.select 850 angles=$angle 851 t=$[t+1] 852 fi 853 if [ $aspect == "4:3" ]; then 854 Aspects=1 855 dvd_aspect=1 856 else 857 Aspects=2 858 dvd_aspect=2 859 fi 860 fi 861 i=$[i+1] 862 done 863 if [ $t -gt '1' ]; then 864 cat titles.select 865 DVD_Title_PROMPT='Which DVD Title to Convert --> ' 866 echo "" 867 echo -n " $DVD_Title_PROMPT" 868 read ii 869# Call DvDRead Function 870 dvdread 871 fi 872 rm -f titles.select 873 874dashg= 875framerate_orig=$framerate 876framerate=`echo $framerate | awk -F . '{print $1}'` 877dashx="-x dvd" 878dvdcd=1 879FILE2=DVD 880vformat=DVD 881acodec=a52 882width_orig=$width 883height_orig=$height 884dashm= 885bitrate=5000 886dashJ= 887dasht="-T $ii,-1,1" 888dashh="-H 10 " 889s=0 890a=0 891 if [ $angles -gt '1' ]; then 892 echo "-----------------------------------------------" 893 echo " There are $angles Angles" 894 echo "-----------------------------------------------" 895 DVD_Angle_PROMPT='Which Angle to Convert --> ' 896 echo -n " $DVD_Angle_PROMPT" 897 read angle 898 dasht="-T $ii,-1,$angle" 899 fi 900tcprobe -H 10 -T $ii -i "$FILE" >tcprobe.info 2> /dev/null 901 902 903 while read line; do 904 if [ "$line" != "${line#(dvd_reader.c) ac3}" -o "$line" != "${line#(dvd_reader.c) dts}" ]; then 905 enc=${line#(dvd_reader.c)} 906 enc2=`echo $enc | awk '{print $5}'` 907 enc1=`echo $enc | awk '{print $1}'` 908 tmp=`echo $enc | awk '{print $2}'` 909# Call Sellect Language Function 910 sellang 911 echo $a") " "$tmp" $enc1 $enc2 "Audio">>select.lang 912 aa=$a 913 a=$[a+1] 914 fi 915 if [ "$line" != "${line#(dvd_reader.c) subtitle}" ]; then 916 line=`echo $line | sed 's/[<]//g'` 917 line=`echo $line | sed 's/[>]//g'` 918 sub=${line#(dvd_reader.c) subtitle} 919 tmp=`echo $sub | awk -F = '{print $2}'` 920# Call Sellect Language Function 921 sellang 922 sub=`echo $sub | awk -F = '{print $1}'` 923 sub=`echo "scale=0 ; $sub "| bc -l` 924 echo $sub") " "$tmp" "SubTitles" >>select.subs 925 s=$[s+1] 926 fi 927 done < tcprobe.info 928 rm -r tcprobe.info 929 if [ $aa -gt '0' ]; then 930 echo "-----------------------------------------------" 931 cat select.lang 932 echo "-----------------------------------------------" 933 echo "" 934 DVD_Lang_PROMPT='Select the Language for Audio ---> ' 935 echo -n "$DVD_Lang_PROMPT" 936 read audio 937 dasha="-a $audio" 938 fi 939 rm -f select.lang 940 941 if [ $s -gt '0' ]; then 942 echo "" 943 echo "-----------------------------------------------" 944 cat select.subs 945 echo "-----------------------------------------------" 946 DVD_SUBS_PROMPT='Select a Subtitle or just hit \033[1mEnter for None\033[0m ---> ' 947 echo "" 948 echo -n -e " $DVD_SUBS_PROMPT" 949 read Subs 950 case $Subs in 951 '0') subs="-J extsub=$Subs:0:0:0:0" ;; 952 '1') subs="-J extsub=$Subs:0:0:0:0" ;; 953 '2') subs="-J extsub=$Subs:0:0:0:0" ;; 954 '3') subs="-J extsub=$Subs:0:0:0:0" ;; 955 '4') subs="-J extsub=$Subs:0:0:0:0" ;; 956 '5') subs="-J extsub=$Subs:0:0:0:0" ;; 957 '6') subs="-J extsub=$Subs:0:0:0:0" ;; 958 '7') subs="-J extsub=$Subs:0:0:0:0" ;; 959 '8') subs="-J extsub=$Subs:0:0:0:0" ;; 960 '9') subs="-J extsub=$Subs:0:0:0:0" ;; 961 '10') subs="-J extsub=$Subs:0:0:0:0" ;; 962 *) subs="" ;; 963 esac # 964 965 fi 966 rm -f select.subs 967 quant=$quant1 968 DVD_PROMPT='Enter the KVCD/XVCD Title Name --> ' 969 echo "" 970 echo -n " $DVD_PROMPT" 971 read FILE2 972 973 if [ $FILE2 ]; then 974 echo 975 else 976 exit 977 fi 978} # End Dvd Read Section... 979 980sellang () 981 982{ 983 984 if [ $tmp == "aa" ]; then 985 tmp="Afar " 986 fi 987 if [ $tmp == "ab" ]; then 988 tmp="Abkhazian " 989 fi 990 if [ $tmp == "af" ]; then 991 tmp="Afrikaans " 992 fi 993 if [ $tmp == "am" ]; then 994 tmp="Amharic " 995 fi 996 if [ $tmp == "ar" ]; then 997 tmp="Arabic " 998 fi 999 if [ $tmp == "as" ]; then 1000 tmp="Assamese " 1001 fi 1002 if [ $tmp == "ay" ]; then 1003 tmp="Aymara " 1004 fi 1005 if [ $tmp == "az" ]; then 1006 tmp="Azerbaijani " 1007 fi 1008 if [ $tmp == "ba" ]; then 1009 tmp="Bashkir " 1010 fi 1011 if [ $tmp == "be" ]; then 1012 tmp="Byelorussian " 1013 fi 1014 if [ $tmp == "bg" ]; then 1015 tmp="Bulgarian " 1016 fi 1017 if [ $tmp == "bh" ]; then 1018 tmp="Bihari " 1019 fi 1020 if [ $tmp == "bi" ]; then 1021 tmp="Bislama " 1022 fi 1023 if [ $tmp == "bn" ]; then 1024 tmp="Bengali, Bangla" 1025 fi 1026 if [ $tmp == "bo" ]; then 1027 tmp="Tibetan " 1028 fi 1029 if [ $tmp == "br" ]; then 1030 tmp="Breton " 1031 fi 1032 if [ $tmp == "ca" ]; then 1033 tmp="Catalan " 1034 fi 1035 if [ $tmp == "co" ]; then 1036 tmp="Corsican " 1037 fi 1038 if [ $tmp == "cs" ]; then 1039 tmp="Czech " 1040 fi 1041 if [ $tmp == "cy" ]; then 1042 tmp="Welsh " 1043 fi 1044 if [ $tmp == "da" ]; then 1045 tmp="Dansk " 1046 fi 1047 if [ $tmp == "de" ]; then 1048 tmp="Deutsch " 1049 fi 1050 if [ $tmp == "dz" ]; then 1051 tmp="Bhutani " 1052 fi 1053 if [ $tmp == "el" ]; then 1054 tmp="Greek " 1055 fi 1056 if [ $tmp == "en" ]; then 1057 tmp="English " 1058 fi 1059 if [ $tmp == "eo" ]; then 1060 tmp="Esperanto " 1061 fi 1062 if [ $tmp == "es" ]; then 1063 tmp="Espanol " 1064 fi 1065 if [ $tmp == "et" ]; then 1066 tmp="Estonian " 1067 fi 1068 if [ $tmp == "eu" ]; then 1069 tmp="Basque " 1070 fi 1071 if [ $tmp == "fa" ]; then 1072 tmp="Persian " 1073 fi 1074 if [ $tmp == "fi" ]; then 1075 tmp="Suomi " 1076 fi 1077 if [ $tmp == "fj" ]; then 1078 tmp="Fiji " 1079 fi 1080 if [ $tmp == "fo" ]; then 1081 tmp="Faroese " 1082 fi 1083 if [ $tmp == "fr" ]; then 1084 tmp="Francais " 1085 fi 1086 if [ $tmp == "fy" ]; then 1087 tmp="Frisian " 1088 fi 1089 if [ $tmp == "ga" ]; then 1090 tmp="Gaelic " 1091 fi 1092 if [ $tmp == "gd" ]; then 1093 tmp="Scots, Gaelic " 1094 fi 1095 if [ $tmp == "gl" ]; then 1096 tmp="Galician " 1097 fi 1098 if [ $tmp == "gn" ]; then 1099 tmp="Guarani " 1100 fi 1101 if [ $tmp == "gu" ]; then 1102 tmp="Gujarati " 1103 fi 1104 if [ $tmp == "ha" ]; then 1105 tmp="Hausa " 1106 fi 1107 if [ $tmp == "he" ]; then 1108 tmp="Hebrew " 1109 fi 1110 if [ $tmp == "hi" ]; then 1111 tmp="Hindi " 1112 fi 1113 if [ $tmp == "hr" ]; then 1114 tmp="Hrvatski " 1115 fi 1116 if [ $tmp == "hu" ]; then 1117 tmp="Magyar " 1118 fi 1119 if [ $tmp == "hy" ]; then 1120 tmp="Armenian " 1121 fi 1122 if [ $tmp == "ia" ]; then 1123 tmp="Interlingua " 1124 fi 1125 if [ $tmp == "id" ]; then 1126 tmp="Indonesian " 1127 fi 1128 if [ $tmp == "ie" ]; then 1129 tmp="Interlingue " 1130 fi 1131 if [ $tmp == "ik" ]; then 1132 tmp="Inupiak " 1133 fi 1134 if [ $tmp == "in" ]; then 1135 tmp="Indonesian " 1136 fi 1137 if [ $tmp == "is" ]; then 1138 tmp="Islenska " 1139 fi 1140 if [ $tmp == "it" ]; then 1141 tmp="Italiano " 1142 fi 1143 if [ $tmp == "iu" ]; then 1144 tmp="Inuktitut " 1145 fi 1146 if [ $tmp == "iw" ]; then 1147 tmp="Hebrew " 1148 fi 1149 if [ $tmp == "ja" ]; then 1150 tmp="Japanese " 1151 fi 1152 if [ $tmp == "ji" ]; then 1153 tmp="Yiddish " 1154 fi 1155 if [ $tmp == "jw" ]; then 1156 tmp="Javanese " 1157 fi 1158 if [ $tmp == "ka" ]; then 1159 tmp="Georgian " 1160 fi 1161 if [ $tmp == "kk" ]; then 1162 tmp="Kazakh " 1163 fi 1164 if [ $tmp == "kl" ]; then 1165 tmp="Greenlandic " 1166 fi 1167 if [ $tmp == "km" ]; then 1168 tmp="Cambodian " 1169 fi 1170 if [ $tmp == "kn" ]; then 1171 tmp="Kannada " 1172 fi 1173 if [ $tmp == "ko" ]; then 1174 tmp="Korean " 1175 fi 1176 if [ $tmp == "ks" ]; then 1177 tmp="Kashmiri " 1178 fi 1179 if [ $tmp == "ku" ]; then 1180 tmp="Kurdish " 1181 fi 1182 if [ $tmp == "ky" ]; then 1183 tmp="Kirghiz " 1184 fi 1185 if [ $tmp == "la" ]; then 1186 tmp="Latin " 1187 fi 1188 if [ $tmp == "ln" ]; then 1189 tmp="Lingala " 1190 fi 1191 if [ $tmp == "lo" ]; then 1192 tmp="Laothian " 1193 fi 1194 if [ $tmp == "lt" ]; then 1195 tmp="Lithuanian " 1196 fi 1197 if [ $tmp == "lv" ]; then 1198 tmp="Latvian " 1199 fi 1200 if [ $tmp == "mg" ]; then 1201 tmp="Malagasy " 1202 fi 1203 if [ $tmp == "mi" ]; then 1204 tmp="Maori " 1205 fi 1206 if [ $tmp == "mk" ]; then 1207 tmp="Macedonian " 1208 fi 1209 if [ $tmp == "ml" ]; then 1210 tmp="Malayalam " 1211 fi 1212 if [ $tmp == "mn" ]; then 1213 tmp="Mongolian " 1214 fi 1215 if [ $tmp == "mo" ]; then 1216 tmp="Moldavian " 1217 fi 1218 if [ $tmp == "mr" ]; then 1219 tmp="Marathi " 1220 fi 1221 if [ $tmp == "ms" ]; then 1222 tmp="Malay " 1223 fi 1224 if [ $tmp == "mt" ]; then 1225 tmp="Maltese " 1226 fi 1227 if [ $tmp == "my" ]; then 1228 tmp="Burmese " 1229 fi 1230 if [ $tmp == "na" ]; then 1231 tmp="Nauru " 1232 fi 1233 if [ $tmp == "ne" ]; then 1234 tmp="Nepali " 1235 fi 1236 if [ $tmp == "nl" ]; then 1237 tmp="Nederlands " 1238 fi 1239 if [ $tmp == "no" ]; then 1240 tmp="Norsk " 1241 fi 1242 if [ $tmp == "oc" ]; then 1243 tmp="Occitan " 1244 fi 1245 if [ $tmp == "om" ]; then 1246 tmp="Oromo " 1247 fi 1248 if [ $tmp == "or" ]; then 1249 tmp="Oriya " 1250 fi 1251 if [ $tmp == "pa" ]; then 1252 tmp="Punjabi " 1253 fi 1254 if [ $tmp == "pl" ]; then 1255 tmp="Polish " 1256 fi 1257 if [ $tmp == "ps" ]; then 1258 tmp="Pashto " 1259 fi 1260 if [ $tmp == "pt" ]; then 1261 tmp="Portugues " 1262 fi 1263 if [ $tmp == "qu" ]; then 1264 tmp="Quechua " 1265 fi 1266 if [ $tmp == "rm" ]; then 1267 tmp="Rhaeto-Romance " 1268 fi 1269 if [ $tmp == "rn" ]; then 1270 tmp="Kirundi " 1271 fi 1272 if [ $tmp == "ro" ]; then 1273 tmp="Romanian " 1274 fi 1275 if [ $tmp == "ru" ]; then 1276 tmp="Russian " 1277 fi 1278 if [ $tmp == "rw" ]; then 1279 tmp="Kinyarwanda " 1280 fi 1281 if [ $tmp == "sa" ]; then 1282 tmp="Sanskrit " 1283 fi 1284 if [ $tmp == "sd" ]; then 1285 tmp="Sindhi " 1286 fi 1287 if [ $tmp == "sg" ]; then 1288 tmp="Sangho " 1289 fi 1290 if [ $tmp == "sh" ]; then 1291 tmp="Serbo-Croatian " 1292 fi 1293 if [ $tmp == "si" ]; then 1294 tmp="Sinhalese " 1295 fi 1296 if [ $tmp == "sk" ]; then 1297 tmp="Slovak " 1298 fi 1299 if [ $tmp == "sl" ]; then 1300 tmp="Slovenian " 1301 fi 1302 if [ $tmp == "sm" ]; then 1303 tmp="Samoan " 1304 fi 1305 if [ $tmp == "sn" ]; then 1306 tmp="Shona " 1307 fi 1308 if [ $tmp == "so" ]; then 1309 tmp="Somali " 1310 fi 1311 if [ $tmp == "sq" ]; then 1312 tmp="Albanian " 1313 fi 1314 if [ $tmp == "sr" ]; then 1315 tmp="Serbian " 1316 fi 1317 if [ $tmp == "ss" ]; then 1318 tmp="Siswati " 1319 fi 1320 if [ $tmp == "st" ]; then 1321 tmp="Sesotho " 1322 fi 1323 if [ $tmp == "su" ]; then 1324 tmp="Sundanese " 1325 fi 1326 if [ $tmp == "sv" ]; then 1327 tmp="Svenska " 1328 fi 1329 if [ $tmp == "sw" ]; then 1330 tmp="Swahili " 1331 fi 1332 if [ $tmp == "ta" ]; then 1333 tmp="Tamil " 1334 fi 1335 if [ $tmp == "te" ]; then 1336 tmp="Telugu " 1337 fi 1338 if [ $tmp == "tg" ]; then 1339 tmp="Tajik " 1340 fi 1341 if [ $tmp == "th" ]; then 1342 tmp="Thai " 1343 fi 1344 if [ $tmp == "ti" ]; then 1345 tmp="Tigrinya " 1346 fi 1347 if [ $tmp == "tk" ]; then 1348 tmp="Turkmen " 1349 fi 1350 if [ $tmp == "tl" ]; then 1351 tmp="Tagalog " 1352 fi 1353 if [ $tmp == "tn" ]; then 1354 tmp="Setswana " 1355 fi 1356 if [ $tmp == "to" ]; then 1357 tmp="Tonga " 1358 fi 1359 if [ $tmp == "tr" ]; then 1360 tmp="Turkish " 1361 fi 1362 if [ $tmp == "ts" ]; then 1363 tmp="Tsonga " 1364 fi 1365 if [ $tmp == "tt" ]; then 1366 tmp="Tatar " 1367 fi 1368 if [ $tmp == "tw" ]; then 1369 tmp="Twi " 1370 fi 1371 if [ $tmp == "ug" ]; then 1372 tmp="Uighur " 1373 fi 1374 if [ $tmp == "uk" ]; then 1375 tmp="Ukrainian " 1376 fi 1377 if [ $tmp == "ur" ]; then 1378 tmp="Urdu " 1379 fi 1380 if [ $tmp == "uz" ]; then 1381 tmp="Uzbek " 1382 fi 1383 if [ $tmp == "vi" ]; then 1384 tmp="Vietnamese " 1385 fi 1386 if [ $tmp == "vo" ]; then 1387 tmp="Volapuk " 1388 fi 1389 if [ $tmp == "wo" ]; then 1390 tmp="Wolof " 1391 fi 1392 if [ $tmp == "xh" ]; then 1393 tmp="Xhosa " 1394 fi 1395 if [ $tmp == "yi" ]; then 1396 tmp="Yiddish " 1397 fi 1398 if [ $tmp == "yo" ]; then 1399 tmp="Yoruba " 1400 fi 1401 if [ $tmp == "za" ]; then 1402 tmp="Zhuang " 1403 fi 1404 if [ $tmp == "zh" ]; then 1405 tmp="Chinese " 1406 fi 1407 if [ $tmp == "zu" ]; then 1408 tmp="Zulu " 1409 fi 1410 if [ $tmp == "xx" ]; then 1411 tmp="Unknown " 1412 fi 1413 if [ $tmp == "drc" ]; then 1414 tmp="Unknown " 1415 fi 1416} 1417 1418select_wide () 1419{ 1420 1421 if [ $height_orig -gt $width_orig ]; then 1422 echo 1423 else 1424 wide_flag=1 1425 1426 if [ $dvdcd -eq '0' -a $vflag -eq '0' -a $mpeg_type -ne '5' ]; then 1427 1428 if [ $framerate -ne '25' ]; then 1429exp_height=`echo "scale=9 ; (($height_orig/($width_orig/4*3)) * (240)+.0001)"| bc -l | awk -F . '{print $1}'` 1430 else 1431exp_height=`echo "scale=9 ; (($height_orig/($width_orig/4*3)) * (288)+.0001)"| bc -l | awk -F . '{print $1}'` 1432 fi 1433 if [ $advanced -eq '1' -a $Aspects -eq '2' ]; then 1434 Boarders_PROMPT=' Do you Wish Black Boarders? (y/n)' 1435 echo -n "$Boarders_PROMPT" 1436 read line 1437 else 1438 if [ $Aspects -eq '2' ]; then 1439 line="y" 1440 else 1441 line="n" 1442 fi 1443 fi 1444 1445 case $line in 1446 'y') b1=$[height-160] 1447 aspect=2 1448 if [ $Aspects -eq '1' ]; then 1449 asp=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 1450 p_aspect="-aspect $asp" 1451 else 1452 asp=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 1453 p_aspect="-aspect $asp" 1454 fi 1455 wflag=1 1456 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1457 dashy="-Y -40,0,-40,0" 1458 export_aspect="--export_asr 2" 1459 Aspects=2 1460 aspect_flag=1 #;; 1461 1462 if [ $framerate -eq '25' ]; then 1463 b1=$[height-176] 1464 aspect=2 1465 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1466 dashy="-Y -56,0,-56,0" #;; 1467 fi 1468 ;; 1469 1470 'Y') b1=$[height-160] 1471 aspect=2 1472 if [ $Aspects -eq '1' ]; then 1473 asp=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 1474 p_aspect="-aspect $asp" 1475 else 1476 asp=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 1477 p_aspect="-aspect $asp" 1478 fi 1479 wflag=1 1480 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1481 dashy="-Y -40,0,-40,0" 1482 export_aspect="--export_asr 2" 1483 Aspects=2 1484 aspect_flag=1 #;; 1485 if [ $framerate -eq '25' ]; then 1486 b1=$[height-176] 1487 aspect=2 1488 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1489 dashy="-Y -56,0,-56,0" 1490 fi 1491 ;; 1492 1493 'n') b1=$[height-240] 1494 Aspects=1 1495 p_aspect="-aspect 1" 1496 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1497 wflag=2 1498 aspect=2 1499 dashy="-Y 0,0,0,0" #;; 1500 if [ $framerate -eq '25' ]; then 1501 b1=$[height-288] 1502 Aspects=1 1503 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1504 aspect=2 1505 wflag=2 1506 dashy="-Y 0,0,0,0" #;; 1507 fi 1508 ;; 1509 1510 'N') b1=$[height-240] 1511 Aspects=1 1512 p_aspect="-aspect 1" 1513 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1514 aspect=2 1515 wflag=2 1516 dashy="-Y 0,0,0,0" #;; 1517 1518 if [ $framerate -eq '25' ]; then 1519 b1=$[height-288] 1520 Aspects=1 1521 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1522 aspect=2 1523 wflag=2 1524 dashy="-Y 0,0,0,0" #;; 1525 fi 1526 ;; 1527 1528 *) b1=$[height-240] 1529 Aspects=1 1530 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1531 aspect=2 1532 wflag=2 1533 dashy="-Y 0,0,0,0" #;; 1534 1535 if [ $framerate -eq '25' ]; then 1536 b1=$[height-288] 1537 Aspects=1 1538 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1539 aspect=2 1540 wflag=2 1541 dashy="-Y 0,0,0,0" #;; 1542 fi 1543 ;; 1544 esac # 1545 export_aspect="--export_asr 2" 1546 aspect_flag=1 1547 fi 1548 fi 1549} 1550 1551detect () 1552{ 1553 if [ -e "$FILE" -a $dvdcd -eq '1' ]; then 1554 mplayer "$FILE1" -identify -vo null -ao null -frames 23 > movie.info 2> /dev/null 1555 while read line; do 1556 1557# detect movie framerate... 1558 if [ "$line" != "${line#ID_VIDEO_BITRATE=}" ]; then 1559 bitrate=${line#ID_VIDEO_BITRATE=} 1560 bitrate_orig=$bitrate 1561 bitrate=$[bitrate/1000] 1562 fi 1563 if [ $width -lt '720' ]; then 1564# detect movie height... 1565 if [ "$line" != "${line#ID_VIDEO_HEIGHT=}" ]; then 1566 height=${line#ID_VIDEO_HEIGHT=} 1567 fi 1568# detect movie width... 1569 if [ "$line" != "${line#ID_VIDEO_WIDTH=}" ]; then 1570 width=${line#ID_VIDEO_WIDTH=} 1571 fi 1572 width_orig=$width 1573 height_orig=$height 1574 fi 1575# detect aspect ratio (if defined)..." 1576 if [ "$line" != "${line#Movie-Aspect is }" ]; then 1577 movie_aspect=${line#Movie-Aspect is } 1578 movie_aspect=`echo "$movie_aspect" | sed s/:.*//` 1579 if [ "$movie_aspect" == "undefined - no prescaling applied." ]; then 1580 movie_aspect=`echo "scale=0 ; ($width_orig / $height / 2 * 2)" | bc -l` 1581 fi 1582 if [ $input_aspect ]; then 1583 movie_aspect=$input_aspect 1584 fi 1585 fi 1586 1587 done < movie.info 1588 rm -f movie.info 1589 hxw="$width"x"$height" 1590 fi 1591 1592 if [ -e "$FILE" -a $dvdcd -eq '0' ]; then 1593 1594 mplayer "$FILE" -identify -vo null -ao null -frames 23 > movie.info 2> /dev/null 1595 while read line; do 1596 1597# detect movie format... 1598 if [ "$line" != "${line#ID_VIDEO_FORMAT=}" ]; then 1599 vformat=${line#ID_VIDEO_FORMAT=} 1600 fi 1601# detect movie framerate... 1602 if [ "$line" != "${line#ID_VIDEO_BITRATE=}" ]; then 1603 bitrate=${line#ID_VIDEO_BITRATE=} 1604 bitrate_orig=$bitrate 1605 bitrate=$[bitrate/1000] 1606 fi 1607# detect movie height... 1608 if [ "$line" != "${line#ID_VIDEO_HEIGHT=}" ]; then 1609 height=${line#ID_VIDEO_HEIGHT=} 1610 fi 1611# detect movie width... 1612 if [ "$line" != "${line#ID_VIDEO_WIDTH=}" ]; then 1613 width=${line#ID_VIDEO_WIDTH=} 1614 width_orig=$width 1615 fi 1616# detect fps to determine output file fps... 1617 if [ "$line" != "${line#ID_VIDEO_FPS=}" ]; then 1618 framerate=${line#ID_VIDEO_FPS=} 1619 framerate_orig="$framerate" 1620 if [ $framerate = '24.999' ] ; then 1621 framerate=25 1622 framerate_orig="24.999" 1623 else 1624 framerate=`echo $framerate| awk -F . '{print $1}'` 1625 fi 1626 fi 1627 1628# detect movie audio codec... 1629 if [ "$line" != "${line#ID_AUDIO_CODEC=}" ]; then 1630 acodec=${line#ID_AUDIO_CODEC=} 1631 fi 1632# figure out how long the movie is... 1633 if [ "$line" != "${line#ID_LENGTH=}" ]; then 1634 quant=${line#ID_LENGTH=} 1635 fi 1636# detect 3:2 TELECINE 1637 if [ "$line" != "${line#demux_mpg}" ]; then 1638 altfps=23 1639 framerate=$[altfps*3] 1640 fi 1641# detect aspect ratio (if defined)..." 1642 if [ "$line" != "${line#Movie-Aspect is }" ]; then 1643 movie_aspect=${line#Movie-Aspect is } 1644 movie_aspect=`echo "$movie_aspect" | sed s/:.*//` 1645 if [ "$movie_aspect" == "undefined - no prescaling applied." ]; then 1646 movie_aspect=`echo "scale=0 ; ($width_orig / $height)"| bc -l` 1647 if [ $movie_aspect -eq '0' -o $movie_aspect -eq '1' ]; then 1648 movie_aspect=`echo "scale=2 ; ($width_orig / $height) + .55"| bc -l` 1649 fi 1650 fi 1651 if [ $input_aspect ]; then 1652 movie_aspect=$input_aspect 1653 fi 1654 fi 1655 1656 done < movie.info 1657 1658# check for supported FPS... 1659 test_framerate=`echo "scale=0 ; $framerate"| bc -l` 1660 if [ $framerate -eq '23' -a $test_framerate -ne '23' ]; then 1661 MPLAYER=0 1662 fi 1663 if [ $framerate -eq '25' -a $test_framerate -ne '25' ]; then 1664 MPLAYER=0 1665 fi 1666 if [ $framerate -eq '29' -a $test_framerate -ne '29' ]; then 1667 MPLAYER=0 1668 fi 1669 1670# end FPS... 1671 else 1672 if [ $dvdcd -eq '0' ]; then 1673 echo -e "\a" 1674 echo "------------------------> $FILE File does not Exist" 1675 echo " Can not Continue" 1676 echo " EXITING " 1677 exit 0 1678 fi 1679 fi 1680 if [ $dvdcd -eq '0' ]; then 1681 HOURS=$[quant / 3600] 1682 MINUTES=$[quant - 3600 * $HOURS] 1683 MINUTES=$[MINUTES /60] 1684 HOURS=$[HOURS * 60] 1685 rm -f movie.info 1686 fi 1687 1688 FileLength=`basename "$FILE" | wc -c` 1689 for ext in .asf .avi .mov .mpg .mpeg .ogm .rm .vob \ 1690 .ASF .AVI .MOV .MPG .MPEG .OGM .RM .VOB \ 1691 .Avi .Asf .Mov .Mpg .Mpeg .Ogm .Rm .Vob; do 1692 1693 if [ $FileLength -gt "`basename "$FILE" $ext | wc -c`" ]; then 1694 FILE2=`basename "$FILE" $ext` 1695 ext2=$ext 1696 fi 1697 done 1698 1699# get the correct length for vbr mpeg's with mpgtx 1700 if [ $dvdcd -eq '0' ]; then 1701 if [ $quant -eq '0' -o $altfps -ne '0' -a $dvdcd -eq '0' ]; then 1702 1703 if [ $ext2 == ".mpg" -o $ext2 == ".Mpg" -o $ext2 == ".MPG" \ 1704 -o $ext2 == ".mpeg" -o $ext2 == ".Mpeg" -o $ext2 == ".MPEG" ]; then 1705 1706 echo "Check for MPGTX needed for mpeg file conversion..." 1707 echo "" 1708 for exe in mpgtx ; do 1709 if [ -z "`which $exe`" ]; then 1710 echo -e "\a" 1711 echo "" 1712 echo "" 1713 echo "Error: $exe isn't installed or isn't in your path!" 1714 echo "You really need this if you want to encode vbr video." 1715 echo "" 1716 echo "You can download this utility from the link below." 1717 echo "http://mpgtx.sourceforge.net/" 1718 echo "" 1719 echo "" 1720 exit 1 1721 fi 1722 done 1723 1724 mpgtx -i $1 > movie.info 2>/dev/null 1725 1726# make time readings human readable... 1727 while read line; do 1728 if [ "$line" != "${line#Estimated}" ]; then 1729 quant=${line#Estimated} 1730 quant=`echo $quant | awk '{print $2}'` 1731 q_length=`echo $quant | wc -c` 1732 1733 if [ $q_length -eq '13' ]; then 1734 HOURS=`echo $quant | awk -F : '{print $1}'` 1735 HOURS=$[HOURS * 60] 1736 MINUTES=`echo $quant | awk -F : '{print $2}'` 1737 MINUTES=$[MINUTES/1] 1738 else 1739 HOURS=0 1740 fi 1741 1742 if [ $q_length -eq '10' ]; then 1743 MINUTES=`echo $quant | awk -F : '{print $1}'` 1744 MINUTES=$[MINUTES/1] 1745 fi 1746 1747 if [ $q_length -eq '7' ]; then 1748 MINUTES=0 1749 fi 1750 fi 1751 quant=$[HOURS+MINUTES] 1752 quant=$[quant*60] 1753 mpgtxflag=1 1754 done < movie.info 1755 rm -f movie.info 1756 fi 1757 1758 fi 1759 1760 if [ $ext2 == ".ogm" -o $ext2 == ".Ogm" -o $ext2 == ".OGM" ]; then 1761 echo "Check for OGMINFO needed for ogm file conversion..." 1762 ogm_info=0 1763 for exe in ogminfo ; do 1764 if [ -z "`which $exe`" ]; then 1765 echo -e "\a" 1766 echo "" 1767 echo "" 1768 echo "Error: $exe isn't installed or isn't in your path!" 1769 echo "You really need this if you want to encode ogm video." 1770 echo "" 1771 echo "You can download this utility from the link below." 1772 echo "http://www.bunkus.org/videotools/ogmtools/" 1773 echo "" 1774 echo "" 1775 sleep 3 1776 ogm_info=1 1777 fi 1778 done 1779 if [ $ogm_info -eq '0' ]; then 1780 ogminfo -s "$FILE" > movie.info 2> /dev/null 1781 1782 while read line; do 1783 if [ "$line" != "${line#(ogminfo.c) (v1/serial 0) stream size:}" ]; then 1784 quant=${line#(v1/serial 0) stream size:} 1785 bitrate=`echo $quant | awk '{print $8}' | awk -F . '{print $1}' | sed 's/[(]//g'` 1786 quant=`echo $quant | awk '{print $19}'` 1787 quant=`echo $quant | awk -F . '{print $1}'` 1788 quant=$[quant/1000] 1789 quant=$[quant/60] 1790 HOURS=$[quant/60] 1791 MINUTES=$[quant-$HOURS*60] 1792 HOURS=$[HOURS*60] 1793 fi 1794 done < movie.info 1795 rm -f movie.info 1796 fi 1797 fi 1798 fi 1799 1800} 1801 1802scan_versions () 1803 1804{ 1805transcode -v>&transcode.version 1806transdisplay=`cat transcode.version | awk '{print $2}' | awk -F '(' '{print $1}'` 1807transversion=`cat transcode.version | awk '{print $2}' | awk -F . '{print $1""$2""$3}' | sed 's/v/ /g'` 1808 if [ $transversion -gt '0610' ]; then 1809 dvd_a_delay=$dvd_a_delay 1810 else 1811 dvd_a_delay= 1812 fi 1813 if [ $transversion -gt '069' ]; then 1814 Nice="--nice $nice_level" 1815 dashx="-x mplayer" 1816 else 1817 dashx="-x mplayer" 1818 Nice= 1819 fi 1820 if [ $transversion -gt '0610' ]; then 1821 dashx= #"-x mplayer" 1822 fi 1823 if [ $transversion -lt '0611' -a $MPLAYER -eq '0' ]; then 1824 echo " You May want to Upgrade Transcode to 0.6.11 " 1825 echo " Version 0.6.11 uses ffmpeg for importing files being converted " 1826 echo " Plus you also get Fast Resize for the -Z option " 1827 sleep 3 1828 fi 1829 rm -f transcode.version 1830 if [ -x stream.yuv ]; then 1831 rm -f stream.yuv 1832 fi 1833 1834 mplayer --version >mplayer.version 2>/dev/null 1835 while read line; do 1836 if [ "$line" != "${line#MPlayer}" ]; then 1837 mplayerv=${line#MPlayer} 1838 mplayerv1=`echo $mplayerv | awk '{print $1}' | awk -F . '{print $1}'` 1839 mplver=`echo $mplayerv | awk '{print $1}'` 1840 mplayerv=`echo $mplayerv | awk '{print $1}' | awk -F - '{print $1}'` 1841 fi 1842 1843 done < mplayer.version 1844 rm -r mplayer.version 1845 1846 if [ $mplayerv == "dev" ]; then 1847 mplayerv=`echo $mplver | awk -F - '{print $2"-"$3}'` 1848 mplayerv1=1 1849 fi 1850 1851 if [ $mplayerv1 -eq '0' -a $dvdcd -eq '1' ]; then 1852 FILE1="-dvd $ii" 1853 else 1854 FILE1="dvd://$ii" 1855 fi 1856 1857# Check for Version of MjpegTools 1.x or 2.x (or pre-2 ;-) 1858 mplex >& mjpeg.version 1859 mjpeg_version=`grep version mjpeg.version | awk '{ print $4}'` 1860 mjpeg_subversion=`echo $mjpeg_version | awk -F . '{print $4}'` 1861 mjpeg_version=`echo $mjpeg_version | awk -F . '{print $1""$2""$3}'` 1862 if [ $mjpeg_subversion ]; then 1863 mjpeg_subversion=$mjpeg_subversion 1864 else 1865 mjpeg_subversion=00 1866 fi 1867 mjpeg_version=`echo $mjpeg_version$mjpeg_subversion` 1868 1869 if [ $mjpeg_version -gt '16190' -o $mjpeg_version -eq '16190' -a $modestandard -eq '0' ]; then 1870 matrices="-K kvcd" 1871 output_type="KVCD" 1872 fi 1873 if [ $mjpeg_version -eq '16100' -o $mjpeg_version -le '16100' -a $modestandard -eq '0' ]; then 1874 matrices="-N -h" 1875 output_type="XVCD" 1876 output_size="794" 1877 fi 1878 if [ $mjpeg_version -gt '16190' ]; then 1879 dashE= #"-E -20" 1880 dashR= #"-R 2" 1881 mdashD="-D 10" 1882 fi 1883 if [ $mjpeg_version -gt '16192' ]; then 1884 video_buffer=120 1885 fi 1886 rm -f mjpeg.version 1887 1888} 1889 1890select_16:9 () 1891 1892{ 1893 1894 test_aspect=`echo "scale=0 ; ($width_orig / $height_orig)"| bc -l` 1895 current_aspect=`echo "scale=2 ; ($width_orig / $height_orig)"| bc -l` 1896 if [ $test_aspect -ne '1' -o $dvd_aspect -eq '2' -o $Aspects -ne '3' ]; then 1897 if [ $wflag -eq '1' ]; then 1898 1899 1900 if [ $advanced -eq '1' ]; then 1901Aspect_PROMPT=" Do you want 16:9 widescreen dvd-style black-borders? (y/n)" 1902 echo -n "$Aspect_PROMPT" 1903 read line 1904 else 1905 line="y" 1906 if [ $test_framerate -ne '25' -a $cflag -eq '0' ]; then 1907exp_height=`echo "scale=9 ; (($height_orig/($width_orig/16*9)) * (240)+.0001)"| bc -l | awk -F . '{print $1}'` 1908 else 1909exp_height=`echo "scale=9 ; (($height_orig/($width_orig/16*9)) * (288)+.0001)"| bc -l | awk -F . '{print $1}'` 1910 fi 1911 1912 fi 1913 case $line in 1914 'y') Mode= 1915 aspect=3 1916 export_aspect="--export_asr 3" 1917 aspect_flag=2 1918 p_aspect="-aspect $movie_aspect" 1919 1920 if [ $test_framerate -ne '25' -a $cflag -eq '0' ]; then 1921exp_height=`echo "scale=9 ; (($height_orig/($width_orig/16*9)) * (240)+.0001)"| bc -l | awk -F . '{print $1}'` 1922 else 1923exp_height=`echo "scale=9 ; (($height_orig/($width_orig/16*9)) * (288)+.0001)"| bc -l | awk -F . '{print $1}'` 1924 fi 1925 1926 if [ $test_framerate -eq '25' -a $cflag -eq '0' ]; then 1927 dashZ="-Z 352x208" 1928 dashy="-Y -40,0,-40,0" 1929 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1930 fi 1931 if [ $cflag -eq '1' ]; then 1932 dashZ="-Z 352x160" 1933 dashy="-Y -40,0,-40,0" 1934 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1935 fi 1936 if [ $test_framerate -ne '25' -a $cflag -eq '0' ]; then 1937 dashZ="-Z 352x160" 1938 dashy="-Y -40,0,-40,0" 1939 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1940 fi 1941 Aspects=2 ;; 1942 'Y') Mode= 1943 aspect=3 1944 export_aspect="--export_asr 3" 1945 aspect_flag=2 1946 p_aspect="-aspect $movie_aspect" 1947 if [ $test_framerate -ne '25' -a $cflag -eq '0' ]; then 1948exp_height=`echo "scale=9 ; (($height_orig/($width_orig/16*9)) * (240)+.0001)"| bc -l | awk -F . '{print $1}'` 1949 else 1950exp_height=`echo "scale=9 ; (($height_orig/($width_orig/16*9)) * (288)+.0001)"| bc -l | awk -F . '{print $1}'` 1951 fi 1952 1953 if [ $test_framerate -eq '25' -a $cflag -eq '0' ]; then 1954 dashZ="-Z 352x208" 1955 dashy="-Y -40,0,-40,0" 1956 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:288" 1957 fi 1958 if [ $cflag -eq '1' ]; then 1959 dashZ="-Z 352x160" 1960 dashy="-Y -40,0,-40,0" 1961 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1962 fi 1963 if [ $test_framerate -ne '25' -a $cflag -eq '0' ]; then 1964 dashZ="-Z 352x160" 1965 dashy="-Y -40,0,-40,0" 1966 vop="-vf scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240" 1967 fi 1968 Aspects=2 ;; 1969 'n') Mode=RESAMPLE 1970 aspect_flag=1 1971 aspect=2 1972 p_aspect="-aspect 1.78" 1973 export_aspect="--export_asr 2" ;; 1974 'N') Mode=RESAMPLE 1975 aspect_flag=1 1976 aspect=2 1977 p_aspect="-aspect 1.333" 1978 export_aspect="--export_asr 2" ;; 1979 *) p_aspect="-aspect 1.78" 1980 line=n 1981 Mode= ;; 1982 esac # 1983 1984fi 1985fi 1986 if [ $line == "y" -o $line == "Y" ]; then 1987 if [ $max_bitrate -lt '900' ]; then 1988 max_bitrate=2400 1989 fi 1990 fi 1991 1992 1993} 1994 1995# show a litle hint if no file is given... 1996PARAM=$# 1997 if [ $PARAM -eq 0 ]; then 1998 echo -e "\a" 1999 echo "---------------------------------------------------------------------------" 2000 echo " $MkxVcd_Version" 2001 echo "" 2002 if [ $MPLAYER -eq '0' ]; then 2003 echo -e " \033[1mThis Script is currently setup to use Transcode\033[0m " 2004 echo "" 2005 else 2006 echo -e " \033[1mThis Script is currently setup to use Mplayer\033[0m " 2007 echo "" 2008 fi 2009 echo " mkxvcd Yourfilename.whateverextensionmplayercanread to Convert " 2010 echo " -d for debug, -m to force Mplayer conversion, -t for Transcode " 2011 echo "" 2012 echo " Or use your DvD Drive for the Source " 2013 echo " mkxvcd /dev/dvd or /dev/cdrom " 2014 echo " DvD's at present only work with Transcode " 2015 echo "---------------------------------------------------------------------------" 2016 exit 1 2017 else 2018 2019# Say welcome... 2020 echo "Lets boogie..." 2021 echo "" 2022Option=$2 2023 if [ $Option ]; then 2024 Option=`echo $Option | sed 's/-//g'` # Removes Dashes in Options 2025 if [ $Option == "d" ]; then 2026 set -x 2027 fi 2028 if [ $Option == "m" ]; then 2029 MPLAYER=1 2030 fi 2031 if [ $Option == "t" ]; then 2032 MPLAYER=0 2033 fi 2034 if [ $Option == "a" ]; then 2035 input_aspect="$3" #force aspect ratio of input file 2036 input_aspect_cmd="-aspect $3" 2037 fi 2038 fi 2039# check for needed applications... 2040for exe in transcode mplex mplayer awk wc sed tcprobe bc grep yuvscaler mp2enc mpeg2enc; do 2041 if [ -z "`which $exe`" ]; then 2042 echo -e "\a" 2043 echo "Error: $exe isn't installed or isn't in your path!" 2044 exit 1 2045 fi 2046 done 2047 2048 if [ $alt_scale -eq '1' ]; then 2049for exe in y4mscaler; do 2050 if [ -z "`which $exe`" ]; then 2051 alt_scale=0 2052 fi 2053 done 2054 fi 2055 2056# Call Scan Versions to detect the Versions of the Supported Utilities 2057scan_versions 2058# extract info from file... 2059FILE=$1 2060 2061 if [ "$FILE" == "/dev/cdrom" -o "$FILE" == "/dev/dvd" ]; then 2062 if [ $MPLAYER -eq '0' ]; then 2063# Call DvDCdrom function 2064 dvdcdrom 2065 else 2066 echo -e "\a" 2067 echo "" 2068 echo " DvD Access not functional with the Mplayer Version of Mkxvcd " 2069 echo " Edit The Script and set MPLAYER=0 or use -t on commandline " 2070 echo "" 2071 echo -e "\a" 2072 exit 2073 fi 2074 fi 2075 2076 2077#Call Detect Source Video Stats Function 2078detect 2079 2080#Call Video Type Function 2081videotype 2082 if [ $height -lt $width ]; then 2083 2084#Call Crop Detect Function 2085crop_detect 2086 fi 2087 if [ $dvdcd -eq '0' ]; then 2088 hxw="$width"x"$height" 2089 height_orig=$height 2090 width_orig=$width 2091 total=$[HOURS+$MINUTES] 2092 Aspects=`echo "scale=2 ; ($width_orig / $height)" | bc -l | sed 's/[.]//g'` 2093 if [ $Aspects -gt '176' ]; then 2094 Aspects=2 2095 else 2096 Aspects=1 2097 fi 2098 fi 2099 2100echo "" 2101echo -e "$black Source Video Stats" 2102echo -e "$black---------------------------------------------" 2103echo -e "$black BitRate $red$bitrate" 2104echo -e "$black Width/Height $red$width$black"x"$red$height" 2105echo -e "$black Total Minutes $red$total" 2106movie_aspect1=`echo "scale=2 ; ($width_orig / $height)"| bc -l` 2107echo -e "$black Aspect Ratio $red$movie_aspect1:1" 2108echo -e "$black---------------------------------------------" 2109echo "" 2110$reset 2111 2112# see if fullscreen is wanted... 2113vflag=0 2114 if [ `echo "scale=0 ; ($width / $height)"| bc -l` -eq '1' -a $dvdcd -eq '0' -a $bypass_fullscreen -eq '0' -a $mpeg_type -ne '5' ]; then 2115 Vid_PROMPT='Video Is Full Screen, add black borders? (y/n)' 2116 2117 echo -n "$Vid_PROMPT" 2118 read line 2119 2120 case $line in 2121 'y') Mode= 2122 aspect=2 2123 vflag=2 2124 Aspects=2 ;; 2125 'Y') Mode= 2126 aspect=2 2127 vflag=2 2128 Aspects=2 ;; 2129 'n') Mode=RESAMPLE 2130 export_aspect="--export_asr 2" 2131 aspect=2 2132 Aspects=1 2133 vflag=1 ;; 2134 'N') Mode=RESAMPLE 2135 export_aspect="--export_asr 2" 2136 aspect=2 2137 Aspects=1 2138 vflag=1 ;; 2139 *) Mode= 2140 aspect=2 ;; 2141 esac # 2142 fi 2143 2144 2145# set basename of the movie... 2146 if [ $dvdcd -eq '0' ]; then 2147 FileLength=`basename "$FILE" | wc -c` 2148 for ext in .asf .avi .mov .mpg .mpeg .ogm .rm .vob \ 2149 .ASF .AVI .MOV .MPG .MPEG .OGM .RM .VOB \ 2150 .Avi .Asf .Mov .Mpg .Mpeg .Ogm .Rm .Vob; do 2151 if [ $FileLength -gt "`basename "$FILE" $ext | wc -c`" ]; then 2152 FILE2=`basename "$FILE" $ext` 2153 if [ $ext == ".ogm" ]; then 2154 dashx="-x mplayer,ogg" 2155 fi 2156 fi 2157 done 2158 fi 2159 2160# Tell people that there format is not supported :-( 2161FileLength=`basename "$FILE2" | wc -c` 2162 if [ $FileLength -eq '1' -a $dvdcd -eq '0' ]; then 2163 echo -e "\a" 2164 echo "Supported Formats -> asf avi mov mpg mpeg ogm rm" 2165 echo "" 2166 echo "Unsupported File Format $FILE" 2167 echo "Nothing to Do." 2168 echo "" 2169 exit 0 2170 fi 2171 FILE2=`echo "$FILE2" | sed 's/ /-/g'| sed 's/[{]//g' | sed 's/[}]/-/g'\ 2172 | sed 's/[[]//g' | sed 's/[]]//g' | sed 's/[(]//g' | sed 's/[)]//g' | sed 's/[..]/./g'` # Replace Spaces in File Names with a "-" 2173 2174 if [ -e $FILE2.mpa ]; then 2175 echo "------------------------------------------" 2176 echo " Is there another Mkxvcd Process running? " 2177 echo "------------------------------------------" 2178 echo -n " $FILE2.mpa exists, Continue? (y/n)" 2179 read line 2180 case $line in 2181 'y') echo ;; 2182 'Y') echo ;; 2183 'n') echo " Ending Session " 2184 exit 0 ;; 2185 'N') echo " Ending Session " 2186 exit 0 ;; 2187 *) echo " Inproper Responce Exiting! " 2188 exit ;; 2189 esac # 2190 fi 2191 2192 2193 tmpframerate=`echo $framerate_orig | awk -F . '{print $1}'` 2194 if [ $framerate -ne '23' -a $transversion -gt '068' -a $MPLAYER -eq '0' ]; then 2195# Call Conversion Function 2196convert 2197 if [ $cflag -eq '1' ]; then 2198 framerate=23 2199 fi 2200 fi 2201 2202#Call Resize Function 2203calctype 2204 2205#Call Quantisation and Bitrate Function 2206select_quant 2207 2208# abort if fps is not 29, 30, 25, 24, 23... 2209 if [ "$fps" == "" -a $framerate -ne '25' ]; then 2210 echo Source Movie is not standard Exiting!!! 2211 echo FrameRate $framerate 2212 exit 1 2213 fi 2214 2215 if [ $mpeg_type -eq '0' -o $mpeg_type -eq '1' -o $mpeg_type -eq '2' ]; then 2216 mpeg_extention=m1v 2217 else 2218 mpeg_extention=m2v 2219 fi 2220 2221#Call Select 16:9 WideScreen 2222select_16:9 2223 2224#Call Quantisation and Bitrate Function 2225select_quant 2226 fi 2227 vop=`echo $vop | awk '{print $2}'` 2228 if [ $mplayerv1 -eq '0' ]; then 2229 vop=`echo $vop | awk -F , '{print $3","$2","$1}'` 2230 vopc=`echo $vopc | awk -F , '{print $1}'` 2231 vop="-vop $vop,$vopc" 2232 else 2233 vop="-vf $vopc$vop" 2234 fi 2235 if [ $dvdcd -eq '1' ]; then 2236 FILE=$FILE1 2237 2238 vop="-vf $vopc" 2239 vop="$vop"scale=$width_orig:$height_orig,scale=352:$exp_height,expand=352:240"" 2240 fi 2241 if [ $preview -eq '1' ]; then 2242p_aspect= 2243forceidx= 2244#pop up mplayer to show a sample 2245 if [ $ext2 == ".ogm" -o $ext2 == ".Ogm" -o $ext2 == ".OGM" ]; then 2246 forceidx="-forceidx" 2247 fi 2248 if [ $MPLAYER -eq '1' -a $mplayerv1 -eq '0' ]; then 2249 vop=`echo $vop | awk '{print "-vop "$2}'` 2250 echo "mplayer $forceidx -really-quiet -ss 250 -nosound $p_aspect $vop "$FILE" -frames 500" 2251 mplayer $forceidx -really-quiet -ss 250 -nosound $p_aspect $vop "$FILE" -frames 500 -vo x11 2252 else 2253 echo "mplayer $forceidx -really-quiet -ss 250 -nosound $p_aspect $vop "$FILE" -frames 500" 2254 mplayer $forceidx -really-quiet -ss 250 -nosound $p_aspect $vop "$FILE" -frames 500 -vo x11 2255 fi 2256 fi 2257 FILE="$1" 2258 if [ $mpeg_type -eq '1' ]; then 2259 Quantisation= 2260 else 2261 Quantisation="-q $quantisation" 2262 fi 2263 if [ $mod_quant_vcdbitrate -eq '1' ]; then 2264echo "" 2265echo -e " Current Quantisation is \033[1m$quantisation\033[0m " 2266Quant_PROMPT=" Whould you like to Select another \033[1mQuantisation 1,2,3,4,5,6\033[0m ? " 2267 echo -n -e "$Quant_PROMPT" 2268 read line 2269 2270 case $line in 2271 2272 '1') quantisation=1 ;; 2273 '2') quantisation=2 ;; 2274 '3') quantisation=3 ;; 2275 '4') quantisation=4 ;; 2276 '5') quantisation=5 ;; 2277 '6') quantisation=6 ;; 2278 *) ;; 2279 esac # 2280 2281 if [ $quantisation -eq '3' -a $aspect_flag -ne '2' ]; then 2282 max_bitrate=`echo "scale=0 ; (($exp_height * 795) / $total)"| bc -l` 2283 fi 2284 if [ $quantisation -eq '3' -a $aspect_flag -eq '2' ]; then 2285 max_bitrate=`echo "scale=0 ; ((($exp_height-57) * 795) / $total)"| bc -l` 2286 fi 2287 if [ $quantisation -eq '4' -a $aspect_flag -ne '2' ]; then 2288 max_bitrate=`echo "scale=0 ; ((($exp_height+25) * 795) / $total)"| bc -l` 2289 fi 2290 if [ $quantisation -eq '4' -a $aspect_flag -eq '2' ]; then 2291 max_bitrate=`echo "scale=0 ; ((($exp_height) * 795) / $total)"| bc -l` 2292 fi 2293 if [ $quantisation -gt '5' ]; then 2294 max_bitrate=`echo "scale=0 ; ((($exp_height+$exp_height) * 795) / $total)"| bc -l` 2295 fi 2296echo -e " Current Video Bitrate is \033[1m$max_bitrate\033[0m " 2297Bitrate_PROMPT=" Change the value or \033[1mEnter for Defaults\033[0m ? " 2298 line=$max_bitrate 2299 echo -n -e "$Bitrate_PROMPT" 2300 read line 2301 2302 if [ $line ]; then 2303 max_bitrate=$line 2304 echo "" 2305 else 2306 echo "" 2307 fi 2308 fi 2309 if [ $mpeg_type -eq '1' ]; then 2310 Quantisation= 2311 else 2312 Quantisation="-q $quantisation" 2313 fi 2314 if [ $acodec == "a52" ]; then 2315 dashaf="-af volume=10" 2316 fi 2317# Call Commands Function 2318cmds 2319 2320 if [ $MPLAYER -eq '1' ]; then 2321 echo "$total Minutes" 2322 echo "" 2323 echo "$hxw $framerate_orig" 2324 echo "" 2325 echo "$mjpeg2enc2" 2326 echo "" 2327 echo "$mjpeg2enc3 " 2328 echo "" 2329 2330mkfifo -m 660 stream.yuv # create video and audio pipes... 2331 2332 2333 $mjpeg2enc1 | $mjpeg2enc3 & 2334# $mjpeg2enc1 | $mjpeg2enc2 | $mjpeg2enc3 & 2335 2336 2337 if [ $audio_compat -eq '0' ]; then 2338 echo "$mplay" 2339 mkfifo -m 660 stream.pcm 2340 $mp2enc1 | $mp2enc2 & # capture the audio pipe and encode... 2341 $mplay "$FILE" 2342 else 2343 echo "$mplay1" 2344 $snd "$FILE" 2> /dev/null & 2345 $mplay1 "$FILE" 2346 pid=`cat $FILE2.pid` 2347 kill -9 $pid 2> /dev/null 2348 rm -f $FILE2.pid 2349 2350 fi 2351 2352 rm -f stream.yuv # after finishing, remove the pipes... 2353 rm -f stream.pcm 2354 else 2355 2356 if [ $modedashZ -eq '1' -a $MPLAYER -eq '0' -a $transversion -gt '0610' -a $Fast -eq '1' ]; then 2357 Transcode_DashZ=' Do you wish to use Transcodes New Fast Resize ---> ' 2358 echo -n "$Transcode_DashZ" 2359 read line 2360 case $line in 2361 'y') dashB= 2362 dashZ="$dashZ,fast" 2363 Fast=1 ;; 2364 'Y') dashB= 2365 dashZ="$dashZ,fast" 2366 Fast=1 ;; 2367 'n') dashB= 2368 Fast=0 ;; 2369 'N') dashB= 2370 Fast=0 ;; 2371 *) dashB= 2372 Fast=0 ;; 2373 esac # 2374 2375 fi 2376 2377 test_framerate=`echo "scale=0 ; $framerate"| bc -l` 2378 if [ $altfps != '0' ]; then 2379 filters="$filters" 2380 fi 2381 if [ $acodec == "a52" ]; then 2382 dashs="-s 1.234" 2383 fi 2384 if [ $bitrate -lt '900' -a $transversion -gt '0611' ]; then 2385 filters="$filter5,$filters" 2386 fi 2387 if [ $bitrate -lt '900' -a $transversion -lt '0612' ]; then 2388 filters="$filter2,$filters" 2389 fi 2390 if [ $cflag -eq '1' ]; then 2391 filters="$filter1,$filters" 2392 fi 2393 if [ $framerate -eq '23' -a $framerate_orig != "23.976" -a $cflag -ne '1' -a $altfps -eq '0' ]; then 2394 filters="$filters,$filter1" 2395 export="--export_fps 23.98" 2396 fi 2397 if [ $framerate -eq '25' -a $test_framerate -ne '25' -a $cflag -ne '1' -a $altfps -eq '0' ]; then 2398 filters="$filters,$filter1" 2399 export="--export_fps 25.00" 2400 fi 2401 if [ $framerate -eq '29' -a $framerate_orig != "29.970" -a $cflag -eq '1' -a $altfps -ne '0' -o $framerate -eq '29' -a $framerate_orig != "29.971" -a $cflag -eq '1' -a $altfps -ne '0' ]; then 2402 filters="$filters,$filter1" 2403 export="--export_fps 29.971" 2404 fi 2405 echo "$total Minutes" 2406 echo "" 2407 echo $filters 2408 echo "" 2409cmds 2410echo "$trans1 "$trans2" $trans3 "$FILE" " 2411echo "" 2412 2413$trans1 "$trans2" $trans3 "$FILE" 2414fi 2415 2416 2417 if [ $mpeg_type -eq '1' -o $mpeg_type -eq '5' ]; then 2418 $mux1 >& mplex.error.$FILE2 2419 else 2420 $mux >& mplex.error.$FILE2 # multiplex the streams to a mpg... 2421 fi 2422 mux_error=`grep write mplex.error.$FILE2 | awk '{print $4}' | wc -w` 2423 if [ $mux_error -eq '0' ]; then 2424 rm -f $FILE2.$mpeg_extention # remove what we don't need anymore... 2425 rm -f $FILE2.mpa 2426 rm -f mplex.error.$FILE2 2427echo "" 2428 else 2429 echo " There has been a Write error "$FILE2""-$output_type1.mpg" " 2430 echo " Please Check the output files or disk space " 2431 echo "$FILE2.m1v and $FILE2.mp2 have not been Removed. " 2432 fi 2433 2434# say some nice things and also put some usefull info on the screen and in a file... 2435echo -e "\a" 2436echo "" 2437echo "All Done, enjoy your mpeg!" 2438echo "" 2439echo "If you have vcdimager and cdrdao on your system around, " 2440echo "and the rights to cdrdao and your devices are all setup, " 2441echo "you could also use the following;" 2442echo "vcdimager -t vcd11 -c xvcd.cue -b xvcd.bin yourmovie.mpg" 2443echo "cdrdao write --device 1,0,0 --driver generic-mmc-raw --speed 24 xvcd.cue" 2444echo "Off-course you have to replace the --device, --driver and --speed settings to your system" 2445echo "Or yust use your favourite tool to burn the cd..." 2446echo "BTW, don't be fooled by the 700 Mb. printed on your cd, it can contain 795Mb. of video... (I think ;)" 2447 2448# Show statistics on commandline and also put them in a file... 2449 2450 if [ $log_cmds -eq '1' -a $MPLAYER -eq '0' ]; then 2451echo "$trans1 "$trans2" $trans3 "$FILE" " >$FILE2-"$output_type".stats 2452 else 2453echo "$mjpeg2enc1 | $mjpeg2enc2 | $mjpeg2enc3" >$FILE2-"$output_type".stats 2454echo "$mp2enc1 | $mp2enc2" >>$FILE2-"$output_type".stats 2455echo "$mplay $FILE " >>$FILE2-"$output_type".stats 2456 fi 2457 2458 if [ $Aspects -eq '1' ]; then 2459 Aspect="Full Screen Video" 2460 else 2461 Aspect="Wide Screen Video" 2462 fi 2463 2464 if [ $log_cmds -eq '1' -a $MPLAYER -eq '0' ]; then 2465 echo " Video Source Stats " >>$FILE2-"$output_type".stats 2466 else 2467 echo " Video Source Stats " >>$FILE2-"$output_type".stats 2468 fi 2469 echo " ------------------------------------------------">>$FILE2-"$output_type".stats 2470 echo " Width Height "$width_orig"X"$height_orig" $Aspect ">>$FILE2-"$output_type".stats 2471 if [ $bitrate -eq '0' ]; then 2472 bitrate=VBR 2473 fi 2474 echo " BitRate $bitrate ">>$FILE2-"$output_type".stats 2475 echo " FrameRate $framerate_orig ">>$FILE2-"$output_type".stats 2476 echo " Length $[$HOURS / 60] Hours $MINUTES Minutes ">>$FILE2-"$output_type".stats 2477 2478 2479 if [ $framerate -ne '25' -a $mpeg_type -ne '5' ]; then 2480 width="352x240" 2481 else 2482 width="352x288" 2483 fi 2484 if [ $framerate -ne '25' -a $mpeg_type -eq '5' ]; then 2485 width="480x480" 2486 fi 2487 if [ $framerate -eq '25' -a $mpeg_type -eq '5' ]; then 2488 width="480x576" 2489 fi 2490 if [ $cflag -eq '1' ]; then 2491 width="352x240" 2492 fi 2493 2494 if [ $aspect_flag -eq '1' ]; then 2495 aspect_type="4:3" 2496 else 2497 aspect_type="16:9" 2498 fi 2499 2500 if [ $Aspects -eq '1' ]; then 2501 Aspect="Full Screen $aspect_type $output_type Video" 2502 else 2503 Aspect="Wide Screen $aspect_type $output_type Video" 2504 fi 2505 2506 echo "">>$FILE2-"$output_type".stats 2507 echo "">>$FILE2-"$output_type".stats 2508 echo " Conversion Stats ">>$FILE2-"$output_type".stats 2509 echo " ------------------------------------------------">>$FILE2-"$output_type".stats 2510 echo " Width Height "$width" $Aspect ">>$FILE2-"$output_type".stats 2511 echo " BitRate $max_bitrate ">>$FILE2-"$output_type".stats 2512 echo " Quantisation $quantisation ">>$FILE2-"$output_type".stats 2513 if [ $cflag -eq '1' ]; then 2514 echo " FrameRate 23.976 ">>$FILE2-"$output_type".stats 2515 else 2516 echo " FrameRate $framerate_orig ">>$FILE2-"$output_type".stats 2517 fi 2518 echo " Length $[$HOURS / 60 ] Hours $MINUTES Minutes ">>$FILE2-"$output_type".stats 2519 if [ $MPLAYER -eq '1' ]; then 2520 echo "">>$FILE2-"$output_type".stats 2521 echo " Conversion done with Mplayer Version $mplayerv">>$FILE2-"$output_type".stats 2522 else 2523 echo "">>$FILE2-"$output_type".stats 2524 echo " Conversion done with Transcode $transdisplay">>$FILE2-"$output_type".stats 2525 fi 2526 if [ $MPLAYER -eq '0' ]; then 2527 echo "">>$FILE2-"$output_type".stats 2528 echo " Plugin Filters Used ">>$FILE2-"$output_type".stats 2529 echo " ------------------------------------------------">>$FILE2-"$output_type".stats 2530 echo " $filters " >>$FILE2-"$output_type".stats 2531 else 2532 echo "">>$FILE2-"$output_type".stats 2533 fi 2534 echo "">>$FILE2-"$output_type".stats 2535 echo " Size of Converted files ">>$FILE2-"$output_type".stats 2536 echo " ------------------------------------------------">>$FILE2-"$output_type".stats 2537# Check and Display for output files and Size of each 2538 2539 for mpg in "$FILE2"-"$output_type"1.mpg "$FILE2"-"$output_type"2.mpg \ 2540 "$FILE2"-"$output_type"3.mpg "$FILE2"-"$output_type"4.mpg \ 2541 "$FILE2"-S"$output_type"1.mpg "$FILE2"-S"$output_type"2.mpg \ 2542 "$FILE2"-S"$output_type"3.mpg "$FILE2"-S"$output_type"4.mpg; do 2543 2544 if [ -s "$mpg" ]; then 2545 mpg=`du -h "$mpg"` 2546 echo " $mpg">>$FILE2-"$output_type".stats 2547 else 2548 echo 2549 fi 2550 done 2551 2552 ended=`date +%s` 2553 total_seconds=$[$ended-$started] 2554 HOURS=$[total_seconds / 3600] 2555 MINUTES=$[total_seconds - 3600 * $HOURS] 2556 MINUTES=$[MINUTES/60] 2557 SEC=$[$total_seconds % 60] 2558 2559 if [ $HOURS -eq '1' ]; then 2560 b_hours=Hour 2561 else 2562 b_hours=Hours 2563 fi 2564 if [ $MINUTES -eq '1' ]; then 2565 b_min=Minute 2566 else 2567 b_min=Minutes 2568 fi 2569 if [ $SEC -eq '1' ]; then 2570 b_sec=Second 2571 else 2572 b_sec=Seconds 2573 fi 2574 2575 echo "">>$FILE2-"$output_type".stats 2576 echo "">>$FILE2-"$output_type".stats 2577 echo " Total Run Time -------------------> $HOURS $b_hours $MINUTES $b_min $SEC $b_sec ">>$FILE2-"$output_type".stats 2578 echo "">>$FILE2-"$output_type".stats 2579 echo "">>$FILE2-"$output_type".stats 2580 cat $FILE2-"$output_type".stats 2581 if [ $Log -eq '0' ]; then 2582 rm -f $FILE2-"$output_type".stats 2583 fi 2584 if [ $Log -eq '0' ]; then 2585 rm -f $FILE2-"$output_type".stats 2586 fi 2587