knulltroll

Untitled

Sep 1st, 2025 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | Source Code | 0 0
  1. echo "This is a Bash loop for converting .opus files to .mp3."
  2.  
  3. # Create the output directory if it doesn't exist
  4. mkdir -p outputs
  5.  
  6. # Check if there are any .opus files
  7. shopt -s nullglob
  8. opus_files=(*.opus)
  9.  
  10. if [ ${#opus_files[@]} -eq 0 ]; then
  11.     echo "No .opus files found in this directory."
  12.     exit 1
  13. fi
  14.  
  15. # Loop through each .opus file
  16. for f in "${opus_files[@]}"; do
  17.     echo "Converting '$f' to MP3..."
  18.     ffmpeg -i "$f" -c:a libmp3lame "outputs/${f%.opus}.mp3"
  19.     echo "Finished '$f'."
  20. done
  21.  
  22. echo "All conversions completed!"
  23.  
Tags: Opus to mp3
Advertisement
Add Comment
Please, Sign In to add comment