Convert ogg to mp3 #194
jim-alexander
started this conversation in
General
Replies: 1 comment
-
With some more 'prompt engineering' I've come up with the following shell script file which appears to have solved it. #!/bin/bash
# Check if source and destination directories are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 /path/to/source/ogg_files /path/to/destination/mp3_files"
exit 1
fi
# Source and destination directories
SOURCE_DIR="$1"
DEST_DIR="$2"
# Create the destination directory if it doesn't exist
mkdir -p "$DEST_DIR"
# Loop through all .ogg files in the source directory
for ogg_file in "$SOURCE_DIR"/*.ogg; do
# Extract filename without extension
filename=$(basename "$ogg_file" .ogg)
# Define the output mp3 file path
mp3_file="$DEST_DIR/$filename.mp3"
echo "Converting $ogg_file to $mp3_file..."
# Conversion command with reduced logging
ffmpeg -loglevel error -n -i "$ogg_file" -c:a libmp3lame -q:a 1 \
-map_metadata 0 -map_metadata 0:s:0 -map 0 \
-id3v2_version 3 -write_id3v1 1 "$mp3_file"
# Check for conversion success
if [ $? -eq 0 ]; then
echo "$ogg_file converted successfully to $mp3_file"
else
echo "Error converting $ogg_file"
fi
done
echo "All conversions complete!"
Usage: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
I've downloaded.. a LOT of music and then realised that
ogg
isn't compatible with my iPod classic so I need to convert it to mp3.Is there some smart way to achieve this using the zotify tool itself?
I've been trying various ffmpeg commands that I find online but I'm not having much luck with a command that will convert the metadata (artist, album etc) and the album art all in one, I've had success with each but not both unfortunately.
Even if you can't do it with zotify / if you know a reliable ffmpeg command let me know thank you 👍
Beta Was this translation helpful? Give feedback.
All reactions