[BUG] bitRate and sampleRate cannot be set on Android
See original GitHub issueFlutter Sound Version :
-
Released or Beta version ? Released
-
Version number ? flutter_sound: ^6.4.2+1
-
FULL or LITE flavor ? FULL
-
Result of the command “flutter pub deps | grep flutter_sound” (very important) |-- flutter_sound 6.4.2+1 | |-- flutter_sound_platform_interface 6.4.2+1 | |-- flutter_sound_web 6.4.2+1 | | |-- flutter_sound_platform_interface…
Severity
- Result is not what expected ? The bitRate and sampleRate parameter in startRecorder is not giving correct result. I set bitRate: 48000 and sampleRate: 44100, but the output audio is bitRate: 12800 and sampleRate: 8000
Platforms you faced the error
-
Android 9
-
Real device ? Samsung S8
Logs
(This is very important. Most of the time we cannot do anything if we do not have information on your bug)
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior: await _flutterSoundRecorder.openAudioSession(); await _flutterSoundRecorder.setSubscriptionDuration(Duration(milliseconds: 500)); await _flutterSoundRecorder.startRecorder( toFile: file.path, bitRate: 48000, sampleRate: 44100, );
Use ffprobe to check the bitrate:
ffprobe -v error -show_format -show_streams R_1604830207119.aac
Outputs
[STREAM]
index=0
codec_name=amr_nb
codec_long_name=AMR-NB (Adaptive Multi-Rate NarrowBand)
profile=unknown
codec_type=audio
codec_time_base=1/8000
codec_tag_string=samr
codec_tag=0x726d6173
sample_fmt=flt
sample_rate=8000
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/8000
start_pts=0
start_time=0.000000
duration_ts=41120
duration=5.140000
bit_rate=12800
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=257
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-11-08T10:10:13.000000Z
TAG:language=eng
TAG:handler_name=SoundHandle
[/STREAM]
[FORMAT]
filename=R_1604830207119.aac
nb_streams=1
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=5.140000
size=8962
bit_rate=13948
probe_score=100
TAG:major_brand=3gp4
TAG:minor_version=0
TAG:compatible_brands=isom3gp4
TAG:creation_time=2020-11-08T10:10:13.000000Z
TAG:com.android.version=9
[/FORMAT]
Expected behavior A clear and concise description of what you expected to happen.
Additional context**
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top GitHub Comments
Hi Larpoux,
I didn’t set anything in startRecorder, just use the default codec.
Thanks again for your contribution to this project.
You can try :
If not better maybe it is a problem related with mono/stereo.