HBiSoft / HBRecorder

Lightweight screen recording Android library
MIT License
430 stars 142 forks source link

HBRecorderOnError:: errorCode: 100 reason: 268435556 #43

Closed aruproy closed 3 years ago

aruproy commented 4 years ago

HBRecorder works fine on Android emulators and on my 3 physical devices. However, on one of my device the screen recorder stops immediately after I start recording. I am getting callback on HBRecorderOnError with errorCode: 100 and reason: 268435556

Both the "High Definition" and "Standard Definition" option is producing same error on the device.

Yes, this error is reproduced in demo app.

HBRecorder version HBRecorder:0.1.14

Device information LenovoTB3-X70L( LENOVO Lenovo TB3-X70L) Android 23

The demo app is showing toast HBRecorderOnError as soon as the start button is clicked. HBRecorder Screenshot.

I'd appreciate any help.

HBiSoft commented 4 years ago

Please see this comment:

I have updated the library and it will now return information about the supported codecs.

I need one of you to run the updated application and provide me with the log, it will look something like this:

E/HBRecorderCodecInfo: defaultVideoEncoder for (video/avc) -> OMX.Exynos.AVC.Encoder
E/HBRecorderCodecInfo: MaxSupportedFrameRate -> 59.55882352941177
E/HBRecorderCodecInfo: MaxSupportedBitrate -> 40000000
E/HBRecorderCodecInfo: isSizeAndFramerateSupported @ Width = 1080 Height = +1920 FPS = 30 -> true
E/HBRecorderCodecInfo: isSizeSupported @ Width = 1080 Height = +1920 -> true
E/HBRecorderCodecInfo: Default Video Format = MPEG_4
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.mpeg4.encoder -> video/mp4v-es
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.h264.encoder -> video/avc
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.Exynos.HEVC.Encoder -> video/hevc
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.Exynos.H263.Encoder -> video/3gpp
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.vp8.encoder -> video/x-vnd.on2.vp8
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.h263.encoder -> video/3gpp
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.Exynos.AVC.Encoder -> video/avc
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.Exynos.MPEG4.Encoder -> video/mp4v-es
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.Exynos.VP8.Encoder -> video/x-vnd.on2.vp8
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.amrnb.encoder -> audio/3gpp
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.amrwb.encoder -> audio/amr-wb
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.SEC.naac.enc -> audio/mp4a-latm
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.aac.encoder -> audio/mp4a-latm
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.flac.encoder -> audio/flac
E/HBRecorderCodecInfo: Available Video Formats : MPEG_2_TS
E/HBRecorderCodecInfo: Available Video Formats : MPEG_4
E/HBRecorderCodecInfo: Available Video Formats : THREE_GPP
E/HBRecorderCodecInfo: Available Video Formats : WEBM

Run the latest demo application on your device and post the log.

aruproy commented 4 years ago

Thank you @HBiSoft for your quick response. I have installed the demo application from the link above on my device. Where should I look for the logs? On Android Studio logcat I don't see any "HBRecorderCodecInfo" entry. Can you write logs in a file?

I have two physical devices where the recorder is failing. I will provide you logs from both devices.

HBiSoft commented 4 years ago

@aruproy

If you have a look at the demo application, you will se that the log will be called in onCreate:

https://github.com/HBiSoft/HBRecorder/blob/3c570c95052efd329ede1dc3f473642fb968b2eb/app/src/main/java/com/hbisoft/hbrecorderexample/MainActivity.java#L131-L167


Download the demo application and open it in Android Studio, then install it on your device. The logs will not be shown with the link/demo I mentioned in my previous comment.

aruproy commented 4 years ago

@HBiSoft I have collected supported codecs using your code.

Failed device 1: LenovoTB3-X70L( LENOVO Lenovo TB3-X70L) Android 23

numCodecs: 54

Encoder: OMX.MTK.VIDEO.ENCODER.MPEG4
Encoder: OMX.MTK.VIDEO.ENCODER.H263
Encoder: OMX.MTK.VIDEO.ENCODER.AVC
Encoder: OMX.google.h263.encoder
Encoder: OMX.google.h264.encoder
Encoder: OMX.google.mpeg4.encoder
Encoder: OMX.google.vp8.encoder

Failed device 2: P290( Micromax Micromax P290) Android 21

numCodecs: 45

Encoder: OMX.MTK.VIDEO.ENCODER.MPEG4
Encoder: OMX.MTK.VIDEO.ENCODER.H263
Encoder: OMX.MTK.VIDEO.ENCODER.AVC
Encoder: OMX.google.vp8.encoder

I will also send you logs by running the demo app as you suggested above.

aruproy commented 4 years ago

@HBiSoft Here is the log using the demo app. Appreciate your help.

Failed device 1: LenovoTB3-X70L( LENOVO Lenovo TB3-X70L) Android 23

E/HBRecorderCodecInfo: defaultVideoEncoder for (video/avc) -> OMX.MTK.VIDEO.ENCODER.AVC
W/System.err:     at com.hbisoft.hbrecorder.HBRecorderCodecInfo.getMaxSupportedFrameRate(HBRecorderCodecInfo.java:308)
E/HBRecorderCodecInfo: MaxSupportedFrameRate -> 0.0
E/HBRecorderCodecInfo: MaxSupportedBitrate -> 62500000
E/HBRecorderCodecInfo: isSizeAndFramerateSupported @ Width = 1740 Height = 1088 FPS = 30 -> false
E/HBRecorderCodecInfo: isSizeSupported @ Width = 1740 Height = 1088 -> false
E/HBRecorderCodecInfo: Default Video Format = MPEG_4
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.MTK.VIDEO.ENCODER.H263 -> video/3gpp
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.mpeg4.encoder -> video/mp4v-es
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.h264.encoder -> video/avc
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.MTK.VIDEO.ENCODER.MPEG4 -> video/mp4v-es
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.h263.encoder -> video/3gpp
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.MTK.VIDEO.ENCODER.AVC -> video/avc
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.vp8.encoder -> video/x-vnd.on2.vp8
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.MTK.AUDIO.ENCODER.VORBIS -> audio/vorbis
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.MTK.AUDIO.ENCODER.ADPCM.DVI -> audio/x-adpcm-dvi-ima
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.flac.encoder -> audio/flac
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.aac.encoder -> audio/mp4a-latm
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.amrwb.encoder -> audio/amr-wb
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.amrnb.encoder -> audio/3gpp
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.MTK.AUDIO.ENCODER.ADPCM.MS -> audio/x-adpcm-ms
E/HBRecorderCodecInfo: Available Video Formats : MPEG_2_TS
E/HBRecorderCodecInfo: Available Video Formats : MPEG_4
E/HBRecorderCodecInfo: Available Video Formats : THREE_GPP
E/HBRecorderCodecInfo: Available Video Formats : WEBM

Failed device 2: P290( Micromax Micromax P290) Android 21

E/HBRecorderCodecInfo: defaultVideoEncoder for (video/avc) -> OMX.MTK.VIDEO.ENCODER.AVC
E/HBRecorderCodecInfo: MaxSupportedFrameRate -> 101.05263157894737
E/HBRecorderCodecInfo: MaxSupportedBitrate -> 62500000
E/HBRecorderCodecInfo: isSizeAndFramerateSupported @ Width = 1024 Height = 600 FPS = 30 -> true
E/HBRecorderCodecInfo: isSizeSupported @ Width = 1024 Height = 600 -> true
E/HBRecorderCodecInfo: Default Video Format = MPEG_4
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.MTK.VIDEO.ENCODER.H263 -> video/3gpp
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.MTK.VIDEO.ENCODER.MPEG4 -> video/mp4v-es
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.MTK.VIDEO.ENCODER.AVC -> video/avc
E/HBRecorderCodecInfo: Supported VIDEO encoders and mime types : OMX.google.vp8.encoder -> video/x-vnd.on2.vp8
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.MTK.AUDIO.ENCODER.VORBIS -> audio/vorbis
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.MTK.AUDIO.ENCODER.ADPCM.DVI -> audio/x-adpcm-dvi-ima
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.flac.encoder -> audio/flac
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.aac.encoder -> audio/mp4a-latm
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.amrwb.encoder -> audio/amr-wb
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.google.amrnb.encoder -> audio/3gpp
E/HBRecorderCodecInfo: Supported AUDIO encoders and mime types : OMX.MTK.AUDIO.ENCODER.ADPCM.MS -> audio/x-adpcm-ms
E/HBRecorderCodecInfo: Available Video Formats : MPEG_2_TS
E/HBRecorderCodecInfo: Available Video Formats : MPEG_4
E/HBRecorderCodecInfo: Available Video Formats : THREE_GPP
E/HBRecorderCodecInfo: Available Video Formats : WEBM
HBiSoft commented 4 years ago

