2

I have a .mp4 audio file that I want to convert to a 8-bit unsigned PCM format for an Arduino Uno using the TMRpcm library.

It also could be a .wav file. Anyways, I have tried many things to no avail. The closest I got was with Audacity using the NIST Sphere codec. I tried to do this with FFmpeg, but it only supports demuxing NIST Sphere files. How do I convert audio to this format on Mac OS X (10.10.2)?

Coder-256
  • 5,212
  • 2
  • 23
  • 51

2 Answers2

4

avconv is a fork from ffmpeg ... so use ffmpeg if you wish

avconv -i input.mp4 -ar 8000 -acodec pcm_u8 -ac 1 output.wav

WAV is the container format for the PCM codec so if you MUST have PCM then get into a binary file editor (wxHexEditor is a nice one) and delete the first 44 bytes (its header) of that WAV file

So above gives you 8000 samples per second and a bit depth of 8 bits, and mono.

verify this using

avprobe some_video_audio_file.wav

see bit depth listing available using avconv here

Community
  • 1
  • 1
Scott Stensland
  • 26,870
  • 12
  • 93
  • 104
0

I realized that I was trying to convert a corrupt audio file. Audacity converted a valid file correctly.

Coder-256
  • 5,212
  • 2
  • 23
  • 51