Screenrecord says "Encoder failed" with Android 9.0.0_2.3.4

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Screenrecord says "Encoder failed" with Android 9.0.0_2.3.4

Jump to solution
2,905 Views
rob_mclean
Contributor IV

When I try to use "screenrecord" with Android 9.0.0_2.3.4 on an i.MX8QXP, I'm getting this:

# screenrecord --verbose /data/blah.mp4
Main display is 1920x1080 @60.00fps (orientation=0)
Configuring recorder for 1920x1080 video/avc at 20.00Mbps
Content area is 1920x1080 at offset x=0 y=0
Encoder failed (err=-38)
Stopping encoder and muxer

Here is what logcat has to say when I run that command:

12-04 20:14:14.401 4520 4524 I OMXClient: IOmx service obtained
12-04 20:14:14.402 4503 4503 I OMXMaster: makeComponentInstance(OMX.Freescale.std.video_encoder.avc.hw-based) in omx@1.0-service process
12-04 20:14:14.422 4503 4503 W OMXNodeInstance: [0xf2b32004:Freescale.std._encoder.avc.hw-based] component does not support metadata mode; using fallback
12-04 20:14:14.423 4520 4524 W OMXUtils: do not know color format 0x6 = 6
12-04 20:14:14.423 4520 4524 W OMXUtils: do not know color format 0x7f000789 = 2130708361
12-04 20:14:14.424 4520 4524 I ACodec : setupAVCEncoderParameters with [profile: Baseline] [level: Level1]
12-04 20:14:14.425 4520 4524 I ACodec : [OMX.Freescale.std.video_encoder.avc.hw-based] cannot encode HDR static metadata. Ignoring.
12-04 20:14:14.425 4520 4524 I ACodec : setupVideoEncoder succeeded
12-04 20:14:14.426 4520 4524 W OMXUtils: do not know color format 0x7f000789 = 2130708361
12-04 20:14:14.426 4503 4503 E OMXNodeInstance: getConfig(0xf2b32004:Freescale.std._encoder.avc.hw-based, ConfigLatency(0x6f800005)) ERROR: NotImplemented(0x80001006)
12-04 20:14:14.426 4503 4503 E OMXNodeInstance: getConfig(0xf2b32004:Freescale.std._encoder.avc.hw-based, ConfigAndroidVendorExtension(0x6f100004)) ERROR: NotImplemented(0x80001006)
12-04 20:14:14.430 4503 4503 D GraphicBufferSource: setting dataspace: 0x104, acquired=0
12-04 20:14:14.430 4503 4503 D GraphicBufferSource: requesting color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M))
12-04 20:14:14.433 2427 2427 W AshmemAllocator: ashmem_create_region(12) returning hidl_memory(0xf2ade842c100, 12)
12-04 20:14:14.483 2427 2427 I chatty : uid=1000(system) allocator@1.0-s identical 4 lines
12-04 20:14:14.483 2427 2427 W AshmemAllocator: ashmem_create_region(12) returning hidl_memory(0xf2ade842c100, 12)
12-04 20:14:14.485 2427 2427 W AshmemAllocator: ashmem_create_region(1572864) returning hidl_memory(0xf2ade842c100, 1572864)
12-04 20:14:14.491 2427 2427 I chatty : uid=1000(system) allocator@1.0-s identical 2 lines
12-04 20:14:14.492 2427 2427 W AshmemAllocator: ashmem_create_region(1572864) returning hidl_memory(0xf2ade842c100, 1572864)
12-04 20:14:14.534 4503 4513 I display : open gpu gralloc module!
12-04 20:14:14.549 2442 2530 E dpug2d : g2d_open: Init Dpu Handle fail !
12-04 20:14:14.550 2442 2530 I chatty : uid=1000(system) HwBinder:2442_2 identical 1 line
12-04 20:14:14.550 2442 2530 E dpug2d : g2d_open: Init Dpu Handle fail !
12-04 20:14:14.569 4503 4513 D GraphicBufferSource: got buffer with new dataSpace #104
12-04 20:14:14.569 4503 4528 D OMXNodeInstance: Codec resolved it to (R:2(??), P:1(??), M:1(??), T:3(??)) err=0(NO_ERROR)
12-04 20:14:14.569 4520 4524 D ACodec : dataspace changed to 0x10c10000 (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) (R:2(Limited), S:1(BT709), T:3(SMPTE_170M))
12-04 20:14:14.571 2442 2530 E display : updateScreen invalid drmfd
12-04 20:14:14.576 4503 4526 I OMXPlayer: LEVEL: 1 FUNCTION: PrepareForPreprocess LINE: 1935
12-04 20:14:14.576 4503 4526 I OMXPlayer: PrepareForPreprocess pPreProcess Create failed
12-04 20:14:14.577 4503 4526 I OMXPlayer: LEVEL: 1 FUNCTION: ProcessDataBuffer LINE: 1335
12-04 20:14:14.577 4503 4526 I OMXPlayer: PrepareForPreprocess failed
12-04 20:14:14.578 2488 2488 I /system/bin/tombstoned: received crash request for pid 4503
12-04 20:14:14.592 4503 4526 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-04 20:14:14.592 4503 4526 F DEBUG : Build fingerprint: 'spaulding/spauldingonedevice/spauldingonedevice:9/dea-9.0-r2.1/rob10200800:eng/dev-keys'
12-04 20:14:14.592 4503 4526 F DEBUG : Revision: '0'
12-04 20:14:14.592 4503 4526 F DEBUG : ABI: 'arm'
12-04 20:14:14.592 4503 4526 F DEBUG : pid: 4503, tid: 4526, name: omx@1.0-service >>> media.codec <<<
12-04 20:14:14.592 4503 4526 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x44
12-04 20:14:14.592 4503 4526 F DEBUG : Cause: null pointer dereference
12-04 20:14:14.592 4503 4526 F DEBUG : r0 00000000 r1 41424752 r2 00000001 r3 7f000001
12-04 20:14:14.592 4503 4526 F DEBUG : r4 41424752 r5 00000000 r6 8000100e r7 f206a58d
12-04 20:14:14.592 4503 4526 F DEBUG : r8 80001005 r9 f28ad004 r10 f206a579 r11 f206a550
12-04 20:14:14.592 4503 4526 F DEBUG : ip f2094ddc sp f1f71760 lr f2088281 pc f208822c
12-04 20:14:14.602 4503 4526 F DEBUG :
12-04 20:14:14.602 4503 4526 F DEBUG : backtrace:
12-04 20:14:14.602 4503 4526 F DEBUG : #00 pc 0000822c /vendor/lib/lib_omx_v4l2_common_arm11_elinux.so (V4l2Object::IsFormatSupported(unsigned int)+8)
12-04 20:14:14.602 4503 4526 F DEBUG : #01 pc 0000827d /vendor/lib/lib_omx_v4l2_common_arm11_elinux.so (V4l2Object::SetFormat(V4l2ObjectFormat*)+36)
12-04 20:14:14.602 4503 4526 F DEBUG : #02 pc 0000db6f /vendor/lib/lib_omx_v4l2_common_arm11_elinux.so (IsiColorConvert::setParam()+78)
12-04 20:14:14.602 4503 4526 F DEBUG : #03 pc 0000ddbf /vendor/lib/lib_omx_v4l2_common_arm11_elinux.so (IsiColorConvert::AddInputFrame(OMX_BUFFERHEADERTYPE*)+158)
12-04 20:14:14.602 4503 4526 F DEBUG : #04 pc 00006f37 /vendor/lib/lib_omx_v4l2_enc_arm11_elinux.so (V4l2Enc::ProcessInputBuffer()+274)
12-04 20:14:14.602 4503 4526 F DEBUG : #05 pc 00006769 /vendor/lib/lib_omx_v4l2_enc_arm11_elinux.so (V4l2Enc::ProcessDataBuffer()+500)
12-04 20:14:14.602 4503 4526 F DEBUG : #06 pc 00009ebb /vendor/lib/lib_omx_common_v2_arm11_elinux.so (DoThread(void*)+114)
12-04 20:14:14.602 4503 4526 F DEBUG : #07 pc 00063bb5 /system/lib/libc.so (__pthread_start(void*)+22)
12-04 20:14:14.602 4503 4526 F DEBUG : #08 pc 0001e02d /system/lib/libc.so (__start_thread+22)
12-04 20:14:14.678 2488 2488 E /system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_28
12-04 20:14:14.686 2598 2618 I BootReceiver: Copying /data/tombstones/tombstone_28 to DropBox (SYSTEM_TOMBSTONE)
12-04 20:14:14.702 4520 4524 E ACodec : OMX/mediaserver died, signalling error!
12-04 20:14:14.702 4520 4524 E ACodec : signalError(omxError 0x8000100d, internalError -32)
12-04 20:14:14.702 4520 4523 E MediaCodec: Codec reported err 0xffffffe0, actionCode 0, while in state 6
12-04 20:14:14.702 4520 4520 W ScreenRecord: dequeueOutputBuffer returned INVALID_OPERATION
12-04 20:14:14.708 4520 4520 E MediaMuxer: stop() is called in invalid state 1
12-04 20:14:14.724 2467 2467 W libEGL : EGLNativeWindowType 0xe93b42bf9010 disconnect failed
12-04 20:14:14.727 2442 2530 E dpug2d : g2d_open: Init Dpu Handle fail !
12-04 20:14:14.727 2442 2530 I chatty : uid=1000(system) HwBinder:2442_2 identical 1 line
12-04 20:14:14.727 2442 2530 E dpug2d : g2d_open: Init Dpu Handle fail !
12-04 20:14:14.732 4520 4520 D ScreenRecord: failed
12-04 20:14:14.732 2442 2530 E display : updateScreen invalid drmfd
12-04 20:14:14.761 2598 2613 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
12-04 20:14:14.762 2598 2613 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
12-04 20:14:14.752 4533 4533 W init : type=1400 audit(0.0:217): avc: granted { read } for name="null" dev="tmpfs" ino=9292 scontext=u:r:init:s0 tcontext=u:object_r:null_device:s0 tclass=chr_file
12-04 20:14:14.951 4533 4533 I media.codec: mediacodecservice starting
12-04 20:14:14.952 4533 4533 W media.codec: libminijail[4533]: failed to get path of fd 4: No such file or directory
12-04 20:14:14.952 4533 4533 W media.codec: libminijail[4533]: allowing syscall: clock_gettime
12-04 20:14:14.952 4533 4533 W media.codec: libminijail[4533]: allowing syscall: connect
12-04 20:14:14.952 4533 4533 W media.codec: libminijail[4533]: allowing syscall: fcntl64
12-04 20:14:14.952 4533 4533 W media.codec: libminijail[4533]: allowing syscall: socket
12-04 20:14:14.952 4533 4533 W media.codec: libminijail[4533]: allowing syscall: writev
12-04 20:14:14.954 4533 4533 W media.codec: libminijail[4533]: compile_file: <fd>(61): nonexistent syscall 'create'
12-04 20:14:14.954 4533 4533 W media.codec: libminijail[4533]: compile_file: <fd>(63): nonexistent syscall 'mkfifo'
12-04 20:14:14.954 4533 4533 W media.codec: libminijail[4533]: logging seccomp filter failures
12-04 20:14:14.961 4533 4533 W MediaCodecsXmlParser: unable to open media codecs configuration xml file: /data/misc/media/media_codecs_profiling_results.xml
12-04 20:14:14.962 4533 4533 W MediaCodecsXmlParser: parseTopLevelXMLFile(/data/misc/media/media_codecs_profiling_results.xml) failed
12-04 20:14:14.964 4533 4533 I ServiceManagement: Removing namespace from process name android.hardware.media.omx@1.0-service to omx@1.0-service.
12-04 20:14:14.971 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.971 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_ac3
12-04 20:14:14.971 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.971 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_ac3 fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_ddp
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_ddp fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_ms
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_ms fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_wmv9
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_wmv9 fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_ra
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_ra fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_rv
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_rv fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_dsp_aacp
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_dsp_aacp fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_dsp
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_dsp fail.
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: Open LINE: 39
12-04 20:14:14.972 4533 4533 I OMXPlayer: Can't open file: /vendor/etc/component_register_divx
12-04 20:14:14.972 4533 4533 I OMXPlayer: LEVEL: 1 FUNCTION: ComponentRegister LINE: 75
12-04 20:14:14.972 4533 4533 I OMXPlayer: Open component register file /vendor/etc/component_register_divx fail.
12-04 20:14:14.979 4533 4533 W MediaCodecsXmlParser: unable to open media codecs configuration xml file: /data/misc/media/media_codecs_profiling_results.xml
12-04 20:14:14.979 4533 4533 W MediaCodecsXmlParser: parseTopLevelXMLFile(/data/misc/media/media_codecs_profiling_results.xml) failed
12-04 20:14:14.979 4533 4533 I ServiceManagement: Removing namespace from process name android.hardware.media.omx@1.0-service to omx@1.0-service.
12-04 20:14:14.981 4533 4533 I media.codec: IOmx HAL service created.

 Are there Android device build settings that I don't have enabled, or extra firmware that I need to include, or something else I'm missing from the build that allows the video encoder codec to grab frames from the display frame buffer? 

