untrunc icon indicating copy to clipboard operation
untrunc copied to clipboard

Repair Audio?

Open rowanfr opened this issue 11 months ago • 4 comments

I wanted to ask is there any way to use this to repair audio. I'm trying to repair some m4a files and the details are as follows:

untrunc +1.m4a +2.m4a
Info: version '' using ffmpeg '7.0.2' Lavc61.3.100
Info: reading +1.m4a
Info: parsing healthy moov atom ...

Info: reading mdat from truncated file ...
Warning: Skipping moov atom: 217661
Info: Found 54247 packets ( mp4a: 54247 )
Tip: Audio and video seem to have different durations (inf).
     If audio and video are not in sync, give `-sv` a try. See `--help`
/usr/include/c++/15/bits/stl_vector.h:1262: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Track::Chunk; _Alloc = std::allocator<Track::Chunk>; reference = Track::Chunk&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
rowanfr@fedora ~/D/attachments [SIGABRT]> untrunc -sv +1.m4a +2.m4a
Info: version '' using ffmpeg '7.0.2' Lavc61.3.100
Info: reading +1.m4a
Info: parsing healthy moov atom ...

Info: reading mdat from truncated file ...
Warning: Skipping moov atom: 217661
Info: Found 54247 packets ( mp4a: 54247 )
/usr/include/c++/15/bits/stl_vector.h:1262: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Track::Chunk; _Alloc = std::allocator<Track::Chunk>; reference = Track::Chunk&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
rowanfr@fedora ~/D/attachments [255]> untrunc -s +1.m4a +2.m4a
Info: version '' using ffmpeg '7.0.2' Lavc61.3.100
Info: reading +1.m4a
Info: parsing healthy moov atom ...

Info: reading mdat from truncated file ...
Warning: Skipping moov atom: 217661
Info: Found 54247 packets ( mp4a: 54247 )
Tip: Audio and video seem to have different durations (inf).
     If audio and video are not in sync, give `-sv` a try. See `--help`
/usr/include/c++/15/bits/stl_vector.h:1262: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Track::Chunk; _Alloc = std::allocator<Track::Chunk>; reference = Track::Chunk&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

I know this can be done as https://www.onlineconverter.com/repair-m4a is able to do it using I believe to be a similar if not identical technique, but unfortunately I'm not familiar enough with media encoding to know for certain. (For those wondering while I would love to use there service I have both a large number and large size audio files that I want to repair and I don't want to waste there bandwidth or compute)

rowanfr avatar Jan 27 '25 03:01 rowanfr

Hey - Yes this should be possible. Please send me the files (healthy+broken) and I might take a look at some point (could take a while though). You can upload them on wetransfer (2GB limit) or dropmefiles.net (100GB limit). If you think they are too big, you can use untrunc -sh file.mp4. In case you want to keep the link private, you can send me an email - see my Profile page. Thank you!

anthwlock avatar Jan 27 '25 10:01 anthwlock

I sent you an email from "[email protected]" which should provide access to the files

rowanfr avatar Jan 30 '25 05:01 rowanfr

So, is it possible to use this tool to repair audio-only files in aac codec inside .m4a containers?

I'm trying here but not having much success.

jvschiavo avatar Aug 21 '25 01:08 jvschiavo

So, is it possible to use this tool to repair audio-only files in aac codec inside .m4a containers?

I'm trying here but not having much success.

Oh, yes, of course, I succeeded repair my broken .m4a audio file which caused by battery ran out. See issue #222 and issue #234. I think the issue can be close with compeleted.

whether1 avatar Oct 21 '25 15:10 whether1