FlashyWrappers icon indicating copy to clipboard operation
FlashyWrappers copied to clipboard

Android: Video Encoding progress do not completed

Open jkpatel1463 opened this issue 7 years ago • 7 comments

Environment

  • Android API Version:4.3, 4.2.1, 6.0.1
  • AIR SDK Version: 26.0 Device: Moto G (2nd Generation) Os:Android 6.0 Device Link: http://www.gsmarena.com/motorola_moto_g_dual_sim_(2nd_gen)-6648.php

Problem Description

  • Screen flicker (shows previous screen for a some milliseconds-then shows animation screens for some milliseconds, so it looks fleshing lights in mobile) while video creation process is in progress.
  • I do not interrupt the process of the video creation, so encoding event was listed and it do not completed.

Steps to Reproduce

  1. Open the app
  2. Tap a button to start video creation process
  3. Animation flickered after 2 to 3 seconds.

jkpatel1463 avatar Sep 15 '17 14:09 jkpatel1463

Hi, thanks for the report. The flicker is a known issue in some situations, though I saw it mostly happening when video camera was displaying a video. Does the app display video camera output on screen?

Android device log would help me to determine why the encoding didn't complete, otherwise there's no chance to tell.

Also if you can, try to record in software mode:

  1. see if you observe the flicker (I think you shouldn't)
  2. see if you can finish the encoding

Thanks

rainbowcreatures avatar Sep 15 '17 16:09 rainbowcreatures

Hello @rainbowcreatures

Please find the log in the link: https://www.dropbox.com/s/2k5iaj17b9fm7dg/FWlog.txt?dl=0

jkpatel1463 avatar Sep 16 '17 09:09 jkpatel1463

Hello @rainbowcreature

I found that when i start the recording with software method by belowcode, it do not record the video and directl shows merge video log

Here is the code for starting the recording for android:

_fwEncoder.start(24, FWVideoEncoder.AUDIO_STEREO, false);
_fwEncoder.forcePTSMode(FWVideoEncoder.PTS_REALTIME);   //  force software mode to work in realtime      
_fwEncoder.forceFramedropMode(FWVideoEncoder.FRAMEDROP_ON);   //  force software mode to work in realtime

Here is the log message i get instantly after starting the record.

[FlashyWrappers] Merged file path: /storage/emulated/0/Android/data/air.app_package_id/files/video_merged.mp4

jkpatel1463 avatar Sep 16 '17 09:09 jkpatel1463

Hello @rainbowcreatures

Am i doing any mistake in starting record with software mode ?

jkpatel1463 avatar Sep 18 '17 05:09 jkpatel1463

This seems weird, the first log is only the "clean" FWLog, I'd need complete device log for the whole of the recording session. Also set FW logging to "verbose" mode before starting:

http://flashywrappers.com/asdoc/com/rainbowcreatures/FWVideoEncoder.html#setLogging()

Android Studio device log

rainbowcreatures avatar Sep 18 '17 18:09 rainbowcreatures

Hello @rainbowcreatures I have set loggin as verbose, As per your instruction _fwEncoder.setLogging(FWVideoEncoder.LOGGING_VERBOSE);

Here is Android studio device log: https://www.dropbox.com/s/ng5t8gntc94199r/Flashy_wrapper_Android%20Studio%20device%20log.txt?dl=0

i found that plugin is crashed. Here are the stacktrace of crash:

09-20 10:30:30.848 29274-29927/? I/ACodec: setupVideoEncoder succeeded
09-20 10:30:30.863 29274-29925/? E/[EGL-ERROR]: EGLBoolean __egl_platform_create_surface_window(egl_surface*, mali_base_ctx_handle):787: [__egl_platform_create_surface_window]: dequeueBuffer fail on native win 0x5b39c008, buffer 0x0
09-20 10:30:30.868 29274-29925/? W/System.err: java.lang.Exception: eglCreateWindowSurface: EGL error: 0x3003
09-20 10:30:30.868 29274-29925/? W/System.err:     at com.rainbowcreatures.FlashyWrappersAndroidHW.ae.a(Unknown Source)
09-20 10:30:30.868 29274-29274/? I/[FlashyWrappers]: Waiting for composer to start...
09-20 10:30:30.868 29274-29925/? W/System.err:     at com.rainbowcreatures.FlashyWrappersAndroidHW.ae.<init>(Unknown Source)
09-20 10:30:30.868 29274-29925/? W/System.err:     at com.rainbowcreatures.FlashyWrappersAndroidHW.z.a(Unknown Source)
09-20 10:30:30.868 29274-29925/? W/System.err:     at com.rainbowcreatures.FlashyWrappersAndroidHW.ag.handleMessage(Unknown Source)
09-20 10:30:30.868 29274-29925/? W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 10:30:30.868 29274-29925/? W/System.err:     at android.os.Looper.loop(Looper.java:176)
09-20 10:30:30.868 29274-29925/? W/System.err:     at com.rainbowcreatures.FlashyWrappersAndroidHW.af.run(Unknown Source)
09-20 10:30:30.868 29274-29925/? W/System.err:     at java.lang.Thread.run(Thread.java:841)
09-20 10:30:30.868 29274-29925/? I/[FlashyWrappers]: Finishing composerRunnable loop...

jkpatel1463 avatar Sep 20 '17 05:09 jkpatel1463

Nice catch @jkpatel1463 , so its in OpenGL (eglX messages). This is a low-level issue. It is something specific to this Android device make/model/Android or GL ES implementation. Without having the exact device here this will be hard to debug.

The only weird thing I see is width and height reported as -1 by Android before initialization.

You might try swapping around couple resolutions when initializing recording, that's the only thing that seemed to sometimes help with weird GL ES implementations. I particularly remember there were strange issues with the Mali GPU's, unfortunately. Maybe try forcing 1280x720 (or even lower, but something "safe", ie same as Android screen resolution):

myEncoder.setDimensions(1280, 720);
myEncoder.start(....);

Software mode won't help with this, as the video composer I'm using to render the final video uses GL ES as well (I could add one that doesn't use GL ES, but making fallback purely software mode seemed like overkill, its not too trivial and might bring its own issues).

rainbowcreatures avatar Sep 20 '17 14:09 rainbowcreatures