Commit 935cb540e45de06a2676e5d04a925a20c5075b74
1 parent
143ba2a4be
Exists in
master
check if avconv is installed
Showing 1 changed file with 21 additions and 15 deletions Side-by-side Diff
main_tools/FirstPass.sh
... | ... | @@ -188,22 +188,28 @@ |
188 | 188 | #-------------------------# |
189 | 189 | # Check Audio File Format # |
190 | 190 | #-------------------------# |
191 | -error=0 | |
192 | -temp=$(avconv -i $WAV_FILE 2>&1 | grep "16000 Hz") | |
193 | -if [ -z "$temp" ]; then error=1; fi | |
194 | -temp=$(avconv -i $WAV_FILE 2>&1 | grep "1 channels") | |
195 | -if [ -z "$temp" ]; then error=1; fi | |
196 | -temp=$(avconv -i $WAV_FILE 2>&1 | grep "s16") | |
197 | -if [ -z "$temp" ]; then error=1; fi | |
198 | - | |
199 | -if [ $error -eq 1 ] | |
191 | +test=$(whereis avconv) | |
192 | +if [ "$test" == "avconv:" ] | |
200 | 193 | then |
201 | - print_message $WARNING 2 "[${BASENAME}] $WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" | |
202 | - print_message $INFO 3 "[${BASENAME}] avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" | |
203 | - avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav | |
204 | - WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav | |
205 | - FILENAME=$BASENAME.wav | |
206 | - print_message $INFO 1 "[${BASENAME}] new wav file : $WAV_FILE" | |
194 | + print_message $ERROR 1 "[${BASENAME}] avconv is not installed" | |
195 | +else | |
196 | + error=0 | |
197 | + temp=$(avconv -i $WAV_FILE 2>&1 | grep "16000 Hz") | |
198 | + if [ -z "$temp" ]; then error=1; fi | |
199 | + temp=$(avconv -i $WAV_FILE 2>&1 | grep "1 channels") | |
200 | + if [ -z "$temp" ]; then error=1; fi | |
201 | + temp=$(avconv -i $WAV_FILE 2>&1 | grep "s16") | |
202 | + if [ -z "$temp" ]; then error=1; fi | |
203 | + | |
204 | + if [ $error -eq 1 ] | |
205 | + then | |
206 | + print_message $WARNING 2 "[${BASENAME}] $WAV_FILE is not a wav file at 16000 Hz, 1 channel, 16bits\nhave to convert" | |
207 | + print_message $INFO 3 "[${BASENAME}] avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav" | |
208 | + avconv -i $WAV_FILE -threads 4 -vn -f wav -ac 1 -ar 16000 -ab 256000 $OUTPUT_DIR_BASENAME/$BASENAME.wav | |
209 | + WAV_FILE=$OUTPUT_DIR_BASENAME/$BASENAME.wav | |
210 | + FILENAME=$BASENAME.wav | |
211 | + print_message $INFO 1 "[${BASENAME}] new wav file : $WAV_FILE" | |
212 | + fi | |
207 | 213 | fi |
208 | 214 | |
209 | 215 | #---------------# |