@aruproy

LenovoTB3-X70L: You will see in the log that the dimensions are not supported. This could be because you are starting the recording in landscape mode, but the max supported size uses the portrait dimensions.

Please try starting the recording in landscape and portrait mode and see if there is any difference.

Micromax Micromax P290: I'm not sure why it is happening on this device. Can you try and set the video encoder to H263?

You can do this by opening the demo application, selecting the menu item(top right), select "Settings", select "Video Encoder", select "H263", go back and enable custom settings, then press record.

aruproy commented 4 years ago

@HBiSoft Thank you so much.

LenovoTB3-X70L: The demo app is showing the same error when I start recording in landscape and portrait orientation.

Micromax Micromax P290: As you suggested, this is the custom setting. Unfortunately I am getting the same error for both landscape and portrait orientation. Micromax Screenshot

Please let me know next step.

aruproy commented 3 years ago

@HBiSoft There are many devices throwing this error. Please try to resolve this. Thank you.

HBiSoft commented 3 years ago

This is not a library issue. I will have to open an issue on issuetracker.google.com and wait for Google to respond.

arsalanraja26 commented 3 years ago

@HBiSoft I am facing two issues please help me : 1- on Screen Rotation HBRecorder stops recording screen, is there any way to handle this ? 2- when onPause and onResume is called then HBRecorder records only audio i.e if I start recording and onPause of Activity is called and after that onResume is called then HBRecorder still records but only audio it do not update or continue to record views e.g videoview, count down timer etc

arsalanraja26 commented 3 years ago

if I used hbRecorder.pauseScreenRecording(); onPause of Activity and use hbRecorder.resumeScreenRecording(); onResume of Activity and then when I stop my recording then my app crashes

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.orbis.glflocker, PID: 3424 java.lang.RuntimeException: Unable to start service com.orbis.glflocker.controllers.Glf_three.screen_recorder.ScreenRecordService@80abab6 with Intent { act=pause cmp=com.orbis.glflocker/.controllers.Glf_three.screen_recorder.ScreenRecordService (has extras) }: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaRecorder.pause()' on a null object reference at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4168) at android.app.ActivityThread.-wrap21(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7555) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaRecorder.pause()' on a null object reference at com.orbis.glflocker.controllers.Glf_three.screen_recorder.ScreenRecordService.pauseRecording(ScreenRecordService.java:288) at com.orbis.glflocker.controllers.Glf_three.screen_recorder.ScreenRecordService.onStartCommand(ScreenRecordService.java:86) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4140) at android.app.ActivityThread.-wrap21(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)  at android.os.Handler.dispatchMessage(Handler.java:109)  at android.os.Looper.loop(Looper.java:166)  at android.app.ActivityThread.main(ActivityThread.java:7555)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963) 

ScreenRecordService.java

//Pause Recording @RequiresApi(api = Build.VERSION_CODES.N) private void pauseRecording(){ mMediaRecorder.pause(); }

@HBiSoft Kindly help me out

HBiSoft commented 3 years ago

I am facing two issues please help me : 1- on Screen Rotation HBRecorder stops recording screen, is there any way to handle this ? 2- when onPause and onResume is called then HBRecorder records only audio i.e if I start recording and onPause of Activity is called and after that onResume is called then HBRecorder still records but only audio it do not update or continue to record views e.g videoview, count down timer etc

Test using the demo app and let me know if you have the same behavior. The recording takes place in a Service and should not be killed during screen rotation or onPause(). The fact that it does tells me that you have implemented it incorrectly.

if I used hbRecorder.pauseScreenRecording(); onPause of Activity and use hbRecorder.resumeScreenRecording(); onResume of Activity and then when I stop my recording then my app crashes

Pause and resume recording was not intended for lifecycle events.

arsalanraja26 commented 3 years ago

I am facing two issues please help me : 1- on Screen Rotation HBRecorder stops recording screen, is there any way to handle this ? 2- when onPause and onResume is called then HBRecorder records only audio i.e if I start recording and onPause of Activity is called and after that onResume is called then HBRecorder still records but only audio it do not update or continue to record views e.g videoview, count down timer etc

