Last active
February 14, 2025 20:25
-
-
Save macmichael01/548d984b1c4af7d2ca41960056ee287e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # A simple script that takes an mp4, grabs the audio, and converts to an mp3. | |
| # Toss this script into a directory with mp4 to be converted into audio files. | |
| # Ensure that you have ffmpeg installed located here: https://ffmpeg.org/download.html | |
| # Loop through all MP4 files in the current directory | |
| for file in *.mp4; do | |
| # Check if the file exists (to avoid error if no MP4 files) | |
| if [[ -f "$file" ]]; then | |
| echo "Converting $file to MP3..." | |
| # Extract audio and convert to MP3 | |
| ffmpeg -i "$file" -vn -acodec libmp3lame -ab 192k "${file%.mp4}.mp3" | |
| fi | |
| done | |
| echo "Conversion complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment