Created
June 14, 2023 00:36
-
-
Save JohannSuarez/8ecc6c6f3eb29d81649d4c9bde2d9138 to your computer and use it in GitHub Desktop.
Split Audio Into Smaller Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <input_song>" | |
exit 1 | |
fi | |
input_song="$1" | |
extension="${input_song##*.}" | |
if [[ "$extension" != "mp3" && "$extension" != "wav" ]]; then | |
echo "Unsupported file format. Please provide an MP3 or WAV file." | |
exit 1 | |
fi | |
output_format="mp3" | |
if [ "$extension" = "wav" ]; then | |
output_format="wav" | |
fi | |
ffmpeg -i "$input_song" -f segment -segment_time 10 -codec:a copy output_%03d.$output_format | |
k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment