File size: 726 Bytes
5b73ede
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

# Create the wav directory if it doesn't exist
mkdir -p wav

# Find all .opus files in the opus directory and loop through them
find opus/ -name "*.opus" -print0 | while IFS= read -r -d $'\0' opus_file; do
  # Construct the corresponding .wav file path
  wav_file=$(echo "$opus_file" | sed 's|opus/|wav/|; s|\.opus$|\.wav|')

  # Create the subdirectory in wav/ if it doesn't exist
  mkdir -p "$(dirname "$wav_file")"

  # Convert the .opus file to .wav using ffmpeg, preserving original quality
  ffmpeg -i "$opus_file" "$wav_file"
  # Uncomment the line below to resample to 44100 Hz
  # ffmpeg -i "$opus_file" -ar 44100 "$wav_file"

  echo "Converted: $opus_file -> $wav_file"
done

echo "Conversion complete."