Ubuntu – Recovering corrupted m4a recordings

aacffmpegm4asound

I have been using Ubuntu on my school computer this year, I usually record the lectures that I can't hope to keep up with the prof, I have permission to do this. I have been using the default audio recorder that you can install with sudo apt-get install audio-recorder because it was the easiest to use. Earlier in the semester they recordings were fine. But now they are corrupt as soon as the recording is done. They are in the .m4a format.

I have tried many tutorials, including editing the hex data of the recording, no luck. I do not know where the recording starts since when I try to make a new recording it is corrupt off the bat. I have tried using ffmpeg to get this error, moov atom not found, which looking up does nothing to help solve the problem. Or I get an error saying protocol not found. Did you mean in.m4a? which is the name of the file, that I typed in correctly. ffmpeg returns a “protocol not found” error. Then it says do you mean the file that I did put in. Faad returns this error: Unable to find correct AAC sound track in the MP4 file. Also I tried an mp4 repair service and it works so the file should be able to be fixed. But it would cost $86 for it, and I need to fix 6 recordings.

I have tried uninstalling and reinstalling the restricted codecs.

Any help would be greatly appreciated.

Best Answer

See here, at the bottom of the page.
Install faad if needed sudo apt install faad
dd ibs=1 skip=44 if=yourfilename.m4a of=raw.m4a
faad -a newname.m4a raw.m4a
All credits to the author of the link I am pointing to, cause I do not know what I am doing, but I tested it on your bigger file, and it works. First command takes some time. Be patient. Tried it on ubuntu 16.04.

As pointed out in the comments, the result can be opened in VLC, but not in Audacious. But we can use vlc to transcode it, or rewrite it to another format. The script below converts all *.m4a files in the current directory to *.mp3.
#!/bin/bash

quote=\"  
executable="/usr/bin/vlc"
argument3=vlc://quit

#transcoding parameters
acodecvalue=mp3
bitratevalue=128
accessvalue=file
muxvalue=raw

for x in *.m4a; do
    inputname="${x}"
    strippedname=${x%.m4a}
    outputname=${strippedname}.mp3
    quote_outputname=${quote}./${outputname}${quote}
    echo ${inputname}
    echo ${quote_outputname}
    qtranscode=#transcode{vcodec=none,acodec=$acodecvalue, # continue line !
    ab=$bitratevalue,channels=$channelsvalue}              # continue line !
    :standard{access=$accessvalue,mux=$muxvalue,dst=${quote_outputname}}
    argument1="$inputname"
    argument2=--sout=$qtranscode
    "$executable" -I dummy "$argument1" "$argument2" "$argument3"
done