motioneye-project / motioneyeos

A Video Surveillance OS For Single-board Computers
Other
7.88k stars 902 forks source link

Raspberry Pi H.264 Hardware Assisted Encoding (OMX) Unstable At Higher (> 1024 x 768) Resolutions #2744

Open Matthew1471 opened 3 years ago

Matthew1471 commented 3 years ago

Preliminary Docs

I confirm that I have read the CONTRIBUTING guide before opening this issue.

I confirm that I have read the FAQ before opening this issue.

motionEyeOS Version

I am running motionEyeOS version: dev20201026.

Board Model

I am using the following board/model: Raspberry Pi 4B (4GB).

Camera

I am using the following type of camera: 1 x Network Camera & 1 x MMAL Camera.

My camera model is: Pi Camera 2.1.

Network Connection

My motionEyeOS unit is connected to the network via: WiFi.

Peripherals

I am using the following peripherals that I consider relevant to this issue:

Log Files

I consider the following log files relevant to this issue:

[63065.926100] ------------[ cut here ]------------
[63065.926120] WARNING: CPU: 1 PID: 5518 at drivers/firmware/raspberrypi.c:63 rpi_firmware_transaction+0xf8/0x134
[63065.926125] Firmware transaction timeout
[63065.926128] Modules linked in: md4 md5 cmac nls_utf8 cifs libarc4 ipv6 nf_defrag_ipv6 brcmfmac brcmutil sha256_generic libsha256 bcm2835_codec(C) bcm2835_v4l2(C) bcm2835_isp(C) cfg80211 v4l2_mem2mem bcm2835_mmal_vchiq(C) rfkill video>
[63065.926221] CPU: 1 PID: 5518 Comm: kworker/1:2 Tainted: G         C        5.4.51-v7l #1
[63065.926224] Hardware name: BCM2711
[63065.926235] Workqueue: events get_values_poll [raspberrypi_hwmon]
[63065.926239] Backtrace:
[63065.926248] [<c020e0bc>] (dump_backtrace) from [<c020e41c>] (show_stack+0x20/0x24)
[63065.926254]  r7:ffffffff r6:00000000 r5:60070013 r4:c129cba0
[63065.926262] [<c020e3fc>] (show_stack) from [<c0a40a44>] (dump_stack+0xd4/0x118)
[63065.926268] [<c0a40970>] (dump_stack) from [<c022225c>] (__warn+0xe0/0x108)
[63065.926274]  r10:00000000 r9:ef97e540 r8:00000009 r7:0000003f r6:c08a79e4 r5:00000009
[63065.926277]  r4:c0e31920 r3:00000000
[63065.926283] [<c022217c>] (__warn) from [<c022265c>] (warn_slowpath_fmt+0xa8/0xcc)
[63065.926287]  r7:c08a79e4 r6:0000003f r5:c0e31920 r4:c0e31940
[63065.926294] [<c02225b8>] (warn_slowpath_fmt) from [<c08a79e4>] (rpi_firmware_transaction+0xf8/0x134)
[63065.926299]  r8:00001000 r7:e362e700 r6:00000000 r5:ffffff92 r4:ef97e540
[63065.926306] [<c08a78ec>] (rpi_firmware_transaction) from [<c08a7ae0>] (rpi_firmware_property_list+0xc0/0x180)
[63065.926310]  r6:eac0401c r5:00000010 r4:eac04000
[63065.926316] [<c08a7a20>] (rpi_firmware_property_list) from [<c08a7c10>] (rpi_firmware_property+0x70/0x118)
[63065.926321]  r10:e362e70c r9:00030046 r8:ef97e540 r7:efae3ee8 r6:00000004 r5:00000010
[63065.926325]  r4:e362e700
[63065.926332] [<c08a7ba0>] (rpi_firmware_property) from [<bf0aa0c4>] (get_values_poll+0x50/0x160 [raspberrypi_hwmon])
[63065.926337]  r10:00000000 r9:00000040 r8:00000000 r7:eff8a500 r6:eff87300 r5:e33cbc80
[63065.926341]  r4:e37cc2cc r3:00000004
[63065.926349] [<bf0aa074>] (get_values_poll [raspberrypi_hwmon]) from [<c023ebcc>] (process_one_work+0x220/0x534)
[63065.926352]  r4:e37cc2cc
[63065.926358] [<c023e9ac>] (process_one_work) from [<c023ef2c>] (worker_thread+0x4c/0x580)
[63065.926363]  r10:eff87300 r9:c1203d00 r8:eff87318 r7:00000008 r6:eff87300 r5:e33cbc94
[63065.926366]  r4:e33cbc80
[63065.926373] [<c023eee0>] (worker_thread) from [<c0246360>] (kthread+0x144/0x170)
[63065.926378]  r10:e35c5e7c r9:e362ec9c r8:e33cbc80 r7:efae2000 r6:00000000 r5:e362ee40
[63065.926381]  r4:e362ec80
[63065.926387] [<c024621c>] (kthread) from [<c02010ac>] (ret_from_fork+0x14/0x28)
[63065.926391] Exception stack(0xefae3fb0 to 0xefae3ff8)
[63065.926395] 3fa0:                                     00000000 00000000 00000000 00000000
[63065.926400] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[63065.926404] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[63065.926409]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c024621c
[63065.926412]  r4:e362ee40
[63065.926416] ---[ end trace 0607d84c87d25541 ]---
[63065.926439] hwmon hwmon1: Failed to get throttled (-110)
[63066.966110] cpu cpu0: dev_pm_opp_set_rate: failed to find current OPP for freq 4294967186 (-34)
[63068.006172] raspberrypi-clk soc:firmware:clocks: Failed to change fw-clk-arm frequency: -110
[63071.126121] cpu cpu0: dev_pm_opp_set_rate: failed to find current OPP for freq 4294967186 (-34)
[63072.166120] raspberrypi-clk soc:firmware:clocks: Failed to change fw-clk-arm frequency: -110
[63281.527640] INFO: task kworker/0:0:2355 blocked for more than 122 seconds.
[63281.527648]       Tainted: G        WC        5.4.51-v7l #1
[63281.527654] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[63281.527660] kworker/0:0     D    0  2355      2 0x00000000
[63281.527677] Workqueue: events dbs_work_handler
[63281.527683] Backtrace:
[63281.527696] [<c0a598a0>] (__schedule) from [<c0a5a124>] (schedule+0x5c/0xd0)
[63281.527705]  r10:c128e5ec r9:00000000 r8:e3403c04 r7:00000002 r6:e3402000 r5:e3402000
[63281.527711]  r4:e3614c40
[63281.527719] [<c0a5a0c8>] (schedule) from [<c0a5a594>] (schedule_preempt_disabled+0x18/0x1c)
[63281.527725]  r5:e3402000 r4:c128e5e8
[63281.527733] [<c0a5a57c>] (schedule_preempt_disabled) from [<c0a5c8ac>] (__mutex_lock.constprop.0+0x2c0/0x558)
[63281.527742] [<c0a5c5ec>] (__mutex_lock.constprop.0) from [<c0a5cc60>] (__mutex_lock_slowpath+0x1c/0x20)
[63281.527749]  r10:00000000 r9:ef97e540 r8:00001000 r7:e33b8140 r6:eac04024 r5:00000018
[63281.527754]  r4:c128e5e8
[63281.527763] [<c0a5cc44>] (__mutex_lock_slowpath) from [<c0a5ccc0>] (mutex_lock+0x5c/0x60)
[63281.527772] [<c0a5cc64>] (mutex_lock) from [<c08a7940>] (rpi_firmware_transaction+0x54/0x134)
[63281.527778]  r5:00000018 r4:ef97e540
[63281.527787] [<c08a78ec>] (rpi_firmware_transaction) from [<c08a7ae0>] (rpi_firmware_property_list+0xc0/0x180)
[63281.527793]  r6:eac04024 r5:00000018 r4:eac04000
[63281.527802] [<c08a7a20>] (rpi_firmware_property_list) from [<c08a7c10>] (rpi_firmware_property+0x70/0x118)
[63281.527809]  r10:e33b814c r9:00030002 r8:ef97e540 r7:e3403d20 r6:0000000c r5:00000018
[63281.527815]  r4:e33b8140
[63281.527824] [<c08a7ba0>] (rpi_firmware_property) from [<c06ffb64>] (raspberrypi_clock_property+0x58/0x88)
[63281.527831]  r10:2cb41780 r9:ffffff92 r8:00000000 r7:efbb76c0 r6:00000000 r5:efbb76c0
[63281.527837]  r4:e3403d48 r3:0000000c
[63281.527844] [<c06ffb0c>] (raspberrypi_clock_property) from [<c06ffbe4>] (raspberrypi_fw_get_rate+0x50/0x7c)
[63281.527850]  r5:efbb76c0 r4:00000000
[63281.527858] [<c06ffb94>] (raspberrypi_fw_get_rate) from [<c06f650c>] (clk_recalc+0x44/0x84)
[63281.527866] [<c06f64c8>] (clk_recalc) from [<c06f80f0>] (clk_change_rate+0x108/0x478)
[63281.527872]  r5:00000000 r4:efbb76c0
[63281.527880] [<c06f7fe8>] (clk_change_rate) from [<c06f85e8>] (clk_core_set_rate_nolock+0x188/0x1b0)
[63281.527887]  r10:ef262780 r9:ef224280 r8:ffffffde r7:efbb76c0 r6:2cb41780 r5:00000000
[63281.527892]  r4:efbb76c0
[63281.527900] [<c06f8460>] (clk_core_set_rate_nolock) from [<c06f8650>] (clk_set_rate+0x40/0x98)
[63281.527907]  r7:00000001 r6:ffffff92 r5:2cb41780 r4:ef262780
[63281.527916] [<c06f8610>] (clk_set_rate) from [<c0874330>] (dev_pm_opp_set_rate+0x37c/0x478)
[63281.527921]  r5:2cb41780 r4:ef27da00
[63281.527929] [<c0873fb4>] (dev_pm_opp_set_rate) from [<c087e838>] (set_target+0x3c/0x64)
[63281.527936]  r10:00000000 r9:000b71b0 r8:00000000 r7:00000001 r6:000b71b0 r5:00000000
[63281.527941]  r4:ef27de00
[63281.527951] [<c087e7fc>] (set_target) from [<c0878c20>] (__cpufreq_driver_target+0x234/0x560)
[63281.527957]  r7:00000001 r6:c1363c38 r5:00000000 r4:ef27de00
[63281.527967] [<c08789ec>] (__cpufreq_driver_target) from [<c087c82c>] (od_dbs_update+0xc4/0x170)
[63281.527974]  r10:00000000 r9:efa40d80 r8:efa40d00 r7:e3451dc0 r6:efa40d80 r5:efa40d00
[63281.527979]  r4:ef27de00
[63281.527987] [<c087c768>] (od_dbs_update) from [<c087dac4>] (dbs_work_handler+0x3c/0x68)
[63281.527995]  r9:00000000 r8:c128cd94 r7:ef27de00 r6:efa40d04 r5:00000000 r4:efa40d38
[63281.528004] [<c087da88>] (dbs_work_handler) from [<c023ebcc>] (process_one_work+0x220/0x534)
[63281.528011]  r9:00000000 r8:00000000 r7:eff76500 r6:eff73300 r5:e1fb1900 r4:efa40d38
[63281.528020] [<c023e9ac>] (process_one_work) from [<c023ef2c>] (worker_thread+0x4c/0x580)
[63281.528027]  r10:eff73300 r9:c1203d00 r8:eff73318 r7:00000008 r6:eff73300 r5:e1fb1914
[63281.528032]  r4:e1fb1900
[63281.528041] [<c023eee0>] (worker_thread) from [<c0246360>] (kthread+0x144/0x170)
[63281.528048]  r10:e338de7c r9:e2f5d9dc r8:e1fb1900 r7:e3402000 r6:00000000 r5:e33b8380
[63281.528053]  r4:e2f5d9c0
[63281.528062] [<c024621c>] (kthread) from [<c02010ac>] (ret_from_fork+0x14/0x28)
[63281.528068] Exception stack(0xe3403fb0 to 0xe3403ff8)
[63281.528075] 3fa0:                                     00000000 00000000 00000000 00000000
[63281.528082] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[63281.528088] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[63281.528095]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c024621c
[63281.528100]  r4:e33b8380
[63281.528113] INFO: task kworker/1:2:5518 blocked for more than 122 seconds.
[63281.528119]       Tainted: G        WC        5.4.51-v7l #1
[63281.528124] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[63281.528129] kworker/1:2     D    0  5518      2 0x00000000
[63281.528146] Workqueue: events get_values_poll [raspberrypi_hwmon]
[63281.528153] Backtrace:
[63281.528162] [<c0a598a0>] (__schedule) from [<c0a5a124>] (schedule+0x5c/0xd0)
[63281.528169]  r10:00000000 r9:ef97e540 r8:eff80440 r7:eff80440 r6:c1203d00 r5:efae2000
[63281.528175]  r4:e3595b80
[63281.528182] [<c0a5a0c8>] (schedule) from [<c0a5e478>] (schedule_timeout+0x184/0x318)
[63281.528188]  r5:efae3d9c r4:00654678
[63281.528196] [<c0a5e2f4>] (schedule_timeout) from [<c0a5b210>] (wait_for_completion_timeout+0xd8/0x164)
[63281.528203]  r8:00001000 r7:efae2000 r6:ef95ce90 r5:00057e40 r4:ef95ce8c
[63281.528212] [<c0a5b138>] (wait_for_completion_timeout) from [<c08d86f8>] (mbox_send_message+0xb8/0x118)
[63281.528218]  r7:ef95cef8 r6:efae3e38 r5:0000000e r4:ef95ce80
[63281.528227] [<c08d8640>] (mbox_send_message) from [<c08a7954>] (rpi_firmware_transaction+0x68/0x134)
[63281.528233]  r7:e362e300 r6:00000000 r5:00000010 r4:ef97e540
[63281.528242] [<c08a78ec>] (rpi_firmware_transaction) from [<c08a7ae0>] (rpi_firmware_property_list+0xc0/0x180)
[63281.528248]  r6:eac0501c r5:00000010 r4:eac05000
[63281.528256] [<c08a7a20>] (rpi_firmware_property_list) from [<c08a7c10>] (rpi_firmware_property+0x70/0x118)
[63281.528264]  r10:e362e30c r9:00030046 r8:ef97e540 r7:efae3ee8 r6:00000004 r5:00000010
[63281.528269]  r4:e362e300
[63281.528279] [<c08a7ba0>] (rpi_firmware_property) from [<bf0aa0c4>] (get_values_poll+0x50/0x160 [raspberrypi_hwmon])
[63281.528286]  r10:00000000 r9:00000040 r8:00000000 r7:eff8a500 r6:eff87300 r5:e33cbc80
[63281.528291]  r4:e37cc2cc r3:00000004
[63281.528301] [<bf0aa074>] (get_values_poll [raspberrypi_hwmon]) from [<c023ebcc>] (process_one_work+0x220/0x534)
[63281.528306]  r4:e37cc2cc
[63281.528314] [<c023e9ac>] (process_one_work) from [<c023ef2c>] (worker_thread+0x4c/0x580)
[63281.528322]  r10:eff87300 r9:c1203d00 r8:eff87318 r7:00000008 r6:eff87300 r5:e33cbc94
[63281.528327]  r4:e33cbc80
[63281.528335] [<c023eee0>] (worker_thread) from [<c0246360>] (kthread+0x144/0x170)
[63281.528342]  r10:e35c5e7c r9:e362ec9c r8:e33cbc80 r7:efae2000 r6:00000000 r5:e362ee40
[63281.528347]  r4:e362ec80
[63281.528354] [<c024621c>] (kthread) from [<c02010ac>] (ret_from_fork+0x14/0x28)
[63281.528360] Exception stack(0xefae3fb0 to 0xefae3ff8)
[63281.528366] 3fa0:                                     00000000 00000000 00000000 00000000
[63281.528373] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[63281.528380] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[63281.528387]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c024621c
[63281.528392]  r4:e362ee40
[63404.408953] INFO: task kworker/0:0:2355 blocked for more than 245 seconds.
[63404.408961]       Tainted: G        WC        5.4.51-v7l #1
[63404.408966] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[63404.408973] kworker/0:0     D    0  2355      2 0x00000000
[63404.408989] Workqueue: events dbs_work_handler
[63404.408996] Backtrace:
[63404.409009] [<c0a598a0>] (__schedule) from [<c0a5a124>] (schedule+0x5c/0xd0)
[63404.409017]  r10:c128e5ec r9:00000000 r8:e3403c04 r7:00000002 r6:e3402000 r5:e3402000
[63404.409023]  r4:e3614c40
[63404.409031] [<c0a5a0c8>] (schedule) from [<c0a5a594>] (schedule_preempt_disabled+0x18/0x1c)
[63404.409037]  r5:e3402000 r4:c128e5e8
[63404.409045] [<c0a5a57c>] (schedule_preempt_disabled) from [<c0a5c8ac>] (__mutex_lock.constprop.0+0x2c0/0x558)
[63404.409053] [<c0a5c5ec>] (__mutex_lock.constprop.0) from [<c0a5cc60>] (__mutex_lock_slowpath+0x1c/0x20)
[63404.409061]  r10:00000000 r9:ef97e540 r8:00001000 r7:e33b8140 r6:eac04024 r5:00000018
[63404.409066]  r4:c128e5e8
[63404.409074] [<c0a5cc44>] (__mutex_lock_slowpath) from [<c0a5ccc0>] (mutex_lock+0x5c/0x60)
[63404.409084] [<c0a5cc64>] (mutex_lock) from [<c08a7940>] (rpi_firmware_transaction+0x54/0x134)
[63404.409089]  r5:00000018 r4:ef97e540
[63404.409098] [<c08a78ec>] (rpi_firmware_transaction) from [<c08a7ae0>] (rpi_firmware_property_list+0xc0/0x180)
[63404.409104]  r6:eac04024 r5:00000018 r4:eac04000
[63404.409113] [<c08a7a20>] (rpi_firmware_property_list) from [<c08a7c10>] (rpi_firmware_property+0x70/0x118)
[63404.409120]  r10:e33b814c r9:00030002 r8:ef97e540 r7:e3403d20 r6:0000000c r5:00000018
[63404.409125]  r4:e33b8140
[63404.409135] [<c08a7ba0>] (rpi_firmware_property) from [<c06ffb64>] (raspberrypi_clock_property+0x58/0x88)
[63404.409142]  r10:2cb41780 r9:ffffff92 r8:00000000 r7:efbb76c0 r6:00000000 r5:efbb76c0
[63404.409148]  r4:e3403d48 r3:0000000c
[63404.409155] [<c06ffb0c>] (raspberrypi_clock_property) from [<c06ffbe4>] (raspberrypi_fw_get_rate+0x50/0x7c)
[63404.409161]  r5:efbb76c0 r4:00000000
[63404.409169] [<c06ffb94>] (raspberrypi_fw_get_rate) from [<c06f650c>] (clk_recalc+0x44/0x84)
[63404.409177] [<c06f64c8>] (clk_recalc) from [<c06f80f0>] (clk_change_rate+0x108/0x478)
[63404.409182]  r5:00000000 r4:efbb76c0
[63404.409190] [<c06f7fe8>] (clk_change_rate) from [<c06f85e8>] (clk_core_set_rate_nolock+0x188/0x1b0)
[63404.409197]  r10:ef262780 r9:ef224280 r8:ffffffde r7:efbb76c0 r6:2cb41780 r5:00000000
[63404.409202]  r4:efbb76c0
[63404.409210] [<c06f8460>] (clk_core_set_rate_nolock) from [<c06f8650>] (clk_set_rate+0x40/0x98)
[63404.409216]  r7:00000001 r6:ffffff92 r5:2cb41780 r4:ef262780
[63404.409225] [<c06f8610>] (clk_set_rate) from [<c0874330>] (dev_pm_opp_set_rate+0x37c/0x478)
[63404.409231]  r5:2cb41780 r4:ef27da00
[63404.409239] [<c0873fb4>] (dev_pm_opp_set_rate) from [<c087e838>] (set_target+0x3c/0x64)
[63404.409246]  r10:00000000 r9:000b71b0 r8:00000000 r7:00000001 r6:000b71b0 r5:00000000
[63404.409251]  r4:ef27de00
[63404.409261] [<c087e7fc>] (set_target) from [<c0878c20>] (__cpufreq_driver_target+0x234/0x560)
[63404.409267]  r7:00000001 r6:c1363c38 r5:00000000 r4:ef27de00
[63404.409276] [<c08789ec>] (__cpufreq_driver_target) from [<c087c82c>] (od_dbs_update+0xc4/0x170)
[63404.409283]  r10:00000000 r9:efa40d80 r8:efa40d00 r7:e3451dc0 r6:efa40d80 r5:efa40d00
[63404.409289]  r4:ef27de00
[63404.409297] [<c087c768>] (od_dbs_update) from [<c087dac4>] (dbs_work_handler+0x3c/0x68)
[63404.409304]  r9:00000000 r8:c128cd94 r7:ef27de00 r6:efa40d04 r5:00000000 r4:efa40d38
[63404.409313] [<c087da88>] (dbs_work_handler) from [<c023ebcc>] (process_one_work+0x220/0x534)
[63404.409320]  r9:00000000 r8:00000000 r7:eff76500 r6:eff73300 r5:e1fb1900 r4:efa40d38
[63404.409329] [<c023e9ac>] (process_one_work) from [<c023ef2c>] (worker_thread+0x4c/0x580)
[63404.409336]  r10:eff73300 r9:c1203d00 r8:eff73318 r7:00000008 r6:eff73300 r5:e1fb1914
[63404.409341]  r4:e1fb1900
[63404.409350] [<c023eee0>] (worker_thread) from [<c0246360>] (kthread+0x144/0x170)
[63404.409357]  r10:e338de7c r9:e2f5d9dc r8:e1fb1900 r7:e3402000 r6:00000000 r5:e33b8380
[63404.409362]  r4:e2f5d9c0
[63404.409371] [<c024621c>] (kthread) from [<c02010ac>] (ret_from_fork+0x14/0x28)
[63404.409377] Exception stack(0xe3403fb0 to 0xe3403ff8)
[63404.409383] 3fa0:                                     00000000 00000000 00000000 00000000
[63404.409390] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[63404.409397] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[63404.409404]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c024621c
[63404.409409]  r4:e33b8380
[63404.409420] INFO: task kworker/1:2:5518 blocked for more than 245 seconds.
[63404.409425]       Tainted: G        WC        5.4.51-v7l #1
[63404.409430] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[63404.409436] kworker/1:2     D    0  5518      2 0x00000000
[63404.409453] Workqueue: events get_values_poll [raspberrypi_hwmon]
[63404.409460] Backtrace:
[63404.409469] [<c0a598a0>] (__schedule) from [<c0a5a124>] (schedule+0x5c/0xd0)
[63404.409476]  r10:00000000 r9:ef97e540 r8:eff80440 r7:eff80440 r6:c1203d00 r5:efae2000
[63404.409481]  r4:e3595b80
[63404.409489] [<c0a5a0c8>] (schedule) from [<c0a5e478>] (schedule_timeout+0x184/0x318)
[63404.409494]  r5:efae3d9c r4:00654678
[63404.409502] [<c0a5e2f4>] (schedule_timeout) from [<c0a5b210>] (wait_for_completion_timeout+0xd8/0x164)
[63404.409509]  r8:00001000 r7:efae2000 r6:ef95ce90 r5:00057e40 r4:ef95ce8c
[63404.409518] [<c0a5b138>] (wait_for_completion_timeout) from [<c08d86f8>] (mbox_send_message+0xb8/0x118)
[63404.409524]  r7:ef95cef8 r6:efae3e38 r5:0000000e r4:ef95ce80
[63404.409532] [<c08d8640>] (mbox_send_message) from [<c08a7954>] (rpi_firmware_transaction+0x68/0x134)
[63404.409539]  r7:e362e300 r6:00000000 r5:00000010 r4:ef97e540
[63404.409547] [<c08a78ec>] (rpi_firmware_transaction) from [<c08a7ae0>] (rpi_firmware_property_list+0xc0/0x180)
[63404.409553]  r6:eac0501c r5:00000010 r4:eac05000
[63404.409562] [<c08a7a20>] (rpi_firmware_property_list) from [<c08a7c10>] (rpi_firmware_property+0x70/0x118)
[63404.409569]  r10:e362e30c r9:00030046 r8:ef97e540 r7:efae3ee8 r6:00000004 r5:00000010
[63404.409574]  r4:e362e300
[63404.409583] [<c08a7ba0>] (rpi_firmware_property) from [<bf0aa0c4>] (get_values_poll+0x50/0x160 [raspberrypi_hwmon])
[63404.409590]  r10:00000000 r9:00000040 r8:00000000 r7:eff8a500 r6:eff87300 r5:e33cbc80
[63404.409596]  r4:e37cc2cc r3:00000004
[63404.409605] [<bf0aa074>] (get_values_poll [raspberrypi_hwmon]) from [<c023ebcc>] (process_one_work+0x220/0x534)
[63404.409610]  r4:e37cc2cc
[63404.409618] [<c023e9ac>] (process_one_work) from [<c023ef2c>] (worker_thread+0x4c/0x580)
[63404.409625]  r10:eff87300 r9:c1203d00 r8:eff87318 r7:00000008 r6:eff87300 r5:e33cbc94
[63404.409630]  r4:e33cbc80
[63404.409638] [<c023eee0>] (worker_thread) from [<c0246360>] (kthread+0x144/0x170)
[63404.409645]  r10:e35c5e7c r9:e362ec9c r8:e33cbc80 r7:efae2000 r6:00000000 r5:e362ee40
[63404.409650]  r4:e362ec80
[63404.409657] [<c024621c>] (kthread) from [<c02010ac>] (ret_from_fork+0x14/0x28)
[63404.409663] Exception stack(0xefae3fb0 to 0xefae3ff8)
[63404.409669] 3fa0:                                     00000000 00000000 00000000 00000000
[63404.409676] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[63404.409682] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[63404.409689]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c024621c
[63404.409694]  r4:e362ee40
[63494.661857] CIFS VFS: Close unmatched open
---- booting motionEyeOS dev20201026 ----
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.51-v7l (root@3f131ba76255) (gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))) #1 SMP Mon Oct 26 01:19:59 UTC 2020
[    0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.4

Generated by setting motioneye to 1600x1200 and H.264 OMX to enable hardware acceleration. Will try without OMX and then different resolutions.

May be linked to https://github.com/raspberrypi/firmware/issues/1552

starbasessd commented 3 years ago

Also, if you can SSH in or use the console (keyboard/monitor) run the following commands and report the results: vcgencmd measure_temp vcgencmd get_throttled vcgencmd bootloader_version

Matthew1471 commented 3 years ago

It rebooted after a while but :

[root@MotionEye log]# vcgencmd measure_temp temp=57.0'C [root@MotionEye log]# vcgencmd get_throttled throttled=0x0 [root@MotionEye log]# vcgencmd bootloader_version Apr 29 2021 17:11:25 version c2f8c388c4ee37ad709ace403467d163e8dd91ce (release) timestamp 1619712685 [root@MotionEye log]# vcgencmd version Jul 17 2020 11:00:29 Copyright (c) 2012 Broadcom version 21a15cb094f41c7506ad65d2cb9b29c550693057 (clean) (release) (start_x)

Am using the official USB-C adapter too.. Was all very unstable when I first got it going.. have been playing with various features to make it more stable (connectivity check to workaround https://github.com/ccrisan/motioneyeos/issues/2743), lower resolution (1024x768) and H.264 (non OMX) to identify what is causing instability.. it looks like there's actually multiple problems.

Just tried raising resolution and using OMX again to get issue almost immediately. Will now try higher resolution but non OMX for debugging. Am hoping is linked to https://github.com/raspberrypi/firmware/issues/1552 which was resolved with newer 4b firmware.

starbasessd commented 3 years ago

Give it an hour or two and re-run the first 2 commands, please.

Matthew1471 commented 3 years ago

With or without OMX?

starbasessd commented 3 years ago

Either, both.

Matthew1471 commented 3 years ago

Just crashed and rebooted again..

Will turn off OMX on Cam # 1 and see if it it's OMX specific.

[root@MotionEye ~]# vcgencmd measure_temp
temp=57.0'C
[root@MotionEye ~]# vcgencmd get_throttled
throttled=0x0

Will see if this (non OMX) stays stable and run after 1-2hrs as requested :)

starbasessd commented 3 years ago

Since you are getting random reboots, also post messages, dmesg, and boot logs.

Matthew1471 commented 3 years ago

boot.log dmesg.log messages.log motion.log motioneye.log

The reboots seem graceful I think due to firmware issue:

2021-05-23 15:45:54: [motioneye] ERROR: could not terminate the motion process 2021-05-23 15:45:54: [motioneye] INFO: rebooting

I note MotionEye has restrictions on resolutions (modulo 8), motion complains if not modulo 16 (although have googled and it sounds like that's a hardware acceleration warning and that motioneye is having to pad images from the camera rather than use direct) and Raspberry Pi Camera V2 has sensor cropping at various resolutions too : https://picamera.readthedocs.io/en/release-1.13/fov.html#sensor-modes

Might be worth adding a * next to resolutions that are not good resolutions to select in every environment (which it sounds like at least anything not divisible by 16?)

Matthew1471 commented 3 years ago
[root@MotionEye ~]# uptime
 17:33:55 up  1:09,  load average: 4.30, 4.31, 4.27
[root@MotionEye ~]# vcgencmd measure_temp
temp=55.0'C
[root@MotionEye ~]# vcgencmd get_throttled
throttled=0x0

Performance is obviously not great without hardware encoding.. but stability is perfect! Running Camera # 2 at 1640 x 1232!

OMX disabled on both cameras file encodes.. even the network Camera # 1 at 800 x 600 seemed to not like OMX with the included Raspberry Pi firmware.

starbasessd commented 3 years ago

Have you tried Pass Through on either or both cameras? I can usually get my cameras up to 1280x720 (PiCams and FosCams)... Don't know how you feel about doing a build your own motionEyeOS to get the latest kernels and firmware...

Matthew1471 commented 3 years ago

Linking in https://github.com/ccrisan/motioneyeos/issues/2043 and https://github.com/ccrisan/motioneyeos/issues/2510

Do you use Raspberry Pi 4? I originally built the SD card for my 8GB Pi4 (hence the dev build).. the Pi Zero has been great.

Was wondering if concurrent OMX was issue but then I think we crashed on 800x600 Camera1.

Could try learning how to build (I'm more Windows dev generally) but Raspberry Pi OS Lite might be quicker for me to test.

Also need to check to see if anyone has reported motioneyeos SMB issue with using the same path (get error about unable to create root directory).. workaround others used worked of setting share to include directory but not sure multiple mountpoints to the same share just to change the directory is performant (same issue as https://github.com/ccrisan/motioneyeos/issues/1652 but locked.. proposed solution seems more like a workaround than a fix).

Didn't try passthrough as I like the pretty red boxes highlighting the motion ("Show Frame Changes") and the date/time stamp.

starbasessd commented 3 years ago

I do my own RPiOS builds at least every other week. I use my Pi4-8GB or a VM running Debian 32 bit, with a setup called Pi-Gen (available here on github, the 'official build' uses it). I'm going to try it on a M73 TFF running Windows 10, WSL, and Ubuntu 20.04 and see what kind of results I get (probable fail, due to an issue of building the 32 bit OS on a 64 bit OS...). I've successfully built motionEyeOS before on the Pi4-8GB. I closed and locked #1652 because it was 3 years old, and people were posting 'fixed for me's', not requesting help or suggesting other fixes. I personally point all mine to my NAS (single share point), and include camera name & mp4 or jpg as part of the filename, works for me: camera1/%Y-%m-%d/mp4/%H-%M-%S I use whatever the end user requests help on, Pis 0, 0W, 0WH, 1 ,2b, 3b, 3b+, 4b-4GB, 4-8GB. I don't have any compute modules, though. I have a nice VirtualBox server (Ryzen 7/ 32GB / 10TB) that I can throw almost any OS into. I have a few different cameras (PiCam, but only a PiZero Cable, d-Link DCS-5020-L x3, and FosCam 8800 and RC2) and a nice network setup. My production motionEye hub is another M73/16GB/1TB+NAS, and running Ubuntu Server 20.04. I'd like to support all the other Pi-Clones, but finances won't allow.
camera1/%Y-%m-%d/jpg/%H-%M-%S/%q

Matthew1471 commented 3 years ago
[root@MotionEye log]# uptime
18:44:38 up  5:36,  load average: 1.86, 2.13, 2.33
[root@MotionEye log]# vcgencmd measure_temp
temp=51.0'C
[root@MotionEye log]# vcgencmd get_throttled
throttled=0x0

I'm going to try replacing files in the FAT boot-partition and see if the newer release allows OMX.

It crashed about 5 hours while I was trying to view a video file via the GUI.. I will check the logs but I think that was just the watchdog being a bit too aggressive while the GUI grabbed my 600MB file off the NAS over 5GHz. Looked graceful anyway:

Ah here we go:

May 24 13:07:59 MotionEye user.notice netwatch: cannot connect to Camera1.LAN:80, calling panic action
May 24 13:07:59 MotionEye user.notice panic: rebooting (caused by netwatch)

Certainly more stable without OMX on the latest dev version.

Interesting that you are running RPiOS and have no issue.. sounds like my firmware transplanting might pull this off. Mine are all pointing to a NAS too.. The Pi 4B is doing all the encoding and storing on the NAS.. in my opinion MotionEyeOS should separate mountpoint management from camera configuration.. should be able to define the SMB share once and then apply it to each camera. How do you use a single sharepoint? That's from just regular RPiOS and setting up an fstab entry yourself?

I tried motionEye on a Debian VM (running on a HP Microserver Gen8) but the performance was bad without GPU help... was worse than running it off the Pi Zero W.

Matthew1471 commented 3 years ago

I have made a frankenstein motionEyeOS boot partition (FAT, so easily done in Windows):

Then booted and got new firmware but same MotionEyeOS Kernel (apparently playing with the kernel without the drivers breaks it)

Giving us :

[root@MotionEye ~]# vcgencmd version
Apr 30 2021 13:46:42
Copyright (c) 2012 Broadcom
version d7f29d96450abfc77cd6cf011af1faf1e03e5e56 (clean) (release) (start_x)

Will now turn off my WiFi connectivity check (to stop WiFi dying and not reconnecting until the AP kills the connection) and go back to OMX and let's see what is broken/fixed.

Matthew1471 commented 3 years ago

System much more responsive and performant generally (even things like booting before I even switched back to OMX)..

Am still observing motion locking up on some resolutions as per https://github.com/Motion-Project/motion/issues/433 even respecting the 1080p limit on the OMX encoder (see https://www.raspberrypi.org/forums/viewtopic.php?p=1762192#p1762192).

H264 (...1080p30 encode) Source: https://www.raspberrypi.org/products/raspberry-pi-4-model-b/specifications/

I even tried 1664x1248 as the highest resolution capturing from the full 4:3 sensor AND still using OMX hardware encoding (as per https://www.raspberrypi.org/forums/viewtopic.php?p=1762192#p1762192) but it still crashes motion.

Tried a few resolutions as low as 1024 x 768 OMX.. Seemed okay at 1280 x 960 with limited testing.

Will try Raspberry Pi OS Lite next.

Matthew1471 commented 3 years ago

Have a better test bed:

/etc/init.d/S85motioneye stop
ffmpeg -f video4linux2 -video_size 800x600 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null
ffmpeg -f video4linux2 -video_size 1024x768 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null
ffmpeg -f video4linux2 -video_size 1920x1080 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null

Testing:

[root@MotionEye ~]# ffmpeg -f video4linux2 -video_size 800x600 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GNU Toolchain for the A-profile Architecture 9.2-2019.12(arm-9.10)
  configuration: --enable-cross-compile --cross-prefix=/os/output/raspberrypi4/host/bin/arm-none-linux-gnueabihf- --sysroot=/os/output/raspberrypi4/host/arm-buildroot-linux-gnueabihf/sysroot --host-cc='/os/output/raspberrypi4/host/bin/ccache /usr/bin/gcc' --arch=arm --target-os=linux --disable-stripping --pkg-config=/os/output/raspberrypi4/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid--disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb--disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --disable-avresample --disable-ffprobe--disable-libxcb --disable-postproc --enable-swscale --enable-indevs --enable-alsa --enable-outdevs --enable-pthreads --enable-zlib --disable-bzlib --disable-libfdk-aac --disable-libcdio --enable-gnutls --disable-openssl --disable-libdrm --disable-libopenh264 --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis --disable-vaapi --disable-vdpau --enable-mmal --enable-omx --enable-omx-rpi --extra-cflags=-I/os/output/raspberrypi4/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/IL --disable-libopencv --disable-libopus --disable-libvpx --disable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --enable-libtheora --disable-libwavpack --disable-iconv --disable-libfreetype --disable-fontconfig --disable-libopenjpeg --enable-libx264 --enable-libx265 --disable-libdav1d --disable-x86asm--disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --disable-armv6 --disable-armv6t2 --enable-vfp --enable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=cortex-a72
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 145.586176, bitrate: 144000 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 800x600, 144000 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx))
Press [q] to stop, [?] for help
[h264_omx @ 0x18ec2d0] Using OMX.broadcom.video_encode
Output #0, h264, to '/dev/null':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: h264 (h264_omx), yuv420p, 800x600, q=2-31, 200 kb/s, 25fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.91.100 h264_omx
frame=   13 fps=0.0 q=-0.0 size=      12kB time=00:00:00.44 bitrate= 220.4kbits/frame=   26 fps= 26 q=-0.0 size=      25kB time=00:00:00.96 bitrate= 211.8kbits/frame=   39 fps= 26 q=-0.0 size=      39kB time=00:00:01.48 bitrate= 214.9kbits/frame=   51 fps= 25 q=-0.0 size=      51kB time=00:00:01.96 bitrate= 213.3kbits/frame=   64 fps= 25 q=-0.0 size=      64kB time=00:00:02.48 bitrate= 212.5kbits/frame=   76 fps= 25 q=-0.0 size=      76kB time=00:00:02.96 bitrate= 210.6kbits/frame=   89 fps= 25 q=-0.0 size=      88kB time=00:00:03.48 bitrate= 208.1kbits/frame=  102 fps= 25 q=-0.0 size=     100kB time=00:00:04.00 bitrate= 205.3kbits/frame=  475 fps= 25 q=-0.0 Lsize=     465kB time=00:00:19.00 bitrate= 200.6kbits/s speed=   1x
video:465kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Exiting normally, received signal 2.

Which when it works:

[root@MotionEye dev]# ffmpeg -f video4linux2 -video_size 1280x720 -framerate 25  -i /dev/video0 -codec:v h264_omx -f h264 /dev/null -y
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GNU Toolchain for the A-profile Architecture 9.2-2019.12(arm-9.10)
  configuration: --enable-cross-compile --cross-prefix=/os/output/raspberrypi4/host/bin/arm-none-linux-gnueabihf- --sysroot=/os/output/raspberrypi4/host/arm-buildroot-linux-gnueabihf/sysroot --host-cc='/os/output/raspberrypi4/host/bin/ccache /usr/bin/gcc' --arch=arm --target-os=linux --disable-stripping --pkg-config=/os/output/raspberrypi4/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid--disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb--disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --disable-avresample --disable-ffprobe--disable-libxcb --disable-postproc --enable-swscale --enable-indevs --enable-alsa --enable-outdevs --enable-pthreads --enable-zlib --disable-bzlib --disable-libfdk-aac --disable-libcdio --enable-gnutls --disable-openssl --disable-libdrm --disable-libopenh264 --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis --disable-vaapi --disable-vdpau --enable-mmal --enable-omx --enable-omx-rpi --extra-cflags=-I/os/output/raspberrypi4/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/IL --disable-libopencv --disable-libopus --disable-libvpx --disable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --enable-libtheora --disable-libwavpack --disable-iconv --disable-libfreetype --disable-fontconfig --disable-libopenjpeg --enable-libx264 --enable-libx265 --disable-libdav1d --disable-x86asm--disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --disable-armv6 --disable-armv6t2 --enable-vfp --enable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=cortex-a72
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 31415.347277, bitrate: 276480 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 276480kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx))
Press [q] to stop, [?] for help
[h264_omx @ 0x203e2d0] Using OMX.broadcom.video_encode
Output #0, h264, to '/dev/null':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: h264 (h264_omx), yuv420p, 1280x720, q=2-31, 200 kb/s, 25fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.91.100 h264_omx
frame=   19 fps=0.0 q=-0.0 size=      27kB time=00:00:00.68 bitrate= 321.7kbits/frame=   32 fps= 32 q=-0.0 size=      45kB time=00:00:01.20 bitrate= 307.9kbits/frame=   44 fps= 29 q=-0.0 size=      56kB time=00:00:01.68 bitrate= 273.2kbits/frame=   57 fps= 28 q=-0.0 size=      62kB time=00:00:02.20 bitrate= 229.5kbits/frame=   69 fps= 27 q=-0.0 size=      69kB time=00:00:02.68 bitrate= 209.9kbits/frame=   82 fps= 27 q=-0.0 size=      78kB time=00:00:03.20 bitrate= 200.0kbits/frame=   85 fps= 27 q=-0.0 Lsize=      87kB time=00:00:03.40 bitrate= 210.3kbits/s dup=5 drop=0 speed=1.08x
video:87kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Exiting normally, received signal 2.

And when it doesn't:

[root@MotionEye dev]# ffmpeg -f video4linux2 -video_size 1920x1080 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.2.1 (GNU Toolchain for the A-profile Architecture 9.2-2019.12(arm-9.10)
  configuration: --enable-cross-compile --cross-prefix=/os/output/raspberrypi4/host/bin/arm-none-linux-gnueabihf- --sysroot=/os/output/raspberrypi4/host/arm-buildroot-linux-gnueabihf/sysroot --host-cc='/os/output/raspberrypi4/host/bin/ccache /usr/bin/gcc' --arch=arm --target-os=linux --disable-stripping --pkg-config=/os/output/raspberrypi4/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid--disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb--disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --disable-avresample --disable-ffprobe--disable-libxcb --disable-postproc --enable-swscale --enable-indevs --enable-alsa --enable-outdevs --enable-pthreads --enable-zlib --disable-bzlib --disable-libfdk-aac --disable-libcdio --enable-gnutls --disable-openssl --disable-libdrm --disable-libopenh264 --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis --disable-vaapi --disable-vdpau --enable-mmal --enable-omx --enable-omx-rpi --extra-cflags=-I/os/output/raspberrypi4/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/IL --disable-libopencv --disable-libopus --disable-libvpx --disable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --enable-libtheora --disable-libwavpack --disable-iconv --disable-libfreetype --disable-fontconfig --disable-libopenjpeg --enable-libx264 --enable-libx265 --disable-libdav1d --disable-x86asm--disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --disable-armv6 --disable-armv6t2 --enable-vfp --enable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=cortex-a72
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
[video4linux2,v4l2 @ 0x186a340] ioctl(VIDIOC_STREAMON): Operation not permitted
/dev/video0: Operation not permitted

and even crashes the camera:

[root@MotionEye ~]# raspivid -l
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

This should be easier to test on RasperryPi OS Lite now! Also we can rule out motion.

As an aside this is a useful page to get camera resolutions: https://trac.ffmpeg.org/wiki/Capture/Webcam

ffmpeg on Raspberry Pi OS is version (7:4.1.6-1~deb10u1+rpt1)

Issue exists on standard RaspberryPi OS and is either ffmpeg, firmware or drivers.. will try to narrow down further but a new motionEyeOS release alone will not fix. Starting to think motion were right to blacklist h264_omx.

https://www.raspberrypi.org/forums/viewtopic.php?t=293812

Will try to build ffmpeg from source.. https://www.redhenlab.org/home/the-cognitive-core-research-topics-in-red-hen/the-barnyard/hardware-encoding-with-the-raspberry-pi

Matthew1471 commented 3 years ago

Looks like rebooting inbetween testing and 1024x768 runs fine.. suspect it is triggered at certain resolutions/bitrates

Now trying to see if I can get ffmpeg to use random data as input rather than a camera (rule out camera firmware/interoperability):

ffmpeg -f lavfi -i nullsrc=s=256x256 -vf "geq=random(1)*255:128:128" -video_size 1024x768 -framerate 25 -codec:v h264_omx -y -f h264 /dev/null

This also works:

MotionEye : raspivid -t 0 -w 1920 -h 1080 -fps 25 -l -o tcp://0.0.0.0:3333 VLC : tcp/h264://MotionEye:3333

Am starting to think it's ffmpeg specifying invalid bitrates or profiles as the source code for raspivid seems to be more defensive on its params to mmal (as per https://www.raspberrypi.org/forums/viewtopic.php?t=293812).. Will try a fresh compile

Matthew1471 commented 3 years ago

Reproduced on Raspberry Pi 3b with fresh Raspberry Pi OS Lite install (and update and dist-upgrade).

ffmpeg -f video4linux2 -video_size 1024x768 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null 1024x768 : Fine

ffmpeg -f video4linux2 -video_size 1920x1080 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null 1920x1080 : Error and stacktrace in syslog

May 25 14:27:08 test kernel: [  319.894325] bcm2835-v4l2-0: Failed to enable capture port - error -1. Disabling camera port again
May 25 14:27:08 test kernel: [  319.902553] ------------[ cut here ]------------
May 25 14:27:08 test kernel: [  319.902587] WARNING: CPU: 1 PID: 2596 at drivers/media/common/videobuf2/videobuf2-core.c:1548 vb2_start_streaming+0x108/0x178 [videobuf2_common]
May 25 14:27:08 test kernel: [  319.902593] Modules linked in: cmac bnep hci_uart btbcm bluetooth ecdh_generic ecc 8021q garp stp llc brcmfmac brcmutil raspberrypi_hwmon sha256_generic bcm2835_codec(C) bcm2835_isp(C) bcm2835_v4l2(C) v4l$
May 25 14:27:08 test kernel: [  319.902799] CPU: 1 PID: 2596 Comm: ffmpeg Tainted: G         C        5.10.17-v7+ #1414
May 25 14:27:08 test kernel: [  319.902802] Hardware name: BCM2835
May 25 14:27:08 test kernel: [  319.902806] Backtrace:
May 25 14:27:08 test kernel: [  319.902822] [<809e477c>] (dump_backtrace) from [<809e4b0c>] (show_stack+0x20/0x24)
Matthew1471 commented 3 years ago

Have compiled ffmpeg from source. Same issue. Concluding that the problem is ffmpeg and/or the driver (drivers/media/common/videobuf2/videobuf2-core.c) not sanity checking ffmpeg input. Not a Motion/MotionEye/MotionEyeOS/RPI3/RPI4 specific issue.

root@test:~/ffmpeg# ./ffmpeg -f video4linux2 -video_size 1920x1080 -framerate 25 -i /dev/video0 -codec:v h264_omx -y -f h264 /dev/null
ffmpeg version git-2021-05-24-4c705a2 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --enable-gpl --enable-libx264 --enable-nonfree --enable-mmal --enable-omx --enable-omx-rpi --enable-libfdk-aac --prefix=/usr --extra-ldflags=-latomic
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.101 / 59.  2.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[video4linux2,v4l2 @ 0x327c3f0] ioctl(VIDIOC_STREAMON): Operation not permitted
/dev/video0: Operation not permitted

And you do need to reboot on OMX failure : https://www.raspberrypi.org/forums/viewtopic.php?t=188317

Matthew1471 commented 3 years ago

Final thing to play with is h264_omx options:

root@test:~/ffmpeg# ./ffmpeg -h encoder=h264_omx
ffmpeg version git-2021-05-24-4c705a2 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --enable-gpl --enable-libx264 --enable-nonfree --enable-mmal --enable-omx --enable-omx-rpi --enable-libfdk-aac --prefix=/usr --extra-ldflags=-latomic
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.101 / 59.  2.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Encoder h264_omx [OpenMAX IL H.264 video encoder]:
    General capabilities: delay
    Threading capabilities: none
    Supported pixel formats: yuv420p
h264_omx AVOptions:
  -omx_libname       <string>     ED.V....... OpenMAX library name
  -omx_libprefix     <string>     ED.V....... OpenMAX library prefix
  -zerocopy          <int>        E..V....... Try to avoid copying input frames if possible (from 0 to 1) (default 1)
  -profile           <int>        E..V....... Set the encoding profile (from -99 to 100) (default -99)
     baseline        66           E..V.......
     main            77           E..V.......
     high            100          E..V.......

Tried turning off zerocopy and I tried different profiles (baseline and high).. no impact.

Looks like there's plenty of people online experiencing issues with this encoder : https://github.com/raspberrypi/firmware/issues/1087

starbasessd commented 3 years ago

Just out of curiosity, how much GPU RAM do you have allocated?

Matthew1471 commented 3 years ago

Originally 128MB but also tried 256MB

starbasessd commented 3 years ago

OK, just saw something that said default GPU_MEM settings were way too small for OMX processing.

On Tue, May 25, 2021 at 12:07 PM Matthew @.***> wrote:

Originally 128MB but also tried 256MB

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ccrisan/motioneyeos/issues/2744#issuecomment-848000593, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZTUHJCCENXFVMGBIBLTGTTPPDKRANCNFSM45LZGMAA .

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

Matthew1471 commented 3 years ago

Have set to 512MB now.. might be onto something!

Also I read that h264_omx is old, crummy and relies on gpumem but h264_v4l2m2m is the future.

h264_v4l2m2m also seems broken.

starbasessd commented 3 years ago

https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md

On Tue, May 25, 2021 at 1:23 PM Matthew @.***> wrote:

Have set to 512MB now.. might be onto something!

Also I read that h264_omx is old, crummy and relies on gpumem but h264_v4l2m2m is the future.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ccrisan/motioneyeos/issues/2744#issuecomment-848067804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZTUHIN2EP3IJZICYEABVDTPPMILANCNFSM45LZGMAA .

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

Matthew1471 commented 3 years ago

With 512MB of GPU RAM the ffmpeg behaves a bit more but motion still gets killed:

==> /var/log/motion.log <==
[0:motion] [ERR] [ALL] motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it!
Matthew1471 commented 3 years ago

Final test I suppose is to build a Pi 4 that only accepts network camera feeds and performs OMX encode.. to rule out the camera's partial frames etc being the problem (effectively preventing zero copy too)

wickerman123 commented 2 years ago

Glad I'm not the only one getting issues witth OMX! I'm only just geting started with Pi so can't really delve into details or trying to help resolve issues.

I was hoping OMX would work as I read that puts encoding on the GPU, currently my main issues are massive framerate drops once we're passed the pre-capture buffer - when motion actually kicks in - which is really annoying. Are there any setup options that allow for a good resolution and good framerate?

Currently running Raspi 4b with NoIR V2.