RaspberryPi 4 - Install of Moonfire-nvr

436 views
Skip to first unread message

John L. Poole

unread,
Jun 5, 2020, 1:44:43 PM6/5/20
to moonfire-nvr-users

I ordered a Raspberry PI4 with 8GB from Canakit Friday morning, May 29, 2020, at 3:31 a.m.:

Raspberry Pi 4 8GB Complete Starter Kit - 32GB Storage
SKU: PI4-8GB-STR32F-C4-WHT-K
1 $139.95   $139.95  

Despite expedited shipping for $29.95, it arrived yesterday, Thursday, June 4, 2020.  Canakit is processing a refund for the incremental cost of expedited Shipping.

I followed the instructions of the included CanaKit Raspberry Pi 4 Quick-Start Guide; I installed the default Debian flavored operating system.

At 8:00 p.m. after getting the system booted up (took about 1 hour from unpacking the unit to having a running system) I proceeded with an install of Moonfire-nvr.  Here are my notes:

Raspberry Pi install of moonfire-nvr
8:08 PM 6/4/2020

cd /usr/local/src
sudo chmod 777 .

per: https://github.com/scottlamb/moonfire-nvr/blob/master/guide/install-manual.md

    sudo apt-get install \
               build-essential \
               libavcodec-dev \
               libavformat-dev \
               libavutil-dev \
               libncurses5-dev \
               libncursesw5-dev \
               libsqlite3-dev \
               libssl-dev \
               pkgconf \
               sqlite3 \
               tzdata
              
installed in about 1-2 minutes.

Had to install rust, so clicked the link to: https://rustup.rs/
at https://github.com/rust-lang/rustup#other-installation-methods
did:
    curl https://sh.rustup.rs -sSf | sh
   
select #1 [default]
installed in about 1-2 minutes

Had to install yarn.  Following instructions at https://classic.yarnpkg.com/en/docs/install#debian-stable

Executed:

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
   
Updated since we're on Debian

    sudo apt update && sudo apt install yarn
   
Tested yarn:

     yarn --version

got:

    pi@raspberrypi:/usr/local/src $ yarn --version
    1.22.4
    pi@raspberrypi:/usr/local/src $
   
cd moonfire-nvr

8:19 PM 6/4/2020
    yarn
8:21 PM 6/4/2020

    pi@raspberrypi:/usr/local/src/moonfire-nvr $ yarn
    yarn install v1.22.4
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info fsev...@1.2.13: The platform "linux" is incompatible with this module.
    info "fsev...@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
    [4/4] Building fresh packages...
    Done in 128.25s.
    pi@raspberrypi:/usr/local/src/moonfire-nvr $

