iphone - AVAudioRecorder 256 Kbps recording in iOS -
i wants record audio in ios (avaudiorecorder)
below code working fine
_filename = [nsstring stringwithformat:@"record_%@.m4a",[dateandtimeutil stringfromdate:[nsdate date] withformatterstring:@"hh_mm_ss_dd_mm_yyyy"]];nsarray *pathcomponents = [nsarray arraywithobjects: [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject], _filename, nil]; nsurl *outputfileurl = [nsurl fileurlwithpathcomponents:pathcomponents]; // setup audio session avaudiosession *session = [avaudiosession sharedinstance]; [session setcategory:avaudiosessioncategoryplayandrecord error:nil]; // define recorder setting nsmutabledictionary *recordsetting = [[nsmutabledictionary alloc] init]; [recordsetting setvalue:[nsnumber numberwithint:kaudioformatmpeg4aac] forkey:avformatidkey]; [recordsetting setvalue:[nsnumber numberwithfloat:44100.0] forkey:avsampleratekey]; [recordsetting setvalue:[nsnumber numberwithint: 2] forkey:avnumberofchannelskey]; // initiate , prepare recorder audiorecorder = [[avaudiorecorder alloc] initwithurl:outputfileurl settings:recordsetting error:nil]; audiorecorder.delegate = self; audiorecorder.meteringenabled = yes; [audiorecorder preparetorecord];`
the problem recorded file shows bit rate 44 kbps want record audio of average bitrate of 256kbps preference aac codec, compatible mp3 codec , mp4 audio codec.
please me out.
_filename = [nsstring stringwithformat:@"record_%@.mp4",[dateandtimeutil stringfromdate:[nsdate date] withformatterstring:@"hh_mm_ss_dd_mm_yyyy"]]; nsarray *pathcomponents = [nsarray arraywithobjects: [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject], _filename, nil]; nsurl *outputfileurl = [nsurl fileurlwithpathcomponents:pathcomponents]; // setup audio session avaudiosession *session = [avaudiosession sharedinstance]; [session setcategory:avaudiosessioncategoryplayandrecord error:nil]; // define recorder setting nsmutabledictionary *recordsetting = [[nsmutabledictionary alloc] init]; [recordsetting setvalue:[nsnumber numberwithint:kaudioformatmpeg4aac] forkey:avformatidkey]; [recordsetting setvalue:[nsnumber numberwithfloat:44100.0] forkey:avsampleratekey]; [recordsetting setvalue:[nsnumber numberwithint: 2] forkey:avnumberofchannelskey]; [recordsetting setvalue:[nsnumber numberwithinteger:avaudioqualityhigh] forkey:avencoderaudioqualitykey]; [recordsetting setvalue:[nsnumber numberwithint:32] forkey:avlinearpcmbitdepthkey]; [recordsetting setvalue:[nsnumber numberwithint:128000] forkey:avencoderbitrateperchannelkey]; [recordsetting setvalue:[nsnumber numberwithbool:no] forkey:avlinearpcmisbigendiankey]; [recordsetting setvalue:[nsnumber numberwithbool:no] forkey:avlinearpcmisfloatkey]; [recordsetting setvalue:[nsnumber numberwithbool:no] forkey:avencoderbitdepthhintkey]; // initiate , prepare recorder audiorecorder = [[avaudiorecorder alloc] initwithurl:outputfileurl settings:recordsetting error:nil]; audiorecorder.delegate = self; audiorecorder.meteringenabled = yes; [audiorecorder preparetorecord];
by using above code reach towards positive solution able record audio bit rate info. audio has 256kbps bit rate.
Comments
Post a Comment