3

나는 오디오없이 음원 비디오를 녹화하는 옵션이있는 MediaRecorder를 사용하여 android에서 비디오 레코더를 만들려고합니다. 나는이 작업을 수행 할 수있는 완벽한 방법을하지 않았다 검색을 많이 후 안드로이드 &에 음소거 비디오를 녹화 할 수있는 옵션이 있다면 체크, 나뿐만 아니라 AudioManager의 방법을 아래에 시도 :프로그래밍 방식으로 음소거 비디오를 기록하는 방법

audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true); 

audioManager.setMicrophoneMute(true); 

audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, 0, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE) 

을하지만 그들 중 아무도 없습니다 나를 위해 일하고있다.

누구든지이 문제를 해결할 수 있도록 도와 줄 수 있습니까?

감사합니다 !!!

답변

5

내가 어떻게 처리했는지.

boolean settingsSound = sharedPrefSettings.getBoolean("settingsSound", true); 

    if (!settingsSound) { 
     mediarecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); 
     mediarecorder.setVideoFrameRate(profile.videoFrameRate); 
     mediarecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); 
     mediarecorder.setVideoEncodingBitRate(profile.videoBitRate); 
     mediarecorder.setVideoEncoder(profile.videoCodec); 
    } else{ 
     mediarecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); 
     mediarecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); 
     mediarecorder.setVideoFrameRate(profile.videoFrameRate); 
     mediarecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); 
     mediarecorder.setVideoEncodingBitRate(profile.videoBitRate); 
     mediarecorder.setAudioEncodingBitRate(profile.audioBitRate); 
     mediarecorder.setAudioChannels(profile.audioChannels); 
     mediarecorder.setAudioSamplingRate(profile.audioSampleRate); 
     mediarecorder.setVideoEncoder(profile.videoCodec); 
     mediarecorder.setAudioEncoder(profile.audioCodec); 
    } 

그냥 audiosource를 설정하지 마십시오. 이 프로필이 나옵니다.

profile = CamcorderProfile.get(CamcorderProfile.QUALITY_1080P); 

CamcorderProfile을 소리없이 설정하지 않으므로 모든 값을 하나씩 설정해야합니다.

희망이 도움이 될 것입니다 :)

+0

그것은 나를 위해 작동하지 않습니다. – user3168958