date;time yarn build
Thu 04 Jun 2020 08:23:02 PM PDT

    pi@raspberrypi:/usr/local/src/moonfire-nvr $ date;time yarn build
    Thu 04 Jun 2020 08:23:02 PM PDT
    yarn run v1.22.4
    $ webpack --mode production --config webpack/prod.config.js
    Hash: e0c183fc53174d548bb4
    Version: webpack 4.43.0
    Time: 104306ms
    Built at: 06/04/2020 8:24:55 PM
                                                                                Asset       Size  Chunks                         Chunk Names
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-144x144.png   7.95 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-192x192.png   10.9 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-256x256.png     15 KiB          [emitted]
                   favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-36x36.png   1.77 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-384x384.png   23.6 KiB          [emitted]
                   favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-48x48.png   2.44 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-512x512.png   15.8 KiB          [emitted]
                   favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-72x72.png   3.78 KiB          [emitted]
                   favicons-f3d297df4dceee9fe59ce04fb6f46fb5/android-chrome-96x96.png   5.17 KiB          [emitted]
             favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-1024x1024.png     36 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-114x114.png   6.13 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-120x120.png   6.38 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-144x144.png   7.78 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-152x152.png   8.34 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-167x167.png   9.15 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-180x180.png   9.96 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-57x57.png   2.89 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-60x60.png   3.04 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-72x72.png   3.71 KiB          [emitted]
                 favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-76x76.png   3.94 KiB          [emitted]
           favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon-precomposed.png   9.96 KiB          [emitted]
                       favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-icon.png   9.96 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1125x2436.png   82.1 KiB          [emitted]
     favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1136x640.png   41.5 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1242x2208.png   88.2 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1242x2688.png   91.1 KiB          [emitted]
     favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1334x750.png   49.7 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1536x2048.png    109 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1620x2160.png    116 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1668x2224.png    120 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1668x2388.png    121 KiB          [emitted]
     favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-1792x828.png   57.7 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2048x1536.png    109 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2048x2732.png    152 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2160x1620.png    116 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2208x1242.png   88.8 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2224x1668.png    120 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2388x1668.png    121 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2436x1125.png   82.5 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2688x1242.png   91.9 KiB          [emitted]
    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-2732x2048.png    152 KiB          [emitted]
     favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-640x1136.png   42.1 KiB          [emitted]
     favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-750x1334.png   50.1 KiB          [emitted]
     favicons-f3d297df4dceee9fe59ce04fb6f46fb5/apple-touch-startup-image-828x1792.png   58.6 KiB          [emitted]
                          favicons-f3d297df4dceee9fe59ce04fb6f46fb5/browserconfig.xml  585 bytes          [emitted]
                          favicons-f3d297df4dceee9fe59ce04fb6f46fb5/coast-228x228.png   12.8 KiB          [emitted]
                          favicons-f3d297df4dceee9fe59ce04fb6f46fb5/favicon-16x16.png  681 bytes          [emitted]
                          favicons-f3d297df4dceee9fe59ce04fb6f46fb5/favicon-32x32.png   1.57 KiB          [emitted]
                          favicons-f3d297df4dceee9fe59ce04fb6f46fb5/favicon-48x48.png   2.44 KiB          [emitted]
                                favicons-f3d297df4dceee9fe59ce04fb6f46fb5/favicon.ico   32.5 KiB          [emitted]
                    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/firefox_app_128x128.png      7 KiB          [emitted]
                    favicons-f3d297df4dceee9fe59ce04fb6f46fb5/firefox_app_512x512.png   17.8 KiB          [emitted]
                      favicons-f3d297df4dceee9fe59ce04fb6f46fb5/firefox_app_60x60.png   3.05 KiB          [emitted]
                              favicons-f3d297df4dceee9fe59ce04fb6f46fb5/manifest.json   1.62 KiB          [emitted]
                            favicons-f3d297df4dceee9fe59ce04fb6f46fb5/manifest.webapp  450 bytes          [emitted]
                         favicons-f3d297df4dceee9fe59ce04fb6f46fb5/mstile-144x144.png   7.95 KiB          [emitted]
                         favicons-f3d297df4dceee9fe59ce04fb6f46fb5/mstile-150x150.png    8.3 KiB          [emitted]
                         favicons-f3d297df4dceee9fe59ce04fb6f46fb5/mstile-310x150.png   8.68 KiB          [emitted]
                         favicons-f3d297df4dceee9fe59ce04fb6f46fb5/mstile-310x310.png   18.5 KiB          [emitted]
                           favicons-f3d297df4dceee9fe59ce04fb6f46fb5/mstile-70x70.png   3.65 KiB          [emitted]
                   favicons-f3d297df4dceee9fe59ce04fb6f46fb5/yandex-browser-50x50.png    2.6 KiB          [emitted]
               favicons-f3d297df4dceee9fe59ce04fb6f46fb5/yandex-browser-manifest.json  190 bytes          [emitted]
                                                                           index.html   12.1 KiB          [emitted]
                                                                        index.html.gz   2.29 KiB          [emitted]
                                                    jquery-ui.618a444724cc90e7aff5.js    160 KiB       1  [emitted] [immutable]  jquery-ui
                                                 jquery-ui.618a444724cc90e7aff5.js.gz   39.8 KiB          [emitted]
                                                jquery-ui.618a444724cc90e7aff5.js.map    487 KiB       1  [emitted] [dev]        jquery-ui
                                                       jquery.8ebf197e0ac8876d932f.js     88 KiB       0  [emitted] [immutable]  jquery
                                                    jquery.8ebf197e0ac8876d932f.js.gz   30.5 KiB          [emitted]
                                                   jquery.8ebf197e0ac8876d932f.js.map    452 KiB       0  [emitted] [dev]        jquery
                                                          nvr.7f072ad91f4b432d95fe.js   24.8 KiB       2  [emitted] [immutable]  nvr
                                                       nvr.7f072ad91f4b432d95fe.js.gz   8.17 KiB          [emitted]
                                                      nvr.7f072ad91f4b432d95fe.js.map    150 KiB       2  [emitted] [dev]        nvr
                         ui-icons_444444_256x240.2bf13b17d09412f118b0d2191a04af9d.png   3.67 KiB          [emitted]
                         ui-icons_555555_256x240.d184ebcfe5b609497d9df1e36d321619.png   3.67 KiB          [emitted]
                         ui-icons_777620_256x240.8003dc8ce47dd77bd0187ce80345024b.png   3.67 KiB          [emitted]
                         ui-icons_777777_256x240.961d67294deccae7cc75078cc91ea876.png   3.67 KiB          [emitted]
                         ui-icons_cc0000_256x240.0085819bbded1954c054280cb41790d0.png   3.67 KiB          [emitted]
                         ui-icons_ffffff_256x240.74e9fe3d9ced3f6712fe8e987b109292.png   3.67 KiB          [emitted]
                                                       vendor.0b47891808085786bbda.js    104 KiB       3  [emitted] [immutable]  vendor
                                                    vendor.0b47891808085786bbda.js.gz   30.8 KiB          [emitted]
                                                   vendor.0b47891808085786bbda.js.map    213 KiB       3  [emitted] [dev]        vendor
    Entrypoint nvr [big] = jquery-ui.618a444724cc90e7aff5.js jquery-ui.618a444724cc90e7aff5.js.map jquery.8ebf197e0ac8876d932f.js jquery.8ebf197e0ac8876d932f.js.map vendor.0b47891808085786bbda.js vendor.0b47891808085786bbda.js.map nvr.7f072ad91f4b432d95fe.js nvr.7f072ad91f4b432d95fe.js.map
    [29] ./ui-src/index.css 519 bytes {2} [built]
    [30] ./node_modules/css-loader/dist/cjs.js!./ui-src/index.css 1.67 KiB {2} [built]
    [35] (webpack)/buildin/module.js 497 bytes {3} [built]
    [56] ./ui-src/index.js + 20 modules 109 KiB {2} [built]
         | ./ui-src/index.js 1.69 KiB [built]
         | ./ui-src/NVRApplication.js 11.6 KiB [built]
         | ./ui-src/lib/models/Camera.js 2.26 KiB [built]
         | ./ui-src/lib/support/TimeFormatter.js 4.17 KiB [built]
         | ./ui-src/lib/support/TimeStamp90kFormatter.js 3.12 KiB [built]
         | ./ui-src/lib/views/CalendarView.js 12.8 KiB [built]
         | ./ui-src/lib/views/VideoDialogView.js 4.21 KiB [built]
         | ./ui-src/lib/views/NVRSettingsView.js 5.85 KiB [built]
         | ./ui-src/lib/support/RecordingFormatter.js 3.54 KiB [built]
         | ./ui-src/lib/views/StreamSelectorView.js 3.66 KiB [built]
         | ./ui-src/lib/views/StreamView.js 4.97 KiB [built]
         | ./ui-src/lib/MoonfireAPI.js 6.67 KiB [built]
         | ./ui-src/lib/models/Stream.js 3.25 KiB [built]
         | ./ui-src/lib/views/DatePickerView.js 8.34 KiB [built]
         | ./ui-src/lib/support/Time90kParser.js 4.4 KiB [built]
         |     + 6 hidden modules
        + 53 hidden modules

    WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
    Entrypoints:
      nvr (376 KiB)
          jquery-ui.618a444724cc90e7aff5.js
          jquery.8ebf197e0ac8876d932f.js
          vendor.0b47891808085786bbda.js
          nvr.7f072ad91f4b432d95fe.js


    WARNING in webpack performance recommendations:
    You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
    For more info visit https://webpack.js.org/guides/code-splitting/
    Child HtmlWebpackCompiler:
         1 asset
        Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
        [0] ./node_modules/html-webpack-plugin/lib/loader.js!./ui-src/index.html 3.95 KiB {0} [built]
    Child favicons-webpack-plugin:
         1 asset
        Entrypoint favicon.svg = 09052b0e31ea575be5cb
        [0] ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/usr/local/src/moonfire-nvr/node_modules/.cache/favicons-webpack-plugin"}!./node_modules/favicons-webpack-plugin/src/loader.js?{"prefix":"favicons-[hash]/","options":{"coast":false,"windows":false,"yandex":false,"appName":"moonfire-nvr","appDescription":"security camera network video recorder","version":"0.1.0","developerName":"Scott Lamb","developerURL":"https://www.slamb.org/"},"path":"/"}!./ui-src/favicon.svg 3.13 MiB {0} [built]
    Done in 110.78s.

    real    1m53.172s
    user    2m58.783s
    sys     0m13.312s
    pi@raspberrypi:/usr/local/src/moonfire-nvr $
   
