-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
h264_omx has been blacklisted using codec libx264 #930
Comments
And what could we do to fix this? |
I blacklisted h264_omx by default because ffmpeg has zero copy enabled on h264_omx by default, and it WILL cause the GPU to lock up. Disable zero copy on your ffmpeg, recompile and reinstall, then comment out h264_omx from the blacklist in motion source code to re-enable it. All patches to do this are available in motionEyeOS. |
@jasaw thanks for providing the patches! I would like to try this out, as CPU usage is just too high on my XU4. Could you kindly point to where in the MotionEyeOS repo the requisite patches are located? |
ffmpeg disable zero copy patch: ffmpeg fix handling of fragmented buffers patch: motion undo h264_omx blacklist patch: |
Are these patches still necessary with the latest version of ffmpeg? |
@gururise Did the patch help you? I also have a XU4 and CPU problems saving the videos. |
@roger- I believe the patches are still necessary. @maffi91 @gururise For XU4 hardware video encoding, you need to use |
Are there instructions for applying the patches somewhere I can reference? Thanks! |
# Compile and install FFmpeg from source
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
zlib1g-dev \
libx264-dev
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev
wget https://ffmpeg.org/releases/ffmpeg-4.2.tar.bz2
tar xf ffmpeg-4.2.tar.bz2
wget https://raw.githubusercontent.com/ccrisan/motioneyeos/master/package/ffmpeg/disable-rpi-omx-input-zerocopy.patch
wget https://trac.ffmpeg.org/raw-attachment/ticket/7687/0001-avcodec-omx-Fix-handling-of-fragmented-buffers.patch
patch -p1 -d ffmpeg-4.2 < 0001-avcodec-omx-Fix-handling-of-fragmented-buffers.patch
patch -p1 -d ffmpeg-4.2 < disable-rpi-omx-input-zerocopy.patch
cd ffmpeg-4.2
./configure --enable-mmal --enable-omx --enable-omx-rpi --extra-cflags=-I/opt/vc/include/IL
make
make install
cd -
# Compile and install motion from source
sudo apt-get install autoconf automake pkgconf libtool libjpeg8-dev build-essential libzip-dev gettext libmicrohttpd-dev
git clone https://github.com/Motion-Project/motion.git
cd motion
git checkout ff903de2e3d6320f13841a91e4080c1220c38059
wget https://raw.githubusercontent.com/jasaw/motioneyeos/motion-disable-omx-zerocopy/package/motion/2000-disable-zerocopy-via-avoptions.patch
patch -p1 -d . < 2000-disable-zerocopy-via-avoptions.patch
wget https://raw.githubusercontent.com/jasaw/motioneyeos/motion-disable-omx-zerocopy/package/motion/enable-h264-omx-codec.patch
patch -p1 -d . < enable-h264-omx-codec.patch
autoreconf -fiv
./configure
make
make install |
The above is great, thanks @jasaw , I just wonder how long it takes to pull that through on a RPi... |
RPi 3 and above are pretty fast, shouldn't take too long. I compile things on my RPi all the time. Replace Cross compiling ffmpeg is painful because it has A LOT of dependencies. You'll need to set up the whole cross compilation environment properly, and cross compile all the dependencies too. This is why we have MotionEyeOS project that deals with all the cross compilation. If you still want to cross compile, check out MotionEyeOS. |
`pi@raspberrypi:~$ patch -p1 -d FFmpeg < disable-rpi-omx-input-zerocopy.patch pi@raspberrypi:~$ patch -p1 -d FFmpeg < 0001-avcodec-omx-Fix-handling-of-fragmented-buffers.patch Do you have a full explanation please ? |
@Saku241 Did you download the patches (links given by @jasaw in a couple of comments up)? You need to have those present to be able to apply them :) |
@zagrim Where I suppose to place them ? |
@Saku241 If you want to use the given instructions 1:1 (copy-paste), then you need to place the patch files in the parent directory of the cloned repos, which would seem to mean the home dir of the "pi" user.
|
@zagrim Thank you for everything, Edit : I think it broke my MotionEye because now when it detects motion it start recording but dont stop |
@Saku241 Sorry, my bad, I left out After you ran configure, compiled and installed ffmpeg, check whether h264_omx is supported by running this command:
|
pi@raspberrypi:~/FFmpeg $ ./configure --enable-mmal --enable-omx --enable-omx-rpi If you think configure made a mistake, make sure you are using the latest Edit : fixed with |
Just a heads up: after 2 years, zerocopy problem has finally been fixed in ffmpeg. Now it doesn't force enable zerocopy on RPi builds anymore, instead allows applications to disable zerocopy. See FFmpeg/FFmpeg@23a3e14 What this means is, ffmpeg master is in a mess right now, and in a broken state that has the green line across the screen. I've updated my instructions above, which works for me. |
Alright, everything seems working now, no more green line but I got a problem when a file is recorded, it creates the video and a 262bytes file here : that contain this : |
@Saku241 Very odd. Make sure you don't have 2 instances of motion or motioneye running? I don't see this problem on my Pi. |
@jasaw working fine now |
@jasaw thanks for your instructions, I got my motionEYE framerate up to pretty decent levels (20-30fps or so). I am running motioneye on latest Rasbian (raspberry pi 4 4gb). Had only 2-3fps before. Same with my raspberry pi3B. Only difference I did (regarding your instructions), I installed ffmpeg 4.2.1 instead of 4.2. But now there's another problem --> those green lines appear in nearly every video. Is there any solution to this? |
As far as I know, the latest working ffmpeg version is 4.2. Anything newer has the green line over the video. My suggestion is to stick to version 4.2. |
@jasaw: Ok thank you for the explanation.
Thank you for the help, I'll compile the FFMPEG 4.2. |
I have had this same issue with Blacklisted OMX on a pi3b+ under raspbian buster. I have used script kindly posted half way through the issue, however now my recordings all have the yellow\green stripe. Despite running ffmpeg v4.2 Any help anyone?? |
I am also struggling with 0.1 FPS when streaming, so tried this. Got an error - ERROR: mmal not found |
Did you try RaspberryPiOS Lite? (2020-08-20) |
Not Yet. I am waiting for a microSD replacement, so will give it a go once I get it. Thanks! |
Many thanks, Raspbian Lite worked like a charm! |
@sorcer1122 Glad to help. |
ok FPS improved a little bit but the CPU use is terrible. 'top' command shows that motion uses 381% of the CPU :( |
Depending on your settings, you can get up there with CPU usage, even on
dedicated x86/Intel/Amd processors. Then consider the amount of HorsePower
in a SBC with an ARM processor...
MotionEyeOS has almost everything stripped out except what's needed by
motion to produce viable output. If you want a multi-function SBC,
something has to give.
…On Sun, Nov 29, 2020 at 4:44 PM sorcer1122 ***@***.***> wrote:
ok FPS improved a little bit but the CPU use is terrible. 'top' command
shows that motion uses 381% of the CPU :(
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#930 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEZTUHKBCBVPQ3ZSOTRNA7DSSK6DPANCNFSM4FIDFM2Q>
.
--
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?
|
I don't run any camera higher than 1280x720, and 5 cameras on an Intel
i5/4GB running Ubuntu Server and motion/motionEye averages 20fps per
camera. Pi's (even the Pi4/4GB or 8GB don't get quite that high. I don't
overclock, I don't need the thermal issues.
On Sun, Nov 29, 2020 at 4:49 PM Kevin Shumaker <kevin.shumaker@gmail.com>
wrote:
… Depending on your settings, you can get up there with CPU usage, even on
dedicated x86/Intel/Amd processors. Then consider the amount of HorsePower
in a SBC with an ARM processor...
MotionEyeOS has almost everything stripped out except what's needed by
motion to produce viable output. If you want a multi-function SBC,
something has to give.
On Sun, Nov 29, 2020 at 4:44 PM sorcer1122 ***@***.***>
wrote:
> ok FPS improved a little bit but the CPU use is terrible. 'top' command
> shows that motion uses 381% of the CPU :(
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#930 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEZTUHKBCBVPQ3ZSOTRNA7DSSK6DPANCNFSM4FIDFM2Q>
> .
>
--
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?
--
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?
|
All I need is to save streams from 4 cameras in good quality to an external hard drive. Maybe switching streaming off will improve the performance. Will play with it. |
If supported by the camera, try using Movie Pass Through, too...
…On Sun, Nov 29, 2020 at 4:54 PM sorcer1122 ***@***.***> wrote:
All I need is to save streams from 4 cameras in good quality to an
external hard drive. Maybe switching streaming off will improve the
performance. Will play with it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#930 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEZTUHPZJVAN3QSI446OSQ3SSK7JBANCNFSM4FIDFM2Q>
.
--
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?
|
I have swapped to RPi-Zero-W FNC and use @jasaw's RTSP support for the
raspberry pi zero w in the latest DEV snapshot. That way on my server I can
enable passthrough support and my hub just stores the already encoded h264
stream, which is encoded in the gpu on my FNC RPi-zero-W, and does the
motion detection. This lowered my server CPU usage quite a bit but I don't
have numbers (off the top of my head I was around 200% to 115% from the top
command).
motioneye-project/motioneyeos#2325 (comment)
My new server will be an Odroid HC2 which is an octa core sbc with an sata
interface; I have not got mine yet so I have no personal experience yet but
I saw in a post here the project owner was getting 10 FNC on an Odroid XU4
board (same as the HC2 but with different peripherals). We will see once
it arrives and if anyone is interested I'll post back my experience.
…On Sun, Nov 29, 2020, 15:56 starbasessd ***@***.***> wrote:
If supported by the camera, try using Movie Pass Through, too...
On Sun, Nov 29, 2020 at 4:54 PM sorcer1122 ***@***.***>
wrote:
> All I need is to save streams from 4 cameras in good quality to an
> external hard drive. Maybe switching streaming off will improve the
> performance. Will play with it.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#930 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AEZTUHPZJVAN3QSI446OSQ3SSK7JBANCNFSM4FIDFM2Q
>
> .
>
--
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?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#930 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIBKIUDI6K3OZWX5DQKTH6LSSK7RDANCNFSM4FIDFM2Q>
.
|
Please do!
…On Sun, Nov 29, 2020 at 5:24 PM cap9qd ***@***.***> wrote:
I have swapped to RPi-Zero-W FNC and use @jasaw's RTSP support for the
raspberry pi zero w in the latest DEV snapshot. That way on my server I can
enable passthrough support and my hub just stores the already encoded h264
stream, which is encoded in the gpu on my FNC RPi-zero-W, and does the
motion detection. This lowered my server CPU usage quite a bit but I don't
have numbers (off the top of my head I was around 200% to 115% from the top
command).
motioneye-project/motioneyeos#2325 (comment)
My new server will be an Odroid HC2 which is an octa core sbc with an sata
interface; I have not got mine yet so I have no personal experience yet but
I saw in a post here the project owner was getting 10 FNC on an Odroid XU4
board (same as the HC2 but with different peripherals). We will see once
it arrives and if anyone is interested I'll post back my experience.
|
Does this issue mean that if I have the latest motioneye installed and am selecting h264_omx encoding from the drop-down in the interface, it is in fact not using GPU encoding? If so, that seems somewhat misleading. Will this topic be updated when it's been fixed in a release? |
@Norgus you are correct, h264_omx is being substituted with h264 in the background. MotionEye does check in OMX is being supported but it is done by querying for the codec's availability in Because getting h264_omx to be available AND usable requires both a changed version of |
@jasaw Please tell me what could be the problem
|
I’m not sure what the exact problem is here but, if it helps, I have an example of compiling Motion for Raspberry Pi (Zero v1.1 in this case) using h264_omx hardware acceleration: https://github.com/chetbox/SafariCam/blob/main/motion/Dockerfile CPU usage when encoding video is very low. 👍 |
Best is always to follow the official documentation: https://motion-project.github.io/motion_build.html Also I suggest compiling v4.3.2, the latest one fully supported by motionEye. |
I might have discovered an issue for Motioneye that results into libx264 been used instead of h264_omx
Also using the h264/omx under Movies with Motion 4.1.1.1 installed and with motioneye v0.39.2, Ubuntu 18.04 Bionic Beaver x64
ffmpeg libavcodec version 57.107.100 libavformat version 57.83.100
[1:ml1] [WRN] [ENC] ffmpeg_set_codec: Preferred codec h264_omx has been blacklisted
[1:ml1] [NTC] [ENC] ffmpeg_set_codec: Using codec libx264
squidpop@xpsdc:lap~$ ffmpeg -v
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
The text was updated successfully, but these errors were encountered: