[FFmpeg-devel] Trouble with GSM audio.
Artem Korneev
tema
Tue Oct 2 23:53:05 CEST 2007
Michel Bardiaux wrote:
> Artem Korneev a ?crit :
>
>> Last weeks I spent in attempting to decode audio frames from GSM format
>>
>
> There aint no such animal. You probably mean GSM *codec*, in a wav, right?
>
Hmm.. I have a frames, which comes from the network. And I know, that
these frames contains audio in GSM.
>> to PCM. But I still have no solution. :(
>>
>> I've initialize codec context by these lines:
>>
>> inCtx->bit_rate = 13000;
>> inCtx->sample_rate = 8000;
>> inCtx->channels = 1;
>>
>> and after that, decode buffer with GSM audio by this code:
>>
>> while ( in_size > 0 ) {
>> outbuf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
>> decoded_len = avcodec_decode_audio2(inCtx, samples_ptr,
>> &outbuf_size, inbuf_ptr, in_size);
>>
>> in_size -= decoded_len;
>> inbuf_ptr += decoded_len;
>> samples_ptr += outbuf_size;
>> }
>>
>> ..and only noise I have as result. :( Does anybody have a workable
>> example of code for decoding GSM?
>>
> Yes: ffmpeg.c!
>
This source use decoding from the file, as I know. But I need to use it
with the buffer, which contains frame.
> Please try ffmpeg -i on your input.
>
I have no input files, so I tried this command with the dump (I save all
incoming frames into the dump file):
% ffmpeg -i
dumpgsm1.gsm
/tmp
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-libfaac --enable-libfaad --enable-libmp3lame
--enable-libgsm --prefix=/usr/ --disable-ffserver --disable-debug
--disable-static --enable-shared --enable-pthreads --enable-gpl
libavutil version: 49.3.0
libavcodec version: 51.38.0
libavformat version: 51.10.0
built on Sep 26 2007 18:41:17, gcc: 4.1.2 20061115 (prerelease)
(Debian 4.1.1-21)
dumpgsm1.gsm: Unknown format
But when I feed this file to gpe-soundbite (gpe-soundbite play
dumpgsm1.gsm), I have hear a correctly sound. So, I think, that input is
correct.
> Chances are, its not GSM but GSM-MS. Is the codec_id right?
>
May be, but I'm already tried to use CODEC_ID_GSM_MS as well as
CODEC_ID_GSM. No result yet. :(
More information about the ffmpeg-devel
mailing list