Open Matthew1471 opened 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
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.
Give it an hour or two and re-run the first 2 commands, please.
With or without OMX?
Either, both.
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 :)
Since you are getting random reboots, also post messages, dmesg, and boot logs.
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?)
[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.
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...
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.
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
[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.
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.
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.
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
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
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)
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
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
Just out of curiosity, how much GPU RAM do you have allocated?
Originally 128MB but also tried 256MB
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?
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.
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?
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!
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)
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.
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:
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