How to fix this error in record video | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

10th Sep 2022, 2:10 PM
aliz6398suisiTerminatorEmpireBot
aliz6398suisiTerminatorEmpireBot - avatar
5 Answers
+ 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.
11th Sep 2022, 8:06 AM
Ausgrindtube
Ausgrindtube - avatar
+ 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.
10th Sep 2022, 5:19 PM
Ausgrindtube
Ausgrindtube - avatar
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();
10th Sep 2022, 10:21 PM
aliz6398suisiTerminatorEmpireBot
aliz6398suisiTerminatorEmpireBot - avatar
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
15th Sep 2022, 7:55 PM
aliz6398suisiTerminatorEmpireBot
aliz6398suisiTerminatorEmpireBot - avatar
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...
15th Sep 2022, 8:25 PM
Ausgrindtube
Ausgrindtube - avatar