Skip to main content

A Python package for converting M4S audio files to MP3 format.

Project description

m4s2mp3

A Python package for converting M4S audio files to MP3 format.

Features

  • Convert single M4S files to MP3
  • Convert all M4S files in a directory to MP3
  • Merge multiple M4S files into a single MP3 file
  • Command-line interface for easy usage

Installation

pip install m4s2mp3

Note: This package depends on pydub which requires ffmpeg to be installed on your system. Please follow the pydub installation guide to install ffmpeg.

Usage

As a command-line tool

# Convert a single file
m4s2mp3 input.m4s

# Convert a single file with custom output name
m4s2mp3 input.m4s -o output.mp3

# Convert all m4s files in a directory
m4s2mp3 /path/to/m4s/files/

# Convert all m4s files to a custom output directory
m4s2mp3 /path/to/m4s/files/ -o /path/to/output/

# Merge all m4s files into a single mp3 file
m4s2mp3 /path/to/m4s/files/ --merge -o output.mp3

As a Python library

from m4s2mp3 import convert_m4s_to_mp3, convert_multiple_m4s_to_mp3, merge_m4s_files_to_mp3

# Convert a single file
convert_m4s_to_mp3("input.m4s", "output.mp3")

# Convert all m4s files in a directory
convert_multiple_m4s_to_mp3("/path/to/m4s/files/", "/path/to/output/")

# Merge all m4s files into a single mp3 file
merge_m4s_files_to_mp3("/path/to/m4s/files/", "merged_output.mp3")

API

convert_m4s_to_mp3(input_path: str, output_path: str = None) -> str

Convert a single M4S file to MP3 format.

  • input_path: Path to the input M4S file
  • output_path: Path for the output MP3 file. If not provided, uses the same name as input with .mp3 extension.
  • Returns: Path to the converted MP3 file

convert_multiple_m4s_to_mp3(input_dir: str, output_dir: str = None) -> list

Convert all M4S files in a directory to MP3 format.

  • input_dir: Directory containing M4S files
  • output_dir: Directory for output MP3 files. If not provided, uses the same directory as input files.
  • Returns: List of paths to converted MP3 files

merge_m4s_files_to_mp3(input_dir: str, output_path: str) -> str

Merge all M4S files in a directory into a single MP3 file.

  • input_dir: Directory containing M4S files
  • output_path: Path for the output MP3 file
  • Returns: Path to the merged MP3 file

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

m4s2mp3-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

m4s2mp3-0.1.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file m4s2mp3-0.1.3.tar.gz.

File metadata

  • Download URL: m4s2mp3-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.4 Windows/11

File hashes

Hashes for m4s2mp3-0.1.3.tar.gz
Algorithm Hash digest
SHA256 13bf99b5cc3bbd4c39169f959d76b3cd19e53c819bda355720436fd4280c3cf9
MD5 4924a36a5383265eca099988c26efe46
BLAKE2b-256 a93b32817d2e97b550afccff34b1bde177042017dc100c01db7680581a225c68

See more details on using hashes here.

File details

Details for the file m4s2mp3-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: m4s2mp3-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.4 Windows/11

File hashes

Hashes for m4s2mp3-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 93858632b522b132fa969c68a9f597440550757b3ecda1fde17dfbca412fbe2f
MD5 e88ac793aa7b8f92bd6b2450e9118ccd
BLAKE2b-256 e8de7a1c4b2e9fc1ab6a16e26a43cd8de11506c32b177f4cbf10681088ad7568

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page