Skip to content

Mr-Sunglasses/audio2mp3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

AUDIO2MP3

This is a Bash script that converts various audio file formats (e.g., .wav, .flac, .ogg, .aac, .m4a, .alac, .aiff, .opus) to .mp3. The script supports converting a single file or multiple audio files in a directory, with options for recursive directory search, skipping already existing files, and preserving metadata. It also includes a "no confirmation" mode for automatic overwriting of files.

Versions

Current version: 0.0.1

Table of Contents

Badges

Bash Version License

Installation

  1. Ensure you have FFmpeg installed on your system. FFmpeg is used for audio file processing.

    • On Ubuntu/Debian:

      sudo apt install ffmpeg
    • On Mac (using Homebrew):

      brew install ffmpeg
    • On Windows:
      Download FFmpeg from here and follow the instructions to set it up.

  2. Download the script from this repository and make it executable:

    chmod +x audio2mp3.sh

Usage

You can use the script to convert individual audio files or entire directories of audio files. Below are the command options and examples of usage:

Command Options

Usage: ./audio2mp3.sh -f <input_file> [-o <output_path>] | -d <directory> [-o <output_directory>] [-r] [-c] [-s] [-nc]

Options:
  Required Flags (Must provide either -f or -d):
    -f, --file <input_file>       Convert a single file.
    -d, --directory <directory>   Convert all supported files in a directory.

  Optional Flags:
    -o, --output <output_path>    Specify output file (if using -f) or output directory (if using -d).
    -r, --recursive               Process directories recursively.
    -c, --copy                    Convert without re-encoding if possible.
    -s, --skip-existing           Skip existing files without prompt.
    -nc, --no-confirm             Automatically overwrite existing files without asking.
    -h, --help                    Show this help message.

Examples

Convert a single audio file to MP3:

./audio2mp3.sh -f input.wav -o output.mp3

Convert all supported audio files in a directory:

./audio2mp3.sh -d /path/to/audio/files

Recursively search and convert all audio files in a directory and subdirectories:

./audio2mp3.sh -d /path/to/audio/files -r

Convert an audio file without re-encoding (if it is already in MP3 format):

./audio2mp3.sh -f input.mp3 -c

Skip existing files during conversion:

./audio2mp3.sh -d /path/to/audio/files -s

Automatically overwrite files without confirmation:

./audio2mp3.sh -d /path/to/audio/files -nc

License

This project is licensed under the MIT License. See LICENSE for more details.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change. Make sure to update tests as appropriate.

About

Convert any supported audio file to .mp3 using ffmpeg.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Shell 100.0%