Skip to content

Instantly share code, notes, and snippets.

@ciriti
Last active January 1, 2024 17:15
Show Gist options
  • Save ciriti/44ce29b1c0d5d6980d05c35e9838e57b to your computer and use it in GitHub Desktop.
Save ciriti/44ce29b1c0d5d6980d05c35e9838e57b to your computer and use it in GitHub Desktop.
Script to convert mp3 files to mp4
#!/bin/bash
# Get the authentication code from an environment variable
auth_code="$AUTH_CODE"
# Check if the authentication code is empty
if [ -z "$auth_code" ]; then
echo "Error: Authentication code not set. Please set the AUTH_CODE environment variable."
exit 1
fi
# Check if the AAX file name is passed as an argument
if [ -z "$1" ]; then
echo "Error: No AAX file name provided. Please provide the AAX file as an argument."
exit 1
fi
# Execute the AAXtoMP3 command with the authentication code and other options
# chmod +x AAX2MP3.sh
# ./AAX2MP3.sh name_of_the_file.aax
./AAXtoMP3 --authcode "$auth_code" -e:mp3 --chaptered --level 4 --loglevel 1 "$1"
#!/bin/bash
# =====> Make it executable
# chmod +x Mp3ToMp4Converter.sh
# Get the current folder path
folder=$(pwd)
# Loop through each mp3 file in the folder
for file in "$folder"/*.mp3; do
# Check if the file is an mp3 file
if [ -f "$file" ]; then
# Extract the filename without extension
filename=$(basename "$file" .mp3)
# Set the input image file
image="img.jpg"
# Set the output file name
outputFile="${filename}_output"
# Execute ffmpeg command on each mp3 file
ffmpeg -i "$file" -loop 1 -i "$image" -c:a copy -c:v libx264 -shortest "${outputFile}.mp4"
echo "Processed file: $file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment