22

I recorded an 85-minute AAC/m4a file using Notability on my iPad. This app has always worked well before but for some reason there was a problem this time. The relevant file shows up as having 21MB (about the right size) and appeared to be recording normally, but when I tried to play it (using Notability or any other player - tried Quicktime, Real Player, Audacity, VLC and WondersharePlayer) it shows up as having zero duration. I am using a Mac with Mavericks installed.

In desperation I ran the file through: http://mp4repair.org/pwt6/preview.html It came up straight away as a 1 hour 25 minute sound file with a 95% "repair score". There is also a preview that sounds right. The only problem is that they want about $90 for what looks like a pretty simple fix. Can anyone suggest a way that I might be able to get access to this file without paying lots of money? It seems like it should not be difficult but I just don't seem to be able to find the key to the puzzle.

Many thanks in advance for any thoughts/suggestions you might have,

James

10
  • Do you mind posting a link to the file? Feb 19, 2014 at 21:32
  • Links on that site go to a downloadable program for offline: aeroquartet.com/movierepair/download Feb 19, 2014 at 22:01
  • Audacity has a "repair" feature (in the Effects menu). You might try that.
    – naught101
    Feb 19, 2014 at 23:39
  • I tried using "treasured", the downloadable programme. It seems mainly aimed at video and only gives a "repair score of 35%". What is more it appears mainly aimed (again) at drumming up business for the expensive repair service those guys are running. That service is probably cheap for professionals, but for a home user it's overpriced (and my guess is the fix is pretty basic).
    – Jim
    Feb 20, 2014 at 11:36
  • The Audacity "repair" feature will not work because I cannot open the file in Audacity. It says it is not a supported format (I have downloaded the FFmpeg Library and it works with other m4a files).
    – Jim
    Feb 20, 2014 at 11:53

3 Answers 3

15

This guide worked 100% for me - it takes you through each step. Afterwards, the m4a file plays! Note: this is completely free. http://sysfrontier.com/en/2014/12/31/hello-world/

Also pasting instructions in case the link goes down in future:

How to fix corrupted voice memo (m4a) files.

Do you have broken voice memo files? You can fix those files by yourself. I will show you the steps in this article. Voice memo files have the extension “m4a”. It is audio data encoded in the AAC format and encapsulated in MPEG4 file container. You may fix files recorded with other programs like QuickVoice or on Android. File extensions may be mp4 or 3gp.

The m4a files get broken when some parts of header lost correct information. For example, when the bytes indicating the length of the audio data become 0, the file can not be replayed any more on iPhone, iPad, Mac or Windows PC.

But, in some cases you can fix the broken header by yourself by extracting the audio data, encoding it, and putting it into the new file container.

Let’s do it together.

STEPS for Windows PC

  1. Download faad.exe

Open http://rarewares.org/aac-decoders.php Click “Download (225kB)” of “FAAD2v20100614 CVS snapshot for Win32“. faad

Extract faad.exe from the downloaded zip file. Place it in the “Downloads” folder, for example.

  1. Download faac.exe

Open http://rarewares.org/aac-encoders.php Click “Download (191kB)” for “FAACv1.28 Binary for Win32“.faac

Extract faac.exe from the downloaded zip file. Place it in the same folder as above.

For example, you see faad.exe and faac.exe in the Downloads folder as below. downloads

  1. Download binary editor

You can choose any favorite binary editor. If you don’t know well, I will recommend HxD. Download a zip file from http://download.cnet.com/HxD-Hex-Editor/3000-2352_4-10891068.html or http://mh-nexus.de/en/downloads.php?product=HxD Extract setup.exe and click it to install.

  1. Place the file to the same directory.

Move your voice memo file from your iPhone to PC via iTunes. You can use other tools like iFunbox.

Please place the copied file to the same directory as where you placed the above faad.exe and faac.exe. We call the file “20140615 163625.m4a”, for example.

  1. Open the file with binary editor.

Please copy the broken m4a file to some folder for backup. Start HxD or your binary editor program and open the broken m4a file.

Press F key with control key to open the Find box. Type “mdat” and press the Find button.

Select from the beginning of the file to the “t” of “mdat” as shown below.

find_mdat

Press Delete key to delete the selected area. Press S key with control key to save.

  1. Decode by faad.exe

