×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    recording to AAC

    Hello,

    I have tried to search many posts regarding recording audio to AAC format.

    but all of the posts were completed without any positive or negative conclusion.

    I am not very sure that whether it is possible to encode audio in AAC?

    I am using FP2 device.

    I have tried to find out all codecs supported via devsound API by,

    Code:
    iDevSound->GetSupportedOutputDataTypesL(lArray,lPriority)
    evenif state is either recording or converting,
    I am getting following 5 values oply.

    val = 36315020 - p16
    val = 31313747 - g711
    val = 39323747 - g729
    val = 43424C49 - ilbc
    val = 524D4120 - amr


    So this looks to me that I can not encode audio to AAC from my mobile.

    Am I correct? or is there any other way around?
    As there is AAC decoder UID, is there any similar encoder UID for AAC?

    Thanks for the help
    -Digish

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: recording to AAC

    With all devices I have checked sofar, there has not been codec for recording AAC, thus if the device does not give it as a supported type, then it is not supported type.

  3. #3
    Regular Contributor
    Join Date
    Oct 2007
    Location
    Coimbatore,India
    Posts
    114

    Re: recording to AAC

    Alternatively you can try using ffmpeg and can access AAC from it for encoding and decoding.
    Whoever does not try, does not learn.

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: recording to AAC

    Quote Originally Posted by spinner84 View Post
    Alternatively you can try using ffmpeg and can access AAC from it for encoding and decoding.
    All devices of Nokia support AAC so might not be a good idea to put the FFMPEG for AAC decoding and increasing the binary size .

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: recording to AAC

    Actually I think most recent S60 devices record AAC for the video audio in MP4 files - it might be a software decoder though, hence you don't find it at the DevSound layer. You could try the CMdaAudioRecorderUtility, or the CMMFCodec interface. I've never really wanted to do this myself - the CPUs aren't generally up to high quality audio compression. Certainly you can do it with the audio module in Python, so check out the PyS60 source code.

    Mark

  6. #6
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    Re: recording to AAC

    Thanks but i think i will not be able to use python module because I actually want to stream audio along with video.
    And for streaming video, I am using devvideo api of symbian, so I will have to write a symbian code to stream audio also.

    btw, thanks,

    Also I have found that there is AAC encoder with uid, (0x1020382f).

    Now i will try to find out how to configure it and how to use it.

    if I will get some way, I will post it.

    -Digish

  7. #7
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    Re: recording to AAC

    After taking help from posts, I tried to configure the encoder with following configurations:

    Code:
    	RArray<TInt> configParams;
    	configParams.Append(8000);  // Input sample rate
    	configParams.Append(1);      // Number of input channels [1, 2]
    	configParams.Append(1);      // AAC Input Profile [1 - LC, 3 - LTP]
    	configParams.Append(1280);      // Input Frame Len [1024, 960]
    	configParams.Append(0);       // AAC Down Mixing [0 - none, 1 - mono, 2 - stereo]
    	configParams.Append(0);   // AAC output channels [0 - none, 1 - 1, 2 - 2]
    	configParams.Append(0); // AAC decimation factor [0 - none, 2 - decimation by 2, 4 - decimation by 4]
    	configParams.Append(0);   // AAC concealment [0 - none, 1 - basic]
    	configParams.Append(16);    // Sample resolution - [16 - 16-bit resolution]
    	configParams.Append(0);   // Sample Rate Conversion 0 : none
    but my call to
    Code:
    	TRAPD(configerr,iCodec->ConfigureL( codecId, codecData ););
    always returns -6(KErrArgument).

    This means that I guess I have not entered configuration details properly.

    Can anyone please help?

    Also i would like to tell that I am using PCM16 encoding with 8000Hz frequency and mono channels.


    Also when I try to encode with default configurations, I am getting

    Code:
    Status = 3
    for some packet and then
    Code:
    Status = 1
    for some packets. with some encoded data in case of status 1.

    Can anyone give any suggestion?
    Thanks,
    Digish

  8. #8
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: recording to AAC

    Hi,

    I believe your configuration data is for the AAC decoder, not the encoder - I believe the encoder has far fewer parameters, have another search for correct configuration data.

    For the status values I think you need to interpret them as TCodecProcessResult enum values.
    http://www.symbian.com/Developer/tec...sultClass.html

    1 means EProcessIncomplete - the destination buffer is full and not all of the data in the input buffer has been used
    3 means EDstNotFilled - there wasn't enough data in the input buffer to fill the destination buffer

    This makes perfect sense with the results you are seeing.

    Hope that helps,
    Mark

  9. #9
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    Re: recording to AAC

    Thanks,

    can you suggest me some link for encoding parameters?

    By the way, thanks for telling me about the status. but I am not able to understand why result is coming so?

    I am always sendign 1280 bytes frame for encoding. then i think result should also be same each time..

    -Digish

  10. #10
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: recording to AAC

    I don't have a link for the encoding parameters to hand, or time to look for one at the moment. If you really can't find one anywhere then post back to this thread and I'll see what I can do later this week.

    The amount of PCM data that goes into one AAC frame depends on the level of compression used. Perhaps you need to change the size of your buffer (i.e. make it bigger), however, the best thing to do is just react appropriately to the result returned by the codec. When the destination buffer is not filled you need to pass in new data (input buffer) with the same destination buffer, when the process is incomplete you need to pass in a new destination buffer and the same input buffer. It's quite likely that the codec only outputs a single AAC frame at a time, and uses input data until it has constructed a complete one, does that make sense?

    Mark

  11. #11
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    Re: recording to AAC

    Thanks but unluckily I also thought the same way which did not work for me.. (atlease I guess)

    following is a piece of code that I used when I was getting status as either 1 or 3.


    Code:
    	
    CMMFDescriptorBuffer* lSource = CMMFDescriptorBuffer::NewL(aBuffer.Length());
    lSource->Data().Copy(aBuffer); 
    CMMFDescriptorBuffer* lDest = CMMFDescriptorBuffer::NewL(10000);
    TCodecProcessResult lResult;
    TRAPD(err, lResult = iCodec->ProcessL(*lSource,*lDest););
    	
    LOG(_L("encoding err =  %d"),err);
    if(err == KErrNone)
    {
    LOG(_L("Status = %d, it should be %d,data final length = %d"),lResult.iStatus,TCodecProcessResult::EProcessComplete,lResult.iDstBytesAdded);
    }
    delete lSource;
    delete lDest;
    and following was some of related the log print

    Status = 3, it should be 0,data final length = 0
    Status = 1, it should be 0,data final length = 304
    Status = 3, it should be 0,data final length = 0
    Status = 1, it should be 0,data final length = 229
    Status = 3, it should be 0,data final length = 0
    Status = 1, it should be 0,data final length = 277
    etc...

    so
    this means that whenever status = 1(Incomplete), I should give more destination buffer as per documentation.

    But then in that case, atlease my original buffer should be filled either fully or mostly. but my original destination buffer size available to buffer (10000) is almost empty which i am not able to understand.

    aneways, I will try to find out proper configuration for a couple of days, and if not found(or even found ), I will post it in this thread.

    Thanks for interest and help!

    -Digish

  12. #12
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: recording to AAC

    Hmm, yes, "incomplete" is sometimes also used to mean - I've put something in the output buffer and still need some more input. Technically I think this is incorrect but you have to adapt your code to the behaviour of the codec you're using.

    If you pass in the same output buffer again, it SHOULD add more data on the end when it next gets enough input.

    Mark

  13. #13
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    Re: recording to AAC

    Hi mark,

    I have got config params from your reply from following post:

    http://discussion.forum.nokia.com/fo...d.php?t=113496

    from that I have set parameters as follows

    Code:
    	RArray<TInt> configParams;
    	configParams.Append(128000);  // Bitrate (bits/s)
    	configParams.Append(8000);      // Sample rate (samples/s)]
    	configParams.Append(0);      // Flags? (always 0?)
    	configParams.Append(1);      // Channels (1 or 2)
    	configParams.Append(1);       // Format (0 = RAW,1 = ADTS, 2 = ADIF)
    	configParams.Append(1);   // Fill buffer (0 = decode 1 frame at a time, 1 = fill destination buffer)
    
    	const TDesC8& codecData = REINTERPRET_CAST(const TDesC8&, configParams);
    	const TUint32 KUidMmfCodecAudioSettings = 0x10203622;
    	const TUid codecId = TUid::Uid(KUidMmfCodecAudioSettings); 
    	TRAPD(configerr,iCodec->ConfigureL( codecId, codecData ););
    	LOG(_L("configerr = %d"),configerr);
    but still I am getting -6 when I try to configure. I have tried to give 0,1,2 all options is Format field. but in all cases, I am getting KErrArgument only.

    Can you suggest anything?


    Also regarding previous post,
    Hmm, yes, "incomplete" is sometimes also used to mean - I've put something in the output buffer and still need some more input. Technically I think this is incorrect but you have to adapt your code to the behaviour of the codec you're using.

    If you pass in the same output buffer again, it SHOULD add more data on the end when it next gets enough input.

    Mark
    It is not appending data to previous buffer.

    in fact, If I give same buffer eventhough status code is 1(Incomplete), I get my previous destination buffer overwritten.

    So I guess I cant use the same buffer.
    -Digish
    Last edited by Digish; 2009-03-25 at 07:53.

  14. #14
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: recording to AAC

    Hi,

    That is a badly behaved codec. Looks like you just have to put up with whatever length of data it gives you - possibly this is because it is in the "decode one frame at a time" mode rather than the "fill buffer" mode.

    I suspect your config problem is due to trying to get too high a bit rate from a low sample rate. Try reducing the output bitrate to 64k rather than 128k. The codec is supposed to be doing compression after all - 8000 samples * 16 bits per sample (this is mono) is 128000 bits/s, so you are asking for zero compression.

    Mark

  15. #15
    Registered User
    Join Date
    May 2007
    Location
    India
    Posts
    197

    Re: recording to AAC

    Thanks really very much,

    now I am able to configure it properly.

    I misinterpreted it as input bitrate rather expected output bitrate and hence the problem was there.

    If I will face any more issue(hopefully not) I will post in the thread.

    Thanks a lot again.
    -Digish

Similar Threads

  1. Problem in simultaneously playout and recording in 6680
    By santosh shetty in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2011-02-18, 11:37
  2. Audio Recording
    By nair.shanker in forum Symbian
    Replies: 0
    Last Post: 2008-05-19, 17:11
  3. BUGS?! Identified Video/Audio recording problems on N93
    By arikr7 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2007-03-19, 19:55
  4. N-Gage AAC recording chip
    By jegdarchik in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-12-10, 11:27
  5. N-Gage AAC recording chip
    By jegdarchik in forum Symbian
    Replies: 1
    Last Post: 2004-11-24, 12:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •