I am trying to learn to encode a mp4 or any sort of video file using the Camera's onPreviewFrame call back.
Currently, I am trying the example codes from this post
Encoding H.264 from camera with Android MediaCodec
Unfortunately, I am keep getting an IllegalException on the
mediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
From another post IllegalStateException when MediaCodec.configure Android, I notice that are some mandatory values I have to set for the MediaCodec.
I tried all the mandatory mediacodec's mandatory values but still no luck of getting past
the IllegalException.
Now I am kinda of running out of ideas to try. Any suggestions, opinions or hints would be greatly appreciated.
thanks
11-04 12:27:14.785 175-894/? E/mm-libcamera2﹕ PROFILE HAL: stopPreview(): E: 1383596834.803557773
11-04 12:27:14.795 175-175/? E/OMXNodeInstance﹕ !!! Observer died. Quickly, do something, ... anything...
11-04 12:27:14.795 208-5797/? E/mm-camera﹕ config_shutdown_pp Camera not in streaming mode. Returning.
11-04 12:27:14.795 208-5797/? E/mm-camera﹕ vfe_ops_deinit: E
11-04 12:27:14.825 175-5814/? E/OMX-VENC-720p﹕ ioctl VEN_IOCTL_CMD_READ_NEXT_MSG failed
11-04 12:27:14.825 175-175/? E/OMX-VENC-720p﹕ Destroy C2D instance
11-04 12:27:14.835 527-539/? E/qcom_sensors_hal﹕ hal_process_report_ind: Bad item quality: 11
11-04 12:28:17.642 6241-6247/? E/jdwp﹕ Failed sending reply to debugger: Broken pipe
11-04 12:28:17.912 527-539/? E/qcom_sensors_hal﹕ hal_process_report_ind: Bad item quality: 11
11-04 12:28:17.922 208-6264/? E/mm-camera﹕ sensor_load_chromatix: libchromatix_imx111_preview.so: 30
11-04 12:28:18.032 208-6264/? E/mm-camera﹕ vfe_ops_init: E
11-04 12:28:18.042 208-6264/? E/mm-camera﹕ vfe_legacy_stats_buffer_init: AEC_STATS_BUFNUM
11-04 12:28:18.052 208-6264/? E/mm-camera﹕ vfe_legacy_stats_buffer_init: AEC_STATS_BUFNUM
11-04 12:28:18.052 208-6264/? E/mm-camera﹕ mctl_init_stats_proc_info: snap_max_line_cnt =30096
11-04 12:28:18.213 6241-6241/? E/CamcorderProfile﹕ width: 720
11-04 12:28:18.213 6241-6241/? E/CamcorderProfile﹕ height: 480
11-04 12:28:18.213 6241-6241/? E/CamcorderProfile﹕ audioSampleRate: 48000
11-04 12:28:18.213 6241-6241/? E/CamcorderProfile﹕ videoBitRate: 5000000
11-04 12:28:18.213 6241-6241/? E/CamcorderProfile﹕ videoFrameRate: 30
11-04 12:28:18.233 175-617/? E/OMX-VENC-720p﹕ Is component secure 0
11-04 12:28:18.263 6241-6280/? E/ACodec﹕ [OMX.qcom.video.encoder.avc] does not support color format 19
11-04 12:28:18.263 6241-6280/? E/ACodec﹕ [OMX.qcom.video.encoder.avc] configureCodec returning error -2147483648
11-04 12:28:18.263 6241-6279/? E/MediaCodec﹕ Codec reported an error. (omx error 0x80001001, internalError -2147483648)
11-04 12:28:18.263 6241-6241/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:259)
at com.example.mediacodec.AvcEncoder.<init>(AvcEncoder.java:40)
at com.example.mediacodec.Preview.surfaceCreated(MediaCodecActivity.java:304)
at android.view.SurfaceView.updateWindow(SurfaceView.java:571)
at android.view.SurfaceView.access$000(SurfaceView.java:86)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:833)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1860)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
11-04 12:28:20.135 175-617/? E/mm-libcamera2﹕ PROFILE HAL: stopPreview(): E: 1383596900.149872429
11-04 12:28:20.135 175-575/? E/OMXNodeInstance﹕ !!! Observer died. Quickly, do something, ... anything...
11-04 12:28:20.135 208-6264/? E/mm-camera﹕ config_shutdown_pp Camera not in streaming mode. Returning.
11-04 12:28:20.145 208-6264/? E/mm-camera﹕ vfe_ops_deinit: E
11-04 12:28:20.165 175-6283/? E/OMX-VENC-720p﹕ ioctl VEN_IOCTL_CMD_READ_NEXT_MSG failed
11-04 12:28:20.165 175-575/? E/OMX-VENC-720p﹕ Destroy C2D instance
11-04 12:28:20.195 527-539/? E/qcom_sensors_hal﹕ hal_process_report_ind: Bad item quality: 11