Skip to content

Commit

Permalink
Merge pull request #412 from lukeswitz/video_encoding_fix
Browse files Browse the repository at this point in the history
set audio encoding to address video bug
  • Loading branch information
n8fr8 authored Jan 30, 2020
2 parents c572aad + 2e9f4f5 commit 8b8a7d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/havenapp/main/sensors/media/AudioCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public class AudioCodec {
public void start() throws IllegalStateException, IOException {
if (recorder == null) {
minSize = AudioRecord.getMinBufferSize(
8000,
44100,
AudioFormat.CHANNEL_IN_DEFAULT,
AudioFormat.ENCODING_PCM_16BIT);
Log.e("AudioCodec", "Minimum size is " + minSize);
recorder = new AudioRecord(
MediaRecorder.AudioSource.MIC,
8000,
MediaRecorder.AudioSource.MIC,
44100,
AudioFormat.CHANNEL_IN_DEFAULT,
AudioFormat.ENCODING_PCM_16BIT,
minSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ private boolean prepare(Camera camera) {
mCamera.unlock();
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setPreviewDisplay(mHolder.getSurface());
// mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
// mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
mMediaRecorder.setMaxDuration(mSeconds);
mMediaRecorder.setOutputFile(mOutputFile);
Expand Down

0 comments on commit 8b8a7d2

Please sign in to comment.