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.
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
This works but the values use in dd are not adequate for every case. Here the author of the original post explains why: Original post of this solution
Basically you are stripping the header of the file by skipping 44 bytes with dd but that value varies from file to file, as it happened to me.
The solution is to use a hex editor (I suggest on a copy of the broken file) and delete everything from the beginning up to the end of the word "mdat". In my case it was 28 bytes instead of 44.
I use 0xED as a hex editor on mac (it's free and runs on the latest mac OS, Mojave, as of this writing). Also, for mac you can install faad using Homebrew by running
You may need to specify the file sample rate if different from 44,100Hz when using faad with the switch -s
If faad returns this error
Error: Maximum number of bitstream elements exceeded
it could mean that you deleted too many bytes from the beginning of the file, as it happened to me at first.Lastly, once you process the raw file with faad you will want to reencode the m4a file to make sure you have a proper and compatible file, this can easily be done with ffmpeg