0
How to fix this error in record video
videoMediaRecorder=new MediaRecorder(); videoMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); videoMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); videoMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); videoMediaRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB); videoMediaRecorder.setVideoEncoder(MediaRecorder.OutputFormat.MPEG_4); videoMediaRecorder.setOutputFile(getStoragePath()+"/test.mp4"); videoMediaRecorder.prepare(); videoMediaRecorder.start(); This is codes Output: ERROR : java.lang.RuntimeException: start failed.
5 odpowiedzi
+ 2
I understand and what I believe the problem is, is the format of the video. I find it odd that mp4/mpeg 4 isn't working. Maybe try it as avi or see what encoder your device has that isn't mp4. If that doesn't work, then the search continues.
+ 1
https://stackoverflow.com/questions/25993094/java-lang-runtimeexception-start-failed
Seems to happen depending on the system or phone and encoders or output formats.
0
Ausgrindtube
I record the sound without any problem, the sound recording has no errors, but I want to record a video as well
Error Not Fixed
OUTPUT=
ERROR : java.lang.RuntimeException: start failed.
Code updated
videoMediaRecorder=new MediaRecorder();
videoMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
videoMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
videoMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
videoMediaRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
videoMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
videoMediaRecorder.prepare();
videoMediaRecorder.start();
0
Ausgrindtube
Error not fixed
Device informations
Sdk : 23 , Android : 6.0.1 , Model : J500H , Brand : Samsung , CPU : 32 bit 200 Mhz to (1.2 or 1.5 Ghz) 4 Cores , Battrey : 2600 mA not supported fast charge , Mobile Data : 3G(H+) , Screen : 320dpi 720*1280px html=360*640px , Build Number : J500HXXS2BRL1 , RAM : 1.5GB , Internal Storage : 4GB(8GB 4GB used system) , External Storage : 14.88GB
IDE : AIDE
MediaRecorder.OutputFormat:
AAC_ADTS,AMR_NB,AMR_WB,DEFAULT,MPEG_2_TS,MPEG_4,RAW_AMR,THREE_GPP,WEBM
MediaRecorder.AudioEncoder:
AAC,AAC_ELD,AMR_NB,AMR_WB,DEFAULT,HE_AAC,VORBIS
MediaRecorder.VideoEncoder:
DEFAULT,H263,H264,HEVC,MPEG_4_SP,VP8
So, as a result, the problem must be only because of the formats
What format do you suggest to choose?
AVI format is not available
0
H263 or H264 are probably the next ones.
I notice that it says "mpeg 4 sp" and that might be the difference.
Could be a good idea to look that up online...