Test using the demo app and let me know if you have the same behavior. The recording takes place in a Service and should not be killed during screen rotation or onPause(). The fact that it does tells me that you have implemented it incorrectly.

if I used hbRecorder.pauseScreenRecording(); onPause of Activity and use hbRecorder.resumeScreenRecording(); onResume of Activity and then when I stop my recording then my app crashes

Pause and resume recording was not intended for lifecycle events.

@HBiSoft thanks for you quick response, I really appreciate that and I am really sorry it was my bad I was testing wrong scenario, I have a query is your library also support screenshot ? I mean is there any way that I can also take screenshot while HBRecorder is recording or not recording ?

HBiSoft commented 3 years ago

thanks for you quick response, I really appreciate that and I am really sorry it was my bad I was testing wrong scenario, I have a query is your library also support screenshot ? I mean is there any way that I can also take screenshot while HBRecorder is recording or not recording ?

Currently it's not possible. But I will be implementing it in the next few days.

arsalanraja26 commented 3 years ago

thanks for you quick response, I really appreciate that and I am really sorry it was my bad I was testing wrong scenario, I have a query is your library also support screenshot ? I mean is there any way that I can also take screenshot while HBRecorder is recording or not recording ?

Currently it's not possible. But I will be implementing it in the next few days.

Ok, kindly implement the screenshot functionality as soon as possible because I really need this and Thank you so much for you quick response I really like your library and your quick response @HBiSoft

mohit7376verma commented 3 years ago

Hi @HBiSoft I'm also getting the same issues in my android 10 device , so I tried Your demo app and set the

  1. video encoder to H264
  2. resolution to 1920x1080
  3. bitrate 2.5Mbps
  4. Frame rate 30FPS

and using these custom settings it worked and if reverted it to default it shows the "HBRecorderOnError See Log" errorCode: 100 reason: 268435556 is shown a log.

HBiSoft commented 3 years ago

@mohit7376verma

Hi @HBiSoft I'm also getting the same issues in my android 10 device , so I tried Your demo app and set the

  1. video encoder to H264
  2. resolution to 1920x1080
  3. bitrate 2.5Mbps
  4. Frame rate 30FPS

and using these custom settings it worked and if reverted it to default it shows the "HBRecorderOnError See Log" errorCode: 100 reason: 268435556 is shown a log.

My apologies for the delayed response. I'm not sure why this is happening on some devices. This seems to be device specific. Please provide the log after opening the demo application, it will start with E/HBRecorderCodecInfo

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed if no further activity occurs within the next 3 days. Thank you for your contributions.

Feartheyc commented 1 year ago

pls solve it waiting since i have the same error. Writing here so it doesn't get closed

MuhammadDanyalRehmanOfficial commented 7 months ago

Hi, this issue I/flutter ( 9131): Start E/Video Error:( 9131): 100 E/Video Error:( 9131): 268435556 D/MediaRecorder( 9131): reset E 0x7a66f950 D/MediaRecorder( 9131): doReset E 0x7a66f950 D/MediaRecorder( 9131): doReset X 0x7a66f950 D/MediaRecorder( 9131): close E 0x7a66f950 D/MediaRecorder( 9131): close X 0x7a66f950 D/MediaRecorder( 9131): reset X 0x7a66f950 W/System ( 9131): A resource failed to call release.

Mouadabdelghafouraitali commented 6 months ago

The issue is 100% related to the video encoder. When I set it to MediaRecorder.VideoEncoder.H264, the problem is resolved.

MuhammadDanyalRehmanOfficial commented 6 months ago

But this give the error in use in the flutter. Can you share LinkedIn Profile for share the video of error.

On Sun, Apr 28, 2024, 10:45 PM Mouaad Abdelghafour AIT ALI < @.***> wrote:

The issue is 100% related to the video encoder. When I set it to MediaRecorder.VideoEncoder.H264, the problem is resolved.

— Reply to this email directly, view it on GitHub https://github.com/HBiSoft/HBRecorder/issues/43#issuecomment-2081572940, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7U3KYG5PJOU276FD7SEKXLY7UYVBAVCNFSM4TZBW7Z2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBYGE2TOMRZGQYA . You are receiving this because you commented.Message ID: @.***>