8:26 PM 6/4/2020
    date;time cargo test

The cargo test build took about 22 minutes.  The cargo build --release took 28 minutes and successfully completed.  No need for cross-compiling or distributed compiling with a RaspberryPi 4 with 8 GBs.

I captured the build and top sessions of my two PuTTY consoles using the open source Windows Sharex screen capture, the video file is 115 MB and is available for the next 10 days at https://drive.google.com/file/d/1TYTIEBkXONAhFHF3r0FPpirqiKB64_QK/view?usp=sharing  I thought it might be helpful to see what the demands on the memory were since I read earlier that Moonfire-nvr would not build on a Raspberry Pi with 4 GBs.

I currently have four Reolink cameras:
  • two RLC-420 (maximum frame 2560 x 1440) (garage with a Ubiquiti NBE-5AC-16 2-PACK 5GHz NanoBeam 5AC 16 airMAX ac CPE 16dBi Giga PoE 8W in between the cameras and the switch -- this probably is the cause of a lot of packet drops).  These are distinguished with "garage" in their name.
  • two RLC-420-5MP (maximum frame 2560 x 1920) hard-wired to my switch.  These are distinguished with "peck" in there name.
All cameras are running at 30 frames per second (and have audio, but Moonfire-nvr currently does not support audio).  I configured all four cameras allocarting 2 GBs of space for each camera and a 120 second.

