Coder Social home page Coder Social logo

n1ckyrush / wyzecam-hls Goto Github PK

View Code? Open in Web Editor NEW
67.0 9.0 5.0 11 KB

Converts MP4 files from WyzeCam NFS to HLS stream. Much more stable alternative to RTSP firmware.

JavaScript 100.00%
wyzecam wyze rtsp hls nfs ffmpeg cctv shinobi nvr motioneye

wyzecam-hls's People

Contributors

n1ckyrush avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wyzecam-hls's Issues

Adding ftp download capability

Hi,
I had lots of NFS incompatibility related camera reboots so ended up adding a custom script to the camera and downloading files via an ftp server that is started from the sd card. On my Blueiris recorder pc, I have a python script downloading the camera files via ftp end then I have your script running to create the HLS stream for BlueIris from the downloaded files. This is rock solid now (unlike NFS was). But, it is too cluttered and not knowing much about js scripting I was wondering if you would be willing to incorporate optional ftp client capability directly to your script to make things a little more user friendly.
Thanks

Stream ends at the minute mark

With my iPhone the stream makes it past the minute mark but with VLC on my desktop it ends at the minute mark. I added the camera in Shinobi but when I view it in the monitor it also ends at the minute mark and then I have to hit reconnect to get another minute. What am I missing here?

Stream may work in Shinobi but it doesn't work in motioneye.

It's running and has given me 4 urls for 4 camera's but putting them into motioneye and trying to add a cam does not work...what process should be followed? Example address is http://127.0.0.1:9001/Back_Yard/hls.m3u8 Both wyzecam-hls and motioneye are on the same raspberry pi so 127.0.01 should be fine.

image

The log file says the streams are available:

I see this error over and over in error log:
021-01-02T14:58:17.290Z [0] [Back_Yard][checkPlaylistFile] playlist file error TypeError: Cannot read property 'filename' of undefined
at checkPlaylistFile (/root/wyzecam-hls/methods/checkPlaylistFile.js:46:244)
2021-01-02T14:58:21.295Z [0] [Front_Yard][checkPlaylistFile] playlist file error TypeError: Cannot read property 'filename' of undefined
at checkPlaylistFile (/root/wyzecam-hls/methods/checkPlaylistFile.js:46:244)
2021-01-02T14:58:29.310Z [0] [Front_Yard][checkPlaylistFile] playlist file error TypeError: Cannot read property 'filename' of undefined
at checkPlaylistFile (/root/wyzecam-hls/methods/checkPlaylistFile.js:46:244)

The out log shows:

2021-01-02T14:22:42.003Z [1] [Back_Yard][stats] stream delay: 62s, segments in queue: 6, latest file: 20210102/09/21.mp4, errors: 6412, warnings: 0
2021-01-02T14:22:42.004Z [1] [Front_Yard][stats] stream delay: 62s, segments in queue: 8, latest file: 20210102/09/21.mp4, errors: 6412, warnings: 0
2021-01-02T14:22:42.006Z [1] [Garage_Cam][stats] stream delay: 80s, segments in queue: 30, latest file: 20210102/09/21.mp4, errors: 384, warnings: 0
2021-01-02T14:22:42.135Z [1] [Shed][stats] stream delay: 63s, segments in queue: 8, latest file: 20210102/09/21.mp4, errors: 1283, warnings: 0

Need Help to set this up please

Hi,
I have set a Wyze Cam V3 and i seve the Records on my Synology Nas
"volume1/video/WyzeCams/xxx"
I copy the wyzecam-hls Folder to "volume1/video/wyzecam-hls"
in the Config File, i have :

HOST: '192.168.196.156',
PORT: 9001,
xxx
NFS_PATH: 'volume1/video',
xxx
NAME: 'Cam1',
xxx
{
NAME: 'cam1',
NFS_PATH: '/volume1/video/WyzeCams/7C78B22992A1'
}

Now i have a "latest.m3u8" file in the tmp/cam1 Folder. But i can not play this File in VLC, and i have no idea how to set this up in Shinobi. "http://192.168.196.156:9001/cam1/hls.m3u8" does nothing.

Can someone point me in the right direktion?

Here is the log:

