步骤 1:下载并安装 FFMPEG
Windows 系统:从 FFMPEG 官方网站下载 FFMPEG 可执行文件。解压文件并将 bin 文件夹添加到系统的 PATH 环境变量中。
Mac 系统:打开终端并运行以下命令:
brew install ffmpeg
步骤 2:导航到包含 M4A 文件的目录
使用 cd 命令更改目录。例如:
cd path/to/your/audio/files
步骤 3:使用 FFMPEG 将 M4A 转换为 MP3
在终端或命令提示符中运行以下命令,将 input.m4a 替换为您的 M4A 文件的名称,将 output.mp3 替换为您的 MP3 文件的名称:
ffmpeg -i input.m4a -c:v copy -c:a libmp3lame -q:a 4 output.mp3
转换完成后,您应该会在指定目录中看到新的 MP3 文件。播放文件以确保转换成功且音频质量符合您的预期。
要自动覆盖现有的 .mp3
文件而不提示,请将 -y
标志添加到 ffmpeg
(强制覆盖)。
更新的命令:
for file in *.m4a; do ffmpeg -y -i "$file" -c:v copy -c:a libmp3lame -q:a 4 "${file%.m4a}.mp3"; done
—
如果您想跳过现有文件(不覆盖)
请改用 -n
:
for file in *.m4a;执行 ffmpeg -n -i "$file" -c:v copy -c:a libmp3lame -q:a 4 "${file%.m4a}.mp3"; done
—
附加:通过添加后缀(例如 _converted
)避免覆盖
如果您想同时保留原始文件和新文件:
for file in *.m4a; 执行 ffmpeg -i "$file" -c:v copy -c:a libmp3lame -q:a 4 "${file%.m4a}_converted.mp3"; done
这将创建类似 song.mp3
→ song_converted.mp3
的文件。
如果您需要进一步调整,请告诉我!
Step 1: Download and Install FFMPEG
For Windows: Download the FFMPEG executable from the official FFMPEG website. Extract the files and add the bin folder to your system’s PATH environment variable.
For Mac: Open the Terminal and run the following command:
brew install ffmpeg
Step 2: Navigate to the Directory Containing Your M4A File
Use the cd command to change the directory. For example:
cd path/to/your/audio/files
Step 3: Convert M4A to MP3 Using FFMPEG
Run the following command in the terminal or command prompt, replacing input.m4a with the name of your M4A file and output.mp3 with the desired name for your MP3 file:
ffmpeg -i input.m4a -c:v copy -c:a libmp3lame -q:a 4 output.mp3
Once the conversion is complete, you should see your new MP3 file in the specified directory. Play the file to ensure the conversion was successful and the audio quality meets your expectations.
To automatically overwrite existing .mp3
files without being prompted, add the -y
flag to ffmpeg
(which forces overwriting).
Updated Command:
for file in *.m4a; do ffmpeg -y -i "$file" -c:v copy -c:a libmp3lame -q:a 4 "${file%.m4a}.mp3"; done
-y
tells ffmpeg
to overwrite without asking.
—
If You Want to Skip Existing Files (No Overwrite)
Use -n
instead:
for file in *.m4a; do ffmpeg -n -i "$file" -c:v copy -c:a libmp3lame -q:a 4 "${file%.m4a}.mp3"; done
-n
skips conversion if the output file already exists.
—
Extra: Avoid Overwriting by Adding a Suffix (e.g., _converted
)
If you want to keep both original and new files:
for file in *.m4a; do ffmpeg -i "$file" -c:v copy -c:a libmp3lame -q:a 4 "${file%.m4a}_converted.mp3"; done
This will create files like song.mp3
→ song_converted.mp3
.