trouble with my first bash script
Hi I am righting a script to use mencoder to convert videos the menu is giving my trouble it runs throw the menu options and closes the script
#!/bin/bash VAR="files.txt" DIR="srcdir" clear echo "Make The TV" echo "********************************" echo "MENU " echo "*******************************" echo "1. Video to xvid (1 pass )" echo "2. wmv two xvid (2 pass encoding)" echo "3. Video to flv (for the web)" echo "4. Video to NTSC_DVD " read yourch echo "$yourch" echo "Enter Video Directory" read $srcdir cd "$srcdir" touch $VAR find $srcdir > $VAR case $yourch in "$yourch != 1" ) xvid ;; "$yourch != 2" ) wmv ;; "$yourch != 3" ) flv ;; "$yourch != 4" ) dvd ;; esac xvid () { # Collect the files in the current directory cat $VAR | while read line; do # Loop read the filenames from the file INPUT=$(echo ${line}) # Grab the nxt new filename OUTPUT=${INPUT%.*i} # Append new extension OUTPUT+=".avi1" # Convert files mencoder "$INPUT" -ovc xvid -oac mp3lame -xvidencopts fixed_quant=4 -o "$OUTPUT" done } wmv () { # Collect the files in the current directory cat $VAR | while read line; do # Loop read the filenames from the file INPUT=$(echo ${line}) # Grab the nxt new filename OUTPUT=${INPUT%.*i} # Append new extension OUTPUT+=".avi1" # Convert files mencoder "$INPUT" \ -ofps 23.976 \ -oac mp3lame \ -ovc xvid \ -xvidencopts pass=1 -o /dev/null mencoder "$INPUT" \ -ofps 23.976 \ -oac mp3lame \ -ovc xvid \ -xvidencopts pass=2:bitrate=250 \ -o "$OUTPUT" done } flv () { # Collect the files in the current directory cat $VAR | while read line; do # Loop read the filenames from the file INPUT=$(echo ${line}) # Grab the nxt new filename OUTPUT=${INPUT%.*v} # Append new extension OUTPUT+=".flv" # Convert files ffmpeg -i "$INPUT" -ab 256 "$OUTPUT" done } dvd () { # Collect the files in the current directory cat $VAR | while read line; do # Loop read the filenames from the file INPUT=$(echo ${line}) # Grab the nxt new filename OUTPUT=${INPUT%.*g} # Append new extension OUTPUT+=".mpg" # Convert files ffmpeg -i "$INPUT" -target ntsc-dvd "$OUTPUT" done } #clean up after the script has run rm $VAR # Remove the text file with the file names |
The first thing I notice is "$" where it does not belong....
For variables: read name echo $name For files: touch filename echo "stuff" > filename Please put code into [code] tags for better readability |
ok thanks
|
Hi I finished the script for the most part when I convert wmv files to xvid I get audio skipping and sync problems any ideas?
Code:
|
No...no....
Add it this way... "[-code-]" some shell script code in between... "[-/-CODE-]" (Remove the 4 quotes and the 5 hyphens above) when you click on "reply with quote", click on the icon with the hash symbol...hope u get it... |
All times are GMT -5. The time now is 09:46 AM. |