/var/services/homes/frank/.pm2/logs/wyzecam-hls-out.log last 15 lines:
0|wyzecam- | NFS_CLEANUP_FOLDERS: [ 'alarm', 'photo', 'time_lapse', 'record' ],
0|wyzecam- | NFS_CLEANUP_OLD_DAYS: 2,
0|wyzecam- | NFS_CLEANUP_PERIOD_SEC: 300,
0|wyzecam- | TMP_CLEANUP_OLD_SEC: 180,
0|wyzecam- | TMP_CLEANUP_PERIOD_SEC: 180,
0|wyzecam- | CHECK_NEW_VIDEO_FILE_PERIOD_SEC: 3,
0|wyzecam- | DEBUG_MODE: 0,
0|wyzecam- | TMP_PATH: '/volume1/video/wyzecam-hls/tmp/cam1'
0|wyzecam- | }
0|wyzecam- | ]
0|wyzecam- | 2021-04-17T07:57:49.308Z [1] [cam1][cleanupNfs] stats: {"total":3,"deleted":0}
0|wyzecam- | 2021-04-17T07:57:49.310Z [1] [cam1][cleanupTmpFiles] stats: {"total":0,"deleted":0}
0|wyzecam- | 2021-04-17T07:57:49.423Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/56.mp4, errors: 0, warnings: 0
0|wyzecam- | 2021-04-17T07:57:49.423Z creating server on 192.168.196.156:9001
0|wyzecam- | 2021-04-17T07:57:49.423Z [1] [cam1] HLS URL: http://192.168.196.156:9001/cam1/hls.m3u8

0|wyzecam-hls | 2021-04-17T07:58:19.423Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/57.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T07:58:49.425Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/57.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T07:59:19.425Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/58.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T07:59:49.424Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/58.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:00:19.425Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/59.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:00:49.313Z [1] [cam1][cleanupTmpFiles] stats: {"total":4,"deleted":0}
0|wyzecam-hls | 2021-04-17T08:00:49.425Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/09/59.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:01:19.424Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/10/00.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:01:49.426Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/10/00.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:02:19.425Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/10/01.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:02:49.310Z [1] [cam1][cleanupNfs] stats: {"total":3,"deleted":0}
0|wyzecam-hls | 2021-04-17T08:02:49.426Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/10/01.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:03:19.426Z [1] [cam1][stats] stream delay: -s, segments in queue: 0, latest file: 20210417/10/02.mp4, errors: 0, warnings: 0
0|wyzecam-hls | 2021-04-17T08:03:49.316Z [1] [cam1][cleanupTmpFiles] stats: {"total":7,"deleted":4}

and this is everything whats in the m3u8 file is inside
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:23

Says it can't find esm but esm was installed globally

As indicated it says it can't find esm. I've done both "npm install" and "npm install -g" of esm. What am I missing? (besides esm obviously)

Error: Cannot find module 'esm'
Require stack:

  • internal/preload
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at Module._preloadModules (node:internal/modules/cjs/loader:1267:12)
    at loadPreloadModules (node:internal/bootstrap/pre_execution:455:5)
    at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:74:3)
    at node:internal/main/run_main_module:7:1 {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ 'internal/preload' ]
    }
    /root/wyzecam-hls/config.js:68
    {
    ^

SyntaxError: Invalid or unexpected token
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
/root/wyzecam-hls/config.js:68
{
^

SyntaxError: Invalid or unexpected token
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
/root/wyzecam-hls/config.js:68
{
^

SyntaxError: Invalid or unexpected token
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)

Missing temporary directory causes CameraInstance to return undefined.

Hi there interesting project I am giving it a quick try.

On my initial run if the temporary directory is missing which it will always be since the program has never been run the rm command here https://github.com/n1ckyrush/wyzecam-hls/blob/master/methods/createCameraInstance.js#L39 fails and causes the camera instance to be undefined which causes issues down stream. I was able to get around this by manually creating the directory then running the app and it seems to be fine from there.

It's late so I haven't submitted a PR but I was thinking a few things here.

  1. Change it so that the command checks for existence first then deletes it.
  2. Undefined camera instance should be removed from the camera instances array.
  3. Have the app clean up it's temporary directories when it is stopped
  4. Put the temporary files in to the system temp directory

hundreds of errors in ffmpeg 4 on rpi 4?

I'd like to know what pi and version of ffmpeg you are using because although the nfs shares and files are stable the hls stream generated is NOT. It gets hundreds of errors in the error log with multi minute gaps resulting in a jerky mess within shinobi. This is probably why motioneye wouldn't even accept the stream. It mentions Possible bad wifi but the nfs share has each minute mp4 and the hls is being generated on the same rpi that owns the share.

I'm on a rpi 4 8Gb running dietpi 64bit based on debian buster. ffmpeg version 4.1.6-1deb10u1+rpt1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1
deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared

wyzecam-hls-error__2021-01-04_00-00-00.log
wyzecam-hls-error.log
wyzecam-hls-out__2021-01-04_00-00-00.log
wyzecam-hls-out.log

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.