marcus-j-davies / nvr-js

A simple, lightweight, but very functional NVR aimed at 24/7 recording using nodejs.
MIT License
25 stars 13 forks source link

Camera: xxx was terminated, respawning after 10 seconds #9

Closed trc-turing closed 2 years ago

trc-turing commented 2 years ago

I got 2 errors, one is ''Camera: Garage was terminated, respawning after 10 seconds...", the other one is "disk name invalid, using / as default" i checked the .mp4 files, the size all is 0 byte. I run the code on ubuntu18.04, node versoin v16.15.1.

it's my log.

Checking config. Config loaded: /home/trc/nvrjs.config.js Checking volumes and ffmpeg. Creating db structure. Starting data write queue. Creating express application. Compiling pages. Configuring camera: Garage NVR JS is Ready! Connecting to db. Starting purge interval. Purging data. Camera: Garage was terminated, respawning after 10 seconds... disk name invalid, using / as default disk name invalid, using / as default Camera: Garage was terminated, respawning after 10 seconds... disk name invalid, using / as default
disk name invalid, using / as default

I modified the config file like this:

module.exports = {
    /* System Settings */
    system: {
        /* Username */
        username: "admin",
        /* bcrypt password (default: admin) */
        password: '$2a$10$CnOx/6vFY2ehRDf68yqd..aLlv0UM.zeBLKnRjuU8YykCsC2Ap3iG',
        /* bcrypt API Key (default: x7Te9m38JHQq6ddv) */
        apiKey: '$2a$10$N53ci.EIQ7JCu6u1HlOjoO//W0Bmp3GrRruyK1Jysr01CQ1rDrVQK',
        /* Any random string */
        cookieKey: 'f3gi6FLhIPVV31d1TBQUPEAngrI3wAoP',
        interfacePort: 7878,
        /* location used for 24/7 recording and database generation */
        /* This should be the root of a mount point i.e a dedicated HDD for 24/7 recordings */
        storageVolume: '/home/trc/',
        /* Continuous recording settings */
        ffmpegLocation: '/usr/bin/ffmpeg',
        continuousSegTimeMinutes: 15,
        continuousDays: 14,
        continuousPurgeIntervalHours: 24,
        /* event throttle per sensorId */
        eventSensorIdCoolOffSeconds: 60
    },
    /* Cameras */
    cameras: {
        '66e39d21-72c4-405c-a838-05a8e8fe0742': {
            name: 'Garage',
            /* Input Source Config */
            /* The keys and values represent the ffmpeg options */
            inputConfig: {
                use_wallclock_as_timestamps: '1',
                fflags: '+igndts',
                analyzeduration: '1000000',
                probesize: '1000000',
                rtsp_transport: 'tcp',
                stimeout: '30000000'
            },
            /* Input Address */
            input: 'rtsp://admin:123456@192.168.0.123:554?channel=1&subtype=0',
            /* Recording 24/7 */
            /* Disabling continuous recording, will disable the ability to create events */
            continuous: true,
            /* Live streaming config */
            /* These settings should be good enough for a low delay live stream, providing your camera produces h264 frames */
            /* streaming is achieved with websockets and MP4 fragments */
            liveConfig: {
                codecString: 'video/mp4; codecs="avc1.64001f"',
                streamConfig: {
                    an: '',
                    vcodec: 'copy',
                    f: 'mp4',
                    movflags: '+frag_keyframe+empty_moov+default_base_moof',
                    reset_timestamps: '1'
                }
            }
        }
    }
};

if i use the rtsp url on VLC player, i can see the rtsp stream. but the viewer could not show anything about camera data.

Selection_001

Does anyone know the reason?

marcus-j-davies commented 2 years ago

Hi @trc-turing

disk name invalid, using / as default

This is due to the fact you are not using a root mount point, this package expects an entire HDD to store the 24/7 footage. storageVolume: '/home/trc/', is storing clips in a folder called trc

it really should be something like storageVolume: '/Volumes/CCTV', where CCTV is a mount point.

The error is not critical, it's just a warning - you can safely ignore it.

Camera: Garage was terminated, respawning after 10 seconds...

This will be ffmpeg not liking something about the Incoming data, do you know if the garage camera is producing h264 frames?

The reason the stream is blank, is due to the fact FFMPEG is not able to keep going due to the error (whatever it may be) Try changing some of the config values for the Garage camera (inputConfig), or Evan try adding some like stating the fps

Try doing this in terminal. and see if it starts recording to out.mp4

/usr/bin/ffmpeg -use_wallclock_as_timestamps 1 -fflags +igndts -analyzeduration 1000000 -probesize 1000000 -rtsp_transport tcp -stimeout 30000000 -i rtsp://admin:123456@192.168.0.123:554?channel=1&subtype=0 -vcodec copy ./out.mp4
trc-turing commented 2 years ago

Hi @trc-turing

disk name invalid, using / as default

This is due to the fact you are not using a root mount point, this package expects an entire HDD to store the 24/7 footage. storageVolume: '/home/trc/', is storing clips in a folder called trc

it really should be something like storageVolume: '/Volumes/CCTV', where CCTV is a mount point.

The error is not critical, it's just a warning - you can safely ignore it.

Camera: Garage was terminated, respawning after 10 seconds...

This will be ffmpeg not liking something about the Incoming data, do you know if the garage camera is producing h264 frames?

The reason the stream is blank, is due to the fact FFMPEG is not able to keep going due to the error (whatever it may be) Try changing some of the config values for the Garage camera (inputConfig), or Evan try adding some like stating the fps

Try doing this in terminal. and see if it starts recording to out.mp4

/usr/bin/ffmpeg -use_wallclock_as_timestamps 1 -fflags +igndts -analyzeduration 1000000 -probesize 1000000 -rtsp_transport tcp -stimeout 30000000 -i rtsp://admin:123456@192.168.0.123:554?channel=1&subtype=0 -vcodec copy ./out.mp4

Thanks for your reply! Because i took long time to solve the issue, so answer you lately, sorry. I made a stupid mistake on camera setting. I tested it on command line: /usr/bin/ffmpeg -use_wallclock_as_timestamps 1 -fflags +igndts -analyzeduration 1000000 -probesize 1000000 -rtsp_transport tcp -stimeout 30000000 -i rtsp://admin:123456@192.168.0.123:554?channel=1&subtype=0 -vcodec copy ./out.mp4 It works well, i can play the video by VLC, and I checked the video info by ffprobe out.mp4. It is the output:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 title : RTSP/RTP stream from icamra ipc encoder : Lavf57.83.100 Duration: 00:00:23.19, start: 0.000000, bitrate: 68 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 36 kb/s, 25.24 fps, 49 tbr, 90k tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 27 kb/s (default) Metadata: handler_name : SoundHandler

But some day i saw the camera setting info accidentally, it's enable H.265 codec. so i change to enable h.254. The issue is also happened, i found the audio is enable G.711, i changed it to aac codec. The source code works well. and i tried to change -c:a copy to -an, it's also works well. Thank you very much.
i will close this issue