0 Kudos
1 Solution
2,846 Views
rob_mclean
Contributor IV

It looks like there are some pretty big changes between my 4.14 kernel and the "latest and greatest" kernel.  For example the file that sets up the DRM connections isn't even in the 5.x kernel I looked at.  So an easy backport is not likely.

For the time being I'm just going to have to live without screenrecord or scrcpy.

View solution in original post

0 Kudos
3 Replies
2,880 Views
rob_mclean
Contributor IV

I've discovered that when IsiColorConvert::Create calls the pColorDev->LookupNode it enumerates all the /dev/video<n> device handles from 2 to 20 looking for a capture or output device that has "mxc-isi" in its name.  As it turns out the only /dev/video devices handles available on my device are named "mxc-jpeg decode", "mxc-jpeg encode", "vpu B0", and "vpu encoder".  So it fails to find the video device it is looking for, and the error code isn't properly handled further upstream, causing the codec to crash later on.

For reference, I'm using a 4.14.181 Linux kernel with DRM support driving a Raydium MIPI-DSI display.

I suspect all I need to do is add, enable, or configure a node or two in my device tree so that the "LookupNode" function will find the source of buffers to use for the encoder.  I suspect the device I seek is the "fsl,imx8-isi" compatible device since that's the only device that has "mxc-isi" in it's name in my kernel source code.  However, I'm not sure how to configure the "interface" parameter to work with DRM.  I tried the obvious interface settings (input from either DC0 or DC1, output to memory).  That did create more /dev/video<n> device handles, but none of them worked.

0 Kudos
2,859 Views
rob_mclean
Contributor IV

I've been reading through the kernel code for the mxc-isi driver, specifically in the file named "drivers/media/platform/imx8/mxc-media-dev.c". In that file, it looks like DC0, DC1, and MEM are unsupported input devices by the function "mxc_md_create_links" which is responsible for setting up the v4l2 pipeline source and sink pads.

I hope that someone out there can prove me wrong, but at this point I think this means the Android apps screenrecord and scrcpy are not supported from my Linux kernel.

I may jump ahead to see if there is a solution I can easily backport from a newer kernel.

0 Kudos
2,847 Views
rob_mclean
Contributor IV

It looks like there are some pretty big changes between my 4.14 kernel and the "latest and greatest" kernel.  For example the file that sets up the DRM connections isn't even in the 5.x kernel I looked at.  So an easy backport is not likely.

For the time being I'm just going to have to live without screenrecord or scrcpy.

0 Kudos