It looks like the 2 GB limitation allows for about 2 hours of retention.  Bear in mind that the Pi is writing against the SD card, so probably a lot is being lost in that bottleneck. (Note: SD cards are on the market touting that they can replace NVRs, they are about 10x the expense of a hard drive.)  This was a test to deal with stock items and show the failures.  Here is a screen shot.

I have ordered:
The Western Digital purple drives are the preferred drives for constant video recording.  While 5000 RPM is sufficient, Western Digital only offer the 7200 RPM class for 8TBs or more, see Specifications.  I plan to eventually ramp up to 10 or 12 cameras.

Moonfire-nvr satisfies my requirement that a constant stream be captured and cached.  My goals now are:
  • integrate the motion project (https://github.com/Motion-Project) with Moonfire's cache for analysis
  • have Moonfire support audio feeds
  • capture and preserve motion project's artifacts for a a simpleton's AI analysis
John
--

John Laurence Poole
1566 Court ST NE
Salem OR 97301-4241
707-812-1323 office

Scott Lamb

unread,
Jun 6, 2020, 12:42:10 PM6/6/20
to John, moonfire-nvr-users
That's good. I'm not too surprised; I had similar results with a 4 GiB Pi4. The compile is annoyingly slow if you're doing development but okay for setting up once.
 

I captured the build and top sessions of my two PuTTY consoles using the open source Windows Sharex screen capture, the video file is 115 MB and is available for the next 10 days at https://drive.google.com/file/d/1TYTIEBkXONAhFHF3r0FPpirqiKB64_QK/view?usp=sharing  I thought it might be helpful to see what the demands on the memory were since I read earlier that Moonfire-nvr would not build on a Raspberry Pi with 4 GBs.

I currently have four Reolink cameras:
  • two RLC-420 (maximum frame 2560 x 1440) (garage with a Ubiquiti NBE-5AC-16 2-PACK 5GHz NanoBeam 5AC 16 airMAX ac CPE 16dBi Giga PoE 8W in between the cameras and the switch -- this probably is the cause of a lot of packet drops).  These are distinguished with "garage" in their name.
  • two RLC-420-5MP (maximum frame 2560 x 1920) hard-wired to my switch.  These are distinguished with "peck" in there name.
All cameras are running at 30 frames per second (and have audio, but Moonfire-nvr currently does not support audio).  I configured all four cameras allocarting 2 GBs of space for each camera and a 120 second.

It looks like the 2 GB limitation allows for about 2 hours of retention.  Bear in mind that the Pi is writing against the SD card, so probably a lot is being lost in that bottleneck. (Note: SD cards are on the market touting that they can replace NVRs, they are about 10x the expense of a hard drive.)  This was a test to deal with stock items and show the failures.  Here is a screen shot.

That'd be my guess as well. Certainly from your screenshot below I can see that it's losing and re-establishing the streams quite frequently. Your logs are probably full of entries long writes followed by connection failures and retries. I expect this will get better when you set up the hard drive.
Nice. That's a step up from the SATA docks I've been using.
The Western Digital purple drives are the preferred drives for constant video recording.  While 5000 RPM is sufficient, Western Digital only offer the 7200 RPM class for 8TBs or more, see Specifications.  I plan to eventually ramp up to 10 or 12 cameras.

Moonfire-nvr satisfies my requirement that a constant stream be captured and cached.  My goals now are:
I'll be interested to hear how satisfied you are with the results of the detection. I've looked at their code a bit and it wouldn't be too hard to port their algorithm to a more modular, tested, Rust version to integrate into Moonfire NVR. The copyright terms are compatible as well (GPLv2 or later; Moonfire's is GPLv3). My impression was though that the results are nowhere near as good as what you can get with AI. Also it seems a little fussy in terms of needing to tune parameters to achieve the best result.
  • have Moonfire support audio feeds
That's issue #34. If you want to speed it up, one way you could help without learning Rust is talking ffmpeg folks into fixing a bug. I haven't even reported it to them, much less carried through, but it's described a bit at #36. It should be reproducible with the ffmpeg commandline tool by itself; no Moonfire code required. It's certainly reproducible on my Dahua camera; probably your Reolink ones as well.

  • capture and preserve motion project's artifacts for a a simpleton's AI analysis
This is something I'd love to have. See also my reply to your message about model costs. Some shared repository of images/videos—perhaps even a github repo of a plain-text labels database and large file links—would be really helpful for Moonfire NVR or any other project that wants to support this kind of analytics. Might be a good way to put your love of Perl to use. :-)

John
--

John Laurence Poole
1566 Court ST NE
Salem OR 97301-4241
707-812-1323 office

--
You received this message because you are subscribed to the Google Groups "moonfire-nvr-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moonfire-nvr-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/moonfire-nvr-users/39083374-6735-2c17-7236-5030a5c33a55%40gmail.com.


--
Reply all
Reply to author
Forward
0 new messages