Converting m4a to wav using ffmpeg – ffmpeg Tutorial

By | October 20, 2022

In order to convert m4a to wav, we can use python pydub.

Converting m4a to wav using pydub in Python – Python Tutorial

However, if you can not install python pydub in your system, how to convert? In this tutorial, we will introduce you how to use ffmpeg to convert m4a to wav directly.

Preliminary

If you are using linux system, you can install ffmpeg offline as follows:

Install FFmpeg in Linux Offline: A Step Guide – Linux Tutorial

View audio information

In order to conver to m4a to wav correctly, we should know the sample rate, mono or stereo. We can use ffprobe to check them.

View Audio Sample Rate, Data Format PCM or ALAW Using ffprobe – Python Tutorial

View audio information using ffprobe

Use ffmpeg to convert m4a to wav

We can use ffmpeg command to convert. Here is a command example:

ffmpeg -i m4a_file_name -ar sample_rate -ac channel_num -f wav wav_file_name

Here

sample_rate: the sample rate of wav_file_name, it can be 8000, 16000 et al.

channel_num: the channel num of wav_file_name, we often keep the channel num of m4a_file_name and wav_fle_name same

1–mono  2–stereo

Here is an example:

ffmpeg -i test.m4a -ar 8000 -ac 1 -f wav test.wav

Moreover, we also can use python subprocess to execute this command using python script. Here is the tutorial:

Implement Python subprocess.Popen(): Execute an External Command and Get Output

Leave a Reply

Your email address will not be published. Required fields are marked *