Closed golimarrrr closed 6 years ago
They are, but your audio codec is currently not. Find a way to tell the length of a amr_wb packet and untrunc can work with your file. See Codec::getLength
and Codec::getLength
. Without an example I won't be able to help you.
This is the output from ffprobe for the reference file:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ok.3gp':
Metadata:
major_brand : 3gp4
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2018-02-23T19:43:39.000000Z
com.android.version: 7.1.1
Duration: 00:59:55.62, start: 0.000000, bitrate: 26 kb/s
Stream #0:0(eng): Audio: amr_wb (sawb / 0x62776173), 16000 Hz, mono, flt, 24 kb/s (default)
Metadata:
creation_time : 2018-02-23T19:43:39.000000Z
handler_name : SoundHandle
I think there is a mistake in your post, did you mean to specify two different methods?
Oh yes. I meant Codec::matchSample
and Codec::getLength
. You would have to add a else if(name_ == "sawb")
branch there.
I tried some packet sizes as per the table in https://hal.archives-ouvertes.fr/hal-01319434/document and now the output file is not empty but the sound is garbled (it does slightly sound like voice though!). I guess the bitrate is variable and so the packet size, but I'm not sure.
I attach a sample of this format just in case anyone can help: amrwb_sample.3gp.gz
I fixed it by hand like this:
Also, this program should do the same procedure I mentioned above: https://github.com/golimarrrr/fix-3gp
You are lucky that your two files have matching audio frames sizes. This allows you to simply replace the header. This might be specific to the codec, or your recording device. For example in the sample you uploaded it looks like every frame is 61 bytes long. I dont think your hack works if the corrupted file is longer than the healthy one, have you tried?
I looked at your file and apparently sawb uses 0x44 as identifier. For determining the length avcodec does the job. It is satisfying how only one new line of code can add support for another codec.
I dont think your hack works if the corrupted file is longer than the healthy one, have you tried?
It works but the playing length of the fixed file will be too short (will be the same the healthy file)
I have a broken .3gp audio file whose codec is (I think) amr_wb. I tried to run untrunc with the broken file against two different correct files from the same phone (one shorter and another longer) and I get a 670-byte output file only.
I tried with the standard libav package and also compiling the latest libav from source, selecting both the default 'amr' codec and also the 'opencore amr' codec, but the output is the same. Are audio-only files also supported?