View Full Version : AMR audio in .mp4/.3gp
SeeMoreDigital
11th October 2004, 10:49
Hi Karl,
The 3gpsample_1MB.3gp (http://www.lillevold.com/files/mpeg4video/3gpsample_1MB.3gp) you created a link to is rather interesting.
I have to confess I have not done any reading up about the container/format but was rather surprised to find that when I changed the .3gp file extension over to .mp4, mp4UI managed to open it.
I could quite easily de-mux the Mpeg4 video stream, however the audio stream proved more difficult, as it was unrecognised.... What exactly is the audio stream?
If it's not AAC or Mp3, then I guess it can be considered as being a type of "private stream".
Happily both RealPlayer 10.5 and NeroDigital's filters were able to decode the streams using both .3gp and .mp4 file extensions
Cheers
EDIT: Subject title added after thread split
gotaserena
11th October 2004, 11:19
According to mplayer the audio codec is "audio format 0x726D6173" (fourCC=samr). Googling around I found out that the .mp4s created by the Ericsson p900 mobile have this codec.
Hopefully they'll have the codec in their support page.
P.S.: According to MP4Box the stream (ID 101) is non compliant.
SeeMoreDigital
11th October 2004, 12:19
Originally posted by gotaserena
According to mplayer the audio codec is "audio format 0x726D6173" (fourCC=samr). Googling around I found out that the .mp4s created by the Ericsson p900 mobile have this codec. Thanks gotaserena,
All QuickTime player was able to say about it, was it's "AMR, Narrowband, 8000Hz"
The interesting thing is, it would appear, some "private streams" are more "open" than others :)
Cheers
gotaserena
11th October 2004, 14:00
From the looks of it, this "private stream" business is really a no man's land. Nothing prevents from one getting, say, a .mkv file and inserting it into a .mp4 stream. Toss in a demuxer and a call to the player and you can have basically anything there. I see this becoming a problem in the future if more and more people decide to go this way: players will be forced to call external programs to handle the streams, and there you have a nice security threat.
I'll better stop before I get a strike for going off-topic! :p
Drachir
11th October 2004, 18:29
Originally posted by gotaserena
P.S.: According to MP4Box the stream (ID 101) is non compliant.
MP4Box don't say that this Track ist not compliant.
Track # 5 Info - TrackID 101 - TimeScale 8000 - Duration 535360
Media Type "soun" - Media Sub Type "samr" - 3346 samples
TrackID can be any number (don't know how many digits(maximal)).
AMR Narrowband in 3gp files is compliant. ( as far as I know )
AMR Narrowband in MP4 Files is not compliant (or a user private stream).
Take a look here: http://www.mp4ra.org/
gotaserena
11th October 2004, 18:45
It's probably me at fault here, but if I try to extract the track using MP4Box I get:
MP4Box -raw 101 3gpsample_1MB.3gp
Invalid MPEG-4 stream in track ID 101
Error: BitStream Not Compliant
So maybe it's compliant, but MP4Box doesn't support it.
Drachir
11th October 2004, 19:00
I thing -raw works only with: cmp (raw Mpeg 4 Video), aac, mp3, jpg, png
man MP4Box
-raw TrackID
extracts given track in raw format (cmp, aac, mp3,
jpg, png). Currently not allowing MPEG-4 Systems
tracks extraction.
gotaserena
11th October 2004, 19:09
That maybe, from the output of MP4Box -h extract I'd expected it to simply dump the track out, though:
MP4Box -h extract
-raw TrackID: extracts track in raw format (cmp, aac, mp3, jpg, png) - does not work for systems tracks
since this is obviously not a system track.
ak
11th October 2004, 20:12
I've tried this one with mp4creator, it can extract that amr stream and mux to mp4 as well, and both raw and muxed files are playable in realplay, fwiw.
Not sure if anything else out there can handle amr. I think ffmpeg can be built with amr support, haven't tried though.
gotaserena
11th October 2004, 21:08
funny, I just finished compiling mpeg4ip in my linux box, and tried demuxing with mp4creator as you did. The outcome:
$ mp4creator -extract=101 3gpsample_1MB.3gp
MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[4].mdia.minf.stbl.stsd.*.esds.decConfigDescr.objectTypeId
MP4ERROR: MP4File::FindIntegerProperty: no such property - moov.trak[4].mdia.minf.stbl.stsd.*.esds.decConfigDescr.objectTypeId
But it did extract the track...
SeeMoreDigital
11th October 2004, 21:21
Originally posted by gotaserena
But it did extract the track... What is the extracted streams file extension. Have you managed to play it in anything?
Cheers
gotaserena
11th October 2004, 22:01
the output extension is ".t101" :D
I renamed it to .amr and used voiceage's command line decoder on it. It did output "7852 frames" to something that is supposed to be PCM at 8kHz. But I did not manage to play it in anything.
Quicktime refuses to play it.
SeeMoreDigital
11th October 2004, 22:17
This is what mp4UI says about it!
http://img70.exs.cx/img70/9030/SMD_3gp_audio_stream_via_mp4UI.gif
I was able to extract the stream as an .bin file (all 82.2KB of it) but like you, I can't play it, even after re-naming the extension :(
Cheers
bond
11th October 2004, 23:14
to clear things up:
1) the mpeg-4 standard defines the "iso base file format"
.mp4 and .3gp are both based on this iso base file format and therefore very similar (like .mov is very similar too from the structure)
still strictly speaking they are not the same! and there is no 100% interoperability between them (still some tools might handle both, some might not...)
and strictly speaking renaming these two containers extensions is a bad idea... (the mentioned phone indeed stores amr into .mp4 altough i think they should have better used .3gp for this)
2) as i wrote in my mp4 faq the 3gpp standard defines the storage of amr audio in the .3gp container (labelled as "samr")
the .mp4 container does not define the storage!!! an amr stream stored in a .3gp file, which gets renamed to .mp4 is also not stored in .mp4 like a private stream would have to be stored in .mp4
to sum things up: everything is perfectly fine with the files! dont rename the extensions!
thread splitted
SeeMoreDigital
11th October 2004, 23:54
Thanks bond,
So to confirm, as AMR audio streams are neither AAC or MP3, can they be considered as being "private streams"?
Cheers
bond
12th October 2004, 20:05
definitely not when stored in .3gp, as the 3gpp standard defines how to place amr into .3gp
i assume that the phone mentioned above places amr in a compliant way as private stream in .mp4
SeeMoreDigital
12th October 2004, 20:55
Well AMR "audio only" streams (http://82.2.167.24/Uploaded_Files/Doom9_Forum_files/AMR_audio_only_stream.zip) certainly seem to work in MP4 :D
Cheers
ak
12th October 2004, 21:06
Originally posted by gotaserena
funny, I just finished compiling mpeg4ip in my linux box, and tried demuxing with mp4creator as you did. The outcome:
You brobably want to build from cvs.
It should deal with 3gp better, I suppose. And mux as well:
-force3GPCompliance Force making the file 3GP compliant. This disables ISMA compliance.
BTW, I built ffmpeg with amr support, so ffplay is able to play this file, including audio track, so does mp4player for that matter.
Yeah and it can encode to amr narrow/wideband as well and put it in 3gp.
BTW2 here's a win32 build with amr enabled: http://4nykey.nm.ru/bin/ffmpeg-cvs.exe in case anyone is curious to play with.
Latexxx
14th October 2004, 15:53
Originally posted by ak
BTW2 here's a win32 build with amr enabled: http://4nykey.nm.ru/bin/ffmpeg-cvs.exe in case anyone is curious to play with.
Reference code (http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-530.zip) is also available if anybody is interested. Also some specs (http://www.3gpp.org/ftp/Specs/html-info/26-series.htm)
Edit: I compiled the reference code for your pleasure, though I haven't tested it yet. Download from http://kotisivu.mtv3.fi/ware.purkki/
Edit2: I added AMR WB+.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.