toolkit / ogg2wav
k4d3's picture
whisper stuff
1f9dab2
raw
history blame
898 Bytes
#!/bin/zsh
# Function to convert ogg to wav
convert_ogg_to_wav() {
local input_file="$1"
local output_file="${input_file:r}.wav"
ffmpeg -i "$input_file" "$output_file"
echo "Converted: $input_file -> $output_file"
}
# Set the target directory
if [[ $# -eq 0 ]]; then
target_dir="."
else
target_dir="$1"
fi
# Check if the target directory exists
if [[ ! -d "$target_dir" ]]; then
echo "Error: Directory '$target_dir' does not exist."
exit 1
fi
# Find all .ogg files in the target directory and its subdirectories
ogg_files=($(find "$target_dir" -type f -name "*.ogg"))
# Check if any .ogg files were found
if [[ ${#ogg_files[@]} -eq 0 ]]; then
echo "No .ogg files found in '$target_dir' or its subdirectories."
exit 0
fi
# Convert each .ogg file to .wav
for file in "${ogg_files[@]}"; do
convert_ogg_to_wav "$file"
done
echo "Conversion complete."