How can I repair corrupted 3GP audio files?

I have several corrupted audio recordings which use the 3GP container.
Some of them use an AMR codec while others use an MP4a codec.
How can I repair them?

I have plenty of other recordings from the same source which are fine. I guess this might help to repair the bad ones.

I have seen that there are some online services that do repair this kind of files. The problem with these is that the prices are too steep for me. IIRC, they charge 30 bucks per repair. However, I have a lot of files to repair, and I can’t afford paying 30 bucks each time I want to fix one of them.

Note: I’m not sure if this is the right forum to ask because I don’t know if Audacity can handle this or I need a different kind of solution. If it turns Audacity can fix this, I guess the thread should be moved to the Windows forum.

Knowing Windows is good. Which Windows?

Fill in the narrative:
“I was hit by lightning while recording a soccer (football) match in Lithuania. Thirty sound files became corrupted.” Take me there. Describe what you were doing.

It’s rarely a good idea to jump into one of these jobs without some background. We’re not good with surprises.

Koz

Have you tried importing the files into Audacity? What happens?

I hope Windows is good for this, but I’m not sure. I have spent hours looking for a solution, and so far I’ve only found two options that seem promising. One is the online services I mentioned above. The other is a command line method available in Linux. Installing Linux (and learning again how to use it) to fix this problem sounds a bit overkill, but I would do it if it turns out it’s the only method that works.

Anyway, I have Audacity installed in a machine running Windows 7 Home Premium SP1. I made the recordings with an Android smartphone.

I have some difficulties with my social skills, and I have found that a great way of improving is to record myself when I interact with others. When I listen to the conversation afterwards it’s much easier to pinpoint the problems and look for ways of improvement. For that purpose I use exclusively my smartphone, an LG Optimus L7 (Android). Its recording capabilities aren’t great, but it does the job. I create these recordings in two ways:

  • Phone conversations: I have installed the app Automatic Call Recorder and configured it so that it automatically records all my phone calls. These are the recordings which use the AMR format.
  • Other conversations: I just use the standard voice recorder that comes preinstalled with Android. These are the recordings which use MP4a.

I get corrupted files when my phone runs out of battery during the recording. Right now I’m especially interested in the recording of a phone conversation. My phone ran out of battery while we were still talking, and that seems to be the reason why the file with the recording was corrupted. Apart from that, my phone is bloated with too many apps, and sometimes it behaves weirdly, but I don’t think that has affected the recordings.

Now there’s some background :wink:

I did, but it didn’t work. I just got a meaningless waveform. Anyway, I’ll describe what I did in case I did it wrong:

I found several tutorials which fix this kind of problem by importing the file as raw data. I followed one of those. However, they use other audio formats, which might or might not be the reason why it didn’t work for me.

The Import Raw Data dialog has several parameters:
Import Raw Data.png
In order to find the values for those parameters, I used files which were correctly recorded using the same apps (Voice Recorder and Automatic Call Recorder). I opened the healthy files in Audacity and looked for data that seemed to fit the parameters. The Track Control Panel seems to have some of the information I need:
Track control panel.png
So these would be the values:

  • AMR files: Mono, 8000 Hz, 32-bit float.
  • MP4a files: Mono, 44100 Hz, 32-bit float.

It seems obvious that Mono is the value for the Channels parameter and 44100/8000 Hz are the values for Sample rate. It also looks like 32-bit float is the value for Encoding, although I’m not so sure about this one.
I guess that Start offset and Amount to import are irrelevant. Anyway, I left the default values.
Regarding Byte order (endianness), I’ve no idea of what value I should use, so again I just left the default value, little-endian.

This is the result:
Imported track.png

Import Raw Data is for “lossless” files, or reduced bit-depth lossless files. You don’t have that kind of content in the 3GP files.

Steve meant normal File > Import > Audio… .

Don’t use Audacity for file information. The Audacity bit depth only shows the (PCM) resolution the file was imported at, and bit depth is not relevant to AMR and M4A. You can obtain “MediaInfo” from http://mediainfo.sourceforge.net/en/Download/Windows. Get the version without installer, because the installer may have malware or adware. Do your corrupt files open in MediaInfo?


Gale

When I try to import that way, I just receive an error message: Audacity did not recognize the type of the file.

Yes.

Info displayed for the corrupted files:

Voice recorder
Complete name: <name>.3gp
Format: MPEG-4
Format profile: 3GPP Media Release 4
Codec ID: 3gp4 (isom/3gp4)
File size: 10.2 MiB
IsTruncated: Yes
Phone call recorder
Complete name: <name>.3gp
Format: MPEG-4
Format profile: 3GPP Media Release 4
Codec ID: 3gp4 (isom/3gp4)
File size: 8.57 MiB
IsTruncated: Yes

Info displayed for healthy files:

Voice recorder
Complete name: <name>.3gp
Format: MPEG-4
Format profile: 3GPP Media Release 4
Codec ID: 3gp4 (isom/3gp4)
File size: 669 KiB
Duration: 1mn 37s
Overall bit rate mode: Constant
Overall bit rate: 56.5 Kbps

Audio ID: 1
Format: AAC
Format/Info: Advanced Audio Codec
Format profile: LC
Codec ID: 40
Duration: 1mn 37s
Bit rate mode: Constant
Bit rate: 54.8 Kbps
Nominal bit rate: 96.0 Kbps
Channel(s): 1 channel
Channel positions: Front: C
Sampling rate: 44.1 KHz
Frame rate: 43.066 fps (1024 spf)
Compression mode: Lossy
Stream size: 649 KiB (97%)
Title: SoundHandle
Language: English