Press R key with Windows key to open the dialog. Type “cmd” and press OK button to open the Command Prompt.

In the command prompt window that was opened, type “cd Downloads” to move the Downloads folder. Type faad.exe “20140615 163625.m4a” and press the Enter key. In seconds or tens of seconds, you will find the decoded wave file named “20140615 163625.wav“.

Check if the command histories are like below. cmd1

  1. Encode by faac.exe

In the command prompt window, type faac.exe -b 160 -o repaired.m4a “20140615 163625.wav” and press the Enter key.

In seconds or minutes, you will find the encoded file named repaired.m4a. Please replay the repaired.m4a to see the audio content is what you want.

Check if the command histories are like below. cmd2

Company Information

SysFrontier Inc. 3-23-16, Ekoda, Aoba Ward, Yokohama, 225-0005, Japan.

7
  • 1
    The suggested link did not work for me. I got the following error when I ran FAAD.EXE: Error: Bitstream value not allowed by specification 0% decoding Audio.m4a
    – Jim Harlan
    Nov 28, 2017 at 18:47
  • 1
    I followed the above instructions and was successfully able to restore critical interviews I had recorded with my Android phone in M4A format. These steps saved me on Windows 10! Thanks! :) Feb 10, 2018 at 21:12
  • 1
    This also worked for me on macOS, using HexFiend as hex editor and installing faad2 using homebrew. Thanks!
    – intagli
    Jan 23, 2019 at 15:11
  • 1
    Also works great on Ubuntu Linux, just used GHex as the hex editor and removed the ".exe" part from the commands. Jan 25, 2019 at 21:57
  • On macOS, after deleting the starting parts in a hex editor, install faad2 and faac audio decoder and coders: brew install faad2, brew install faac. Then decode corrupted m4a file: faad corrupted.m4a generating wav file then encode it faac -b 160 -o repaired.m4a corrupted.wav. May 9, 2019 at 19:18
6

You could try rewriting the file using ffmpeg with the following command:

ffmpeg -i damagedfile.mp4 -c copy fixedfile.aac

Alternatively, you may use FAAD and a hex editor (e.g. Hexplorer). Find out where the actual data starts in a hex editor. Not always after the mdat entry - there may be a lot of zeros in the beginning of the file.

Simply copy everything afterwards to a new binary file, e.g. raw.aac. For the AAC format, every sample seems to begin with 0x21, which is a hint that you found the right position.

You then use FAAD to convert the corrected file using this command:

faad.exe -a out.aac raw.aac
5
  • If you are using a hex editor, what can help is to use 2 files: a good one and the corrupted one. If you look at the headers in both, you can spot dramatic differences and those may be problems. If your corrupted file is supposed to be 10 minutes, use a good 10 minute file for comparison. Feb 9, 2016 at 15:36
  • In the file I had, there was a lot of 0xa5 just before 0xe0 and then the 0x21 as pointed out (597 bytes in, in my case). Cut the file so it started from 0x21 (on Linux: dd if=original-file of=cut-file bs=1 skip=597) and ran it through faad. Got Error: Array index out of range but the file plays like a treat, only thing is that at the end, mplayer complains Error decoding AAC frame header.. Thanks!
    – thomasa88
    Jul 1, 2016 at 19:13
  • @thomasa88 I have deleted about 6 instances of the . and previous before .! but every time I get the same error : Bitstream value no allowed by spec. Any ideas?
    – SeanJ
    May 21, 2019 at 0:21
  • 1
    The note about 0x21 was the key for me. Deleted everything up to mdat, and then everything up to (but not including) the first hex value set to 21.
    – joshfindit
    Apr 6, 2021 at 0:19
  • 1
    As simple as it sounds, this worked for me hassle-free in July 2022. Thanks @Michael Hansen Buur Jul 19, 2022 at 19:55
0

Reaper is a quite successful DAW in opening corrupt and unsupported audio files and may help with this problem. It is not free but has a 60-day unlimited and never expiring trial which will be more than enough for your case.

2
  • "60-day unlimited and never expiring trial"; isn't that a paradox?
    – n00dles
    Sep 28, 2017 at 15:21
  • @MarcW No it is not a paradox. It just means the producer doesn't enforce a digital copy protection. This doesn't mean that the license extends beyond 60 days. Oct 21, 2017 at 12:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.