Phone call recorder
Complete name: <name>.3gp
Format: MPEG-4
Format profile: 3GPP Media Release 4
Codec ID: 3gp4 (isom/3gp4)
File size: 392 KiB
Duration: 4mn 9s
Overall bit rate mode: Constant
Overall bit rate: 12.9 Kbps

Audio ID: 1
Format: AMR
Format/Info: Adaptive Multi-Rate
Format profile: Narrow band
Codec ID: samr
Duration: 4mn 9s
Bit rate mode: Constant
Bit rate: 12.8 Kbps
Channel(s): 1 channel
Sampling rate: 8 000 Hz
Bit depth: 13 bits
Stream size: 389 KiB (99%)
Title: SoundHandle
Writing library:
Language: English

Have you installed FFmpeg from Audacity Manual ? Audacity would need FFmpeg to even attempt the file.

So MediaInfo does not get as far as to know what codec the file is using.

If Audacity cannot import the file using the FFmpeg download above, hold SHIFT and right-click over the folder that contains the downloaded ffmpeg.exe. Choose “Open Command Window here”. Copy the problem files into the folder containing ffmpeg.exe.

Then type a command like this:

ffmpeg -i file_name.3gp -acodec copy new_file_name.3gp

This tells FFmpeg not to try to decode the file, but take a copy of its audio and write the copied audio to a new 3GP container (that is, without making it more lossy by re-encoding it) .

If writing a new 3GP container fails, try:

ffmpeg -i file_name.3gp -acodec copy new_file_name.mp4

There is no guarantee this will work or that it will recover meaningful audio, but it is worth trying for free.


Gale

Yes (I had it installed before I started to deal with this).

Actually, it does. That’s why I included the info displayed by MediaInfo for the healthy files. Since those are files recorded by the same app in the same device, it seems safe to assume that the codec (and any other technical details) is the same. Therefore, it’s AAC for the voice recorder and AMR for the phone call recorder.

I tried both methods with both corrupted files. The four attempts failed. The output of ffmpeg was the same in all four attempts, so I just copy here the output for one of the attempts:

ffmpeg -i Voice.3gp -acodec copy Voice_Test.3gp
ffmpeg version 2.2.2 Copyright (c) 2000-2014 the FFmpeg developers built on May 22 2014 19:56:44 with gcc 4.8.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0094f0a0]moov atom not found
Voice.3gp: Invalid data found when processing input
Conversion failed!

For the corrupt files it does not, which was the MediaInfo output I quoted.

I think you may probably be in the hands of the commercial repair vendors, though copying the data to a new container is bound to be one of their techniques too.

Have you tried this Android app https://play.google.com/store/apps/details?id=com.smamolot.mp4fix&hl=en_GB or searched for any other Android apps there may be? Most of the repair utilities seem to be for video and audio, though, not audio only.


Gale

It worked! Just for the voice recorder, though. It looks like for the time being the app only works with the AAC codec, which is the one that my voice recorder uses.

In case someone else wants to use this solution, there’s a caveat: The app doesn’t detect files with a 3gp extension. The solution is simply to change the extension to mp4.

Thank you so much, Gale. It’s a shame this forum doesn’t use a kudos system, I’d give you a lot :wink:

Any ideas about what to do with the AMR file?

Use a search engine, for example repair AMR file - Google Zoeken.

Obviously, exercise caution. In my experience easy solutions offered in YouTube videos with a link to a download are often scams or virus traps. Stick to downloading apps from the app manufacturer’s site.


Gale

I spent hours googling for a solution before posting here. Here’s a quick summary of the links returned by that particular query:

• Link 1: Offers two tools that sound like they could be useful: AMR Repair and AMR Recovery. Weirdly enough, the installer for both tools installs a program called Stellar Phoenix Photo Recovery, which, even more weirdly, turns out to be a recovery tool for corrupted storage drives. Looks great, but doesn’t repair audio files.
• Links 2 and 4: Advertise amrrepair.com, a website that is not even online.
• Link 3: Advertises the same program that I downloaded from link 1.
• Link 5: Temporarily offline.
• Link 6: Tool for novice users who don’t know how to play an audio file.
• Link 7: A guy asking for help with the same problem I have. He didn’t get any, unfortunately.
Etc.

This is not an Audacity problem, and we have already gone beyond call of duty helping you in your quest.

I did not investigate the links in the search query I gave and it is not our job to do so.

Feel free to let us know if you find a solution.

Gale

One last shot - it “may” be possible to persuade “EaseUS data recovery” to recover some of the AMR data. Definitely no guaranteed of success, but perhaps worth a shot.
This is their web address: http://www.easeus.com/storage-media-recovery/recover-amr-files-from-memory-card.html
I can’t help with that software as I’ve not used it for many years and it has probably changed a lot since then (and I’m not on Windows :wink:)
Also I’ve not checked if the free version supports AMR recovery.

I sent them a mail and I was quite surprised by their answer: Sorry that we don’t have a tool to fix audio files, Data Recovery Wizard can only recover the lost files. The last paragraph in this page seems to mean the opposite. I’ve sent them another mail asking for a clarification.

Since it looks really hard to repair the AMR files I checked again the online service I mentioned before. I was ready to pay 30 bucks to fix the file that I’m currently more interested in. Unfortunately, it turns out that they charge a lot more to repair this file: 90 bucks! I find that price unfair.

The website is mp4repair.org. I have looked for cheaper options, but I haven’t found any. Do you know a cheaper alternative?

mp4repair.org don’t seem to claim support for AMR, unless you found something to say they do.

http://grauonline.de/cms2/?page_id=5 don’t claim to repair AMR either but they are cheaper and there are alleged ways to make the software repair the entire file for free (I won’t say what those ways are here).


Gale

I tried their program, but it doesn’t repair my files. I sent them a mail asking for help, but they didn’t answer.