roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.61k stars 163 forks source link

Jetson Nano Version #108

Open eldadh opened 3 years ago

eldadh commented 3 years ago

Are there any plans to create a version for Nvidia Jetson Nano?

roflcoopter commented 3 years ago

Yes that is something i am planning to do. However, i do not have a device to test with so it could turn out problematic depending on what is required to ge it to work on this device

jaburges commented 3 years ago

https://hub.docker.com/r/lumaia/viseron-jetson ? Not tested though

roflcoopter commented 3 years ago

Was not aware of that one, but its not linked to any repository so cant check the Dockerfile...

l-maia commented 3 years ago

I own that repo, still testing it on my free time but the dockerfiles still require some work. That is the main reason i didn't have a merge request ready. If you want to make things faster, i can share them here. Also, the nvidia ffmpeg hevc crashes with segfault on my hikvision rtsp streams, so it should be working without hw decoding at least. For my usage it is enough because i have an mjpeg substream for object detection.

roflcoopter commented 3 years ago

Would be great to see your Dockerfiler for some inspiration. I will need to adapt it to fit into my multiarch builds tho

l-maia commented 3 years ago

Just forked and made a commit with everything in https://github.com/l-maia/viseron. Note that inside the jetson folder there's an additional README.md with a description of a change you are required to do in the jetson host to provide the multimedia api folders to the ffmpeg container.

roflcoopter commented 3 years ago

Just started to try and get this working. Can any of you try if this command just errors out or not? docker run -it --rm --runtime=nvidia roflcoopter/jetson-nano-ffmpeg:4.4 ffmpeg --help

l-maia commented 3 years ago

The command returns: Error: Can't initialize nvrm channel Couldn't create ddkvic Session: Cannot allocate memory nvbuf_utils: Could not create Default NvBufferSession

This version requires --privileged, then it works as expected.

roflcoopter commented 3 years ago

The command returns: Error: Can't initialize nvrm channel Couldn't create ddkvic Session: Cannot allocate memory nvbuf_utils: Could not create Default NvBufferSession

This version requires --privileged, then it works as expected.

Ohh so it works if you add --privileged?

l-maia commented 3 years ago

Ohh so it works if you add --privileged?

Yes. At least the --help flag, although I didn't had the time to test with an example h264 stream to check if the hw decoder works.

roflcoopter commented 3 years ago

just pushed an image which contains the full install of Viseron: roflcoopter/jetson-nano-viseron:dev Anyone who can try it out?

Note that there is currently a regression which causes Viseron to crash if you dont use MQTT which i will fix shortly. And also, there is no automatic detection of what codec to use just yet so you need to specify that manually in the config for your camera like this: codec: h264_nvmpi

eldadh commented 3 years ago

with the fallowing config

cameras:

logging: level: debug

motion_detection: interval: 1 trigger_detector: true timeout: true max_timeout: 30 width: 300 height: 300 area: 0.1 frames: 3

mqtt:

broker: ** port: 1883 username: password:

recorder: lookback: 10 timeout: 10 retain: 3 folder: /recordings

`

I have tried to run it and received this error:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 10-adduser: executing... **** UID/GID *** User uid: 0 User gid: 0 ** Done ** [cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-gid-video-device: executing... [cont-init.d] 20-gid-video-device: exited 0. [cont-init.d] 30-edgetpu-permission: executing... ** Setting EdgeTPU permissions * Coral Vendor IDs: "1a6e" "18d1" No EdgeTPU USB device was found ** Done ** [cont-init.d] 30-edgetpu-permission: exited 0. [cont-init.d] 40-set-env-vars: executing... ** Checking for hardware acceleration platforms ** OpenCL cannot be used VA-API cannot be used CUDA cannot be used * Done *** [cont-init.d] 40-set-env-vars: exited 0. [cont-init.d] 50-check-if-rpi: executing... ** Checking if we are running on an RPi ** Not running on any supported RPi * Done *** [cont-init.d] 50-check-if-rpi: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [2021-06-07 14:12:01] [INFO ] [viseron ] - ------------------------------------------- [2021-06-07 14:12:01] [INFO ] [viseron ] - Initializing... [2021-06-07 14:12:01] [DEBUG ] [viseron.watchdog ] - Starting scheduler [2021-06-07 14:12:01] [DEBUG ] [viseron ] - Starting cleanup scheduler [2021-06-07 14:12:01] [DEBUG ] [viseron ] - Running initial cleanup [2021-06-07 14:12:01] [DEBUG ] [viseron.cleanup ] - Running cleanup [2021-06-07 14:12:01] [INFO ] [viseron.mqtt ] - Initializing MQTT connection [2021-06-07 14:12:01] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-07 14:12:01] [DEBUG ] [viseron.detector ] - Initializing object detector darknet [2021-06-07 14:12:01] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f3026e940> [2021-06-07 14:12:01] [DEBUG ] [viseron.detector ] - Object detector initialized [2021-06-07 14:12:01] [INFO ] [viseron ] - Initializing NVR threads [2021-06-07 14:12:01] [DEBUG ] [viseron.nvr.entrance ] - Initializing NVR thread [2021-06-07 14:12:01] [DEBUG ] [viseron.camera.entrance ] - Initializing camera Entrance [2021-06-07 14:12:01] [DEBUG ] [viseron.camera.stream.entrance] - Getting stream information for rtsp://:@*****:8554/unicast Exception in thread setup.Entrance: Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/src/viseron/init.py", line 144, in run FFMPEGNVR(camera_config, self._detector) File "/src/viseron/nvr.py", line 120, in init self.camera = FFMPEGCamera(config, detector) File "/src/viseron/camera/init.py", line 34, in init self.initialize_camera(detector) File "/src/viseron/camera/init.py", line 59, in initialize_camera self.stream = Stream( File "/src/viseron/camera/stream.py", line 63, in init ) = self.get_stream_information(self.stream_config.stream_url) File "/src/viseron/camera/stream.py", line 195, in get_stream_information width, height, fps, codec, audio_codec = self.ffprobe_stream_information( File "/src/viseron/camera/stream.py", line 160, in ffprobe_stream_information streams = self.run_ffprobe(stream_url) File "/src/viseron/camera/stream.py", line 150, in run_ffprobe output: dict = json.loads(stdout) File "/usr/local/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) [2021-06-07 14:12:05] [INFO ] [viseron ] - Initialization complete [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting. `

roflcoopter commented 3 years ago

@eldadh Whats the output of this command? You gotta add your username, pass and ip address

docker run -it --rm --entrypoint "" roflcoopter/jetson-nano-viseron:dev ffprobe -print_format json -show_error -show_streams rtsp://username:password@ipaddress:8554/unicast
eldadh commented 3 years ago

the output is: Error: Can't initialize nvrm channel Error: Can't initialize nvrm channel Couldn't create ddkvic Session: Cannot allocate memory nvbuf_utils: Could not create Default NvBufferSession

When i run with --privileged

nvbuf_utils: Could not get EGL display connection ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-neon --enable-v4l2_m2m --enable-nvmpi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 { Input #0, rtsp, from 'rtsp://:**@192.168.3.80:8554/unicast': Metadata: title : LIVE555 Streaming Media v2020.05.15 comment : LIVE555 Streaming Media v2020.05.15 Duration: N/A, start: 2.659989, bitrate: N/A Stream #0:0: Video: h264, yuv420p(progressive), 1920x1080, 25 fps, 50 tbr, 90k tbn, 50 tbc "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "unknown", "profile": "77", "codec_type": "video", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1080, "closed_captions": 0, "has_b_frames": 0, "pix_fmt": "yuv420p", "level": 40, "chroma_location": "left", "field_order": "progressive", "refs": 1, "is_avc": "false", "nal_length_size": "0", "r_frame_rate": "50/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 239399, "start_time": "2.659989", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } } ] }

roflcoopter commented 3 years ago

@eldadh Thanks, and this command?

docker run -it --rm --entrypoint "" --privileged roflcoopter/jetson-nano-viseron:dev ffprobe -hide_banner -loglevel error -print_format json -show_error -show_streams rtsp://username:password@ipaddress:8554/unicast
eldadh commented 3 years ago

`

nvbuf_utils: Could not get EGL display connection { "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "unknown", "profile": "77", "codec_type": "video", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1080, "closed_captions": 0, "has_b_frames": 0, "pix_fmt": "yuv420p", "level": 40, "chroma_location": "left", "field_order": "progressive", "refs": 1, "is_avc": "false", "nal_length_size": "0", "r_frame_rate": "10/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 248405, "start_time": "2.760056", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } } ] }

`

roflcoopter commented 3 years ago

`

nvbuf_utils: Could not get EGL display connection { "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "unknown", "profile": "77", "codec_type": "video", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1080, "closed_captions": 0, "has_b_frames": 0, "pix_fmt": "yuv420p", "level": 40, "chroma_location": "left", "field_order": "progressive", "refs": 1, "is_avc": "false", "nal_length_size": "0", "r_frame_rate": "10/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 248405, "start_time": "2.760056", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } } ] }

`

Ahh the first part is whats causing the JSON decode error, nvbuf_utils: Could not get EGL display connection What happens if you add export DISPLAY=:0?

docker run -it --rm --entrypoint "" --privileged roflcoopter/jetson-nano-viseron:dev export DISPLAY=:0 && ffprobe -hide_banner -loglevel error -print_format json -show_error -show_streams rtsp://username:password@ipaddress:8554/unicast
eldadh commented 3 years ago

It wont give our anything: Single line : "export: usage: export variable value prog..."

aprently it is mention in the NVIDIA forum aswell: https://forums.developer.nvidia.com/t/nvbuf-utils-could-not-get-egl-display-connection/84038/13

BTW does the the Object Detection leverages Jetpack (NVIDIA SDK) or not yet :-)

roflcoopter commented 3 years ago

@eldadh Okay, can you exec into the container and run the commands one by one?

1) docker run -it --rm --entrypoint "" --privileged roflcoopter/jetson-nano-viseron:dev /bin/bash 2) export DISPLAY=:0 3) ffprobe -hide_banner -loglevel error -print_format json -show_error -show_streams rtsp://username:password@ipaddress:8554/unicast

eldadh commented 3 years ago

nvbuf_utils: Could not get EGL display connection { "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "unknown", "profile": "77", "codec_type": "video", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1080, "closed_captions": 0, "has_b_frames": 0, "pix_fmt": "yuv420p", "level": 40, "chroma_location": "left", "field_order": "progressive", "refs": 1, "is_avc": "false", "nal_length_size": "0", "r_frame_rate": "10/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 221390, "start_time": "2.459889", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } } ] }

roflcoopter commented 3 years ago

@eldadh Arggg, need to get rid of that nvbuf_utils: Could not get EGL display connection somehow...

roflcoopter commented 3 years ago

Does this work? 1) docker run -it --rm --entrypoint "" --privileged roflcoopter/jetson-nano-viseron:dev /bin/bash 2) unset DISPLAY 3) ffprobe -hide_banner -loglevel error -print_format json -show_error -show_streams rtsp://username:password@ipaddress:8554/unicast

eldadh commented 3 years ago

tried it already :-)

unfortunatly same result

nvbuf_utils: Could not get EGL display connection { "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "unknown", "profile": "77", "codec_type": "video", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1080, "closed_captions": 0, "has_b_frames": 0, "pix_fmt": "yuv420p", "level": 40, "chroma_location": "left", "field_order": "progressive", "refs": 1, "is_avc": "false", "nal_length_size": "0", "r_frame_rate": "10/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 68399, "start_time": "0.759989", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } } ] }

eldadh commented 3 years ago

you can hide the line using "sed" ( ugly but works)

ffprobe -hide_banner -loglevel error -print_format json -show_error -show_streams rtsp://:**@:8554/unicast | tail -n +2

roflcoopter commented 3 years ago

Yeah i guess ill have to trim it off manually. It should be easy enough since i am already parsing it in the code.

Ill push a new version to DockerHub soon, ill let you know when its ready

l-maia commented 3 years ago

I haven't got the Jetson with me to test, but why not just parse separately stdout and stderr? I guess appending 2> /dev/null to the command will hide the errors if the message is properly written to stderr. Then you could work with separate pipes in python and parse them only if they come from stdout with the expected format.

roflcoopter commented 3 years ago

@l-maia Good call, i actually thought i was doing that but apparently not.

Just pushed a new version of roflcoopter/jetson-nano-viseron:dev that separates stdout and stderr aswell as trimming away any text before the json object starts.

I tested as much as i could but its hard for me to verify as the container wont run at all since i dont have a Nano, so thanks for sticking with me through this one

eldadh commented 3 years ago

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 10-adduser: executing... **** UID/GID *** User uid: 0 User gid: 0 ** Done ** [cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-gid-video-device: executing... [cont-init.d] 20-gid-video-device: exited 0. [cont-init.d] 30-edgetpu-permission: executing... ** Setting EdgeTPU permissions * Coral Vendor IDs: "1a6e" "18d1" No EdgeTPU USB device was found ** Done ** [cont-init.d] 30-edgetpu-permission: exited 0. [cont-init.d] 40-set-env-vars: executing... ** Checking for hardware acceleration platforms ** OpenCL cannot be used VA-API cannot be used CUDA cannot be used * Done *** [cont-init.d] 40-set-env-vars: exited 0. [cont-init.d] 50-check-if-rpi: executing... ** Checking if we are running on an RPi ** Not running on any supported RPi * Done *** [cont-init.d] 50-check-if-rpi: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [2021-06-08 10:08:02] [INFO ] [viseron ] - ------------------------------------------- [2021-06-08 10:08:02] [INFO ] [viseron ] - Initializing... [2021-06-08 10:08:02] [DEBUG ] [viseron.watchdog ] - Starting scheduler [2021-06-08 10:08:02] [DEBUG ] [viseron ] - Starting cleanup scheduler [2021-06-08 10:08:02] [DEBUG ] [viseron ] - Running initial cleanup [2021-06-08 10:08:02] [DEBUG ] [viseron.cleanup ] - Running cleanup [2021-06-08 10:08:02] [INFO ] [viseron.mqtt ] - Initializing MQTT connection [2021-06-08 10:08:02] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-08 10:08:02] [DEBUG ] [viseron.detector ] - Initializing object detector darknet [2021-06-08 10:08:05] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f25b5c6a0> [2021-06-08 10:08:05] [DEBUG ] [viseron.detector ] - Object detector initialized [2021-06-08 10:08:05] [INFO ] [viseron ] - Initializing NVR threads [2021-06-08 10:08:05] [DEBUG ] [viseron.nvr.entrance ] - Initializing NVR thread [2021-06-08 10:08:05] [DEBUG ] [viseron.camera.entrance ] - Initializing camera Entrance [2021-06-08 10:08:05] [DEBUG ] [viseron.camera.stream.entrance] - Getting stream information for rtsp://:@192.168.3.82:8554/unicast [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.stream.entrance] - Stream information from FFprobe: Width: 1920 Height: 1080 FPS: 25.0 Video Codec: h264 Audio Codec: None [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.entrance ] - Resolution: 1920x1080 @ 25.0 FPS [2021-06-08 10:08:10] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/decode/object, <queue.Queue object at 0x7f2638b190> [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.entrance ] - Starting decoder thread [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.entrance ] - Running decoder entrance.object_detection at 1.0s interval, every 25.0 frame(s) [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.entrance ] - Camera Entrance initialized [2021-06-08 10:08:10] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/processed/object, <queue.Queue object at 0x7f25b5c5b0> [2021-06-08 10:08:10] [DEBUG ] [viseron.motion.entrance ] - Initializing motion detector [2021-06-08 10:08:10] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/decode/motion, <queue.Queue object at 0x7f08043340> [2021-06-08 10:08:10] [DEBUG ] [viseron.motion.entrance ] - Starting decoder thread [2021-06-08 10:08:10] [DEBUG ] [viseron.motion.entrance ] - Running decoder entrance.motion_detection at 1.0s interval, every 25.0 frame(s) [2021-06-08 10:08:10] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/scan/motion, <queue.Queue object at 0x7f25b6cd00> [2021-06-08 10:08:10] [DEBUG ] [viseron.motion.entrance ] - Motion detector initialized [2021-06-08 10:08:10] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/processed/motion, <queue.Queue object at 0x7f25b6ce50> [2021-06-08 10:08:10] [DEBUG ] [viseron.nvr.entrance ] - Starting camera [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.entrance ] - Starting capture thread [2021-06-08 10:08:10] [DEBUG ] [viseron.recorder.entrance] - Initializing ffmpeg recorder [2021-06-08 10:08:10] [DEBUG ] [viseron.camera.stream.entrance] - FFMPEG decoder command: entrance -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://:@192.168.3.82:8554/unicast -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy /segments/Entrance/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1 [2021-06-08 10:08:10] [DEBUG ] [viseron.recorder.entrance] - Creating folder /segments/Entrance [2021-06-08 10:08:10] [DEBUG ] [viseron.nvr.entrance ] - Waiting for first frame [2021-06-08 10:08:10] [DEBUG ] [viseron.nvr.entrance ] - NVR thread initialized [2021-06-08 10:08:10] [INFO ] [viseron ] - Initialization complete [2021-06-08 10:08:13] [ERROR ] [viseron.camera.stream.entrance] - Failed to query video capabilities: Inappropriate ioctl for device [2021-06-08 10:08:13] [ERROR ] [viseron.camera.stream.entrance] - libv4l2: error getting capabilities: Inappropriate ioctl for device [2021-06-08 10:08:14] [ERROR ] [viseron.camera.entrance ] - FFmpeg process has exited [2021-06-08 10:08:19] [ERROR ] [viseron.camera.entrance ] - Restarting frame pipe [2021-06-08 10:08:19] [DEBUG ] [viseron.camera.stream.entrance] - Performing a sanity check on the ffmpeg command [2021-06-08 10:08:22] [ERROR ] [viseron.camera.stream.entrance] - Error starting decoder command! Failed to query video capabilities: Inappropriate ioctl for device libv4l2: error getting capabilities: Inappropriate ioctl for device [2021-06-08 10:08:29] [ERROR ] [viseron.camera.stream.entrance] - Error starting decoder command! Failed to query video capabilities: Inappropriate ioctl for device libv4l2: error getting capabilities: Inappropriate ioctl for device Retrying in 5 seconds, message repeated 2 times

weitheng commented 3 years ago

Mine has a different message and am unable to access the user interface at port 8888

Attaching to viseron
viseron    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
viseron    | [s6-init] ensuring user provided files have correct perms...exited 0.
viseron    | [fix-attrs.d] applying ownership & permissions fixes...
viseron    | [fix-attrs.d] done.
viseron    | [cont-init.d] executing container initialization scripts...
viseron    | [cont-init.d] 10-adduser: executing... 
viseron    | ************************ UID/GID *************************
viseron    | User uid:    0
viseron    | User gid:    0
viseron    | ************************** Done **************************
viseron    | [cont-init.d] 10-adduser: exited 0.
viseron    | [cont-init.d] 20-gid-video-device: executing... 
viseron    | [cont-init.d] 20-gid-video-device: exited 0.
viseron    | [cont-init.d] 30-edgetpu-permission: executing... 
viseron    | ************** Setting EdgeTPU permissions ***************
viseron    | Coral Vendor IDs:
viseron    | "1a6e"
viseron    | "18d1"
viseron    | No EdgeTPU USB device was found
viseron    | ************************** Done **************************
viseron    | [cont-init.d] 30-edgetpu-permission: exited 0.
viseron    | [cont-init.d] 40-set-env-vars: executing... 
viseron    | ****** Checking for hardware acceleration platforms ******
viseron    | OpenCL cannot be used
viseron    | VA-API cannot be used
viseron    | CUDA cannot be used
viseron    | *********************** Done *****************************
viseron    | [cont-init.d] 40-set-env-vars: exited 0.
viseron    | [cont-init.d] 50-check-if-rpi: executing... 
viseron    | ********** Checking if we are running on an RPi **********
viseron    | Not running on any supported RPi
viseron    | *********************** Done *****************************
viseron    | [cont-init.d] 50-check-if-rpi: exited 0.
viseron    | [cont-init.d] done.
viseron    | [services.d] starting services
viseron    | [services.d] done.
viseron    | [2021-06-08 18:25:59] [INFO    ] [viseron                 ] - -------------------------------------------
viseron    | [2021-06-08 18:25:59] [INFO    ] [viseron                 ] - Initializing...
viseron    | [2021-06-08 18:25:59] [DEBUG   ] [viseron.watchdog        ] - Starting scheduler
viseron    | [2021-06-08 18:25:59] [DEBUG   ] [viseron                 ] - Starting cleanup scheduler
viseron    | [2021-06-08 18:25:59] [DEBUG   ] [viseron                 ] - Running initial cleanup
viseron    | [2021-06-08 18:25:59] [DEBUG   ] [viseron.cleanup         ] - Running cleanup
viseron    | [2021-06-08 18:25:59] [INFO    ] [viseron.mqtt            ] - Initializing MQTT connection
viseron    | [2021-06-08 18:25:59] [DEBUG   ] [viseron.mqtt            ] - MQTT connected with returncode 0
viseron    | [2021-06-08 18:25:59] [DEBUG   ] [viseron.detector        ] - Initializing object detector darknet
viseron    | [2021-06-08 18:26:02] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f2feaac40>
viseron    | [2021-06-08 18:26:02] [DEBUG   ] [viseron.detector        ] - Object detector initialized
viseron    | [2021-06-08 18:26:02] [INFO    ] [viseron                 ] - Initializing NVR threads
viseron    | [2021-06-08 18:26:02] [DEBUG   ] [viseron.nvr.foyer       ] - Initializing NVR thread
viseron    | [2021-06-08 18:26:02] [DEBUG   ] [viseron.camera.foyer    ] - Initializing camera Foyer
viseron    | [2021-06-08 18:26:02] [DEBUG   ] [viseron.camera.stream.foyer] - Getting stream information for rtsp://*****:*****@192.168.0.88:554/cam/realmonitor?channel=17@subtype=1
viseron    | [2021-06-08 18:26:08] [DEBUG   ] [viseron.camera.stream.foyer] - Stream information from FFprobe: Width: 704 Height: 576 FPS: 20.0 Video Codec: h264 Audio Codec: None
viseron    | [2021-06-08 18:26:08] [DEBUG   ] [viseron.camera.stream_segments.foyer] - Getting stream information for rtsp://*****:*****@192.168.0.88:554/cam/realmonitor?channel=17@subtype=0
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.stream_segments.foyer] - Stream information from FFprobe: Width: 1920 Height: 1080 FPS: 20.0 Video Codec: h264 Audio Codec: None
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.foyer    ] - Resolution: 704x576 @ 3 FPS
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic foyer/frame/decode/object, <queue.Queue object at 0x7f2c0134c0>
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.foyer    ] - Starting decoder thread
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.foyer    ] - Running decoder foyer.object_detection at 1s interval, every 3 frame(s)
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.foyer    ] - Camera Foyer initialized
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic foyer/frame/processed/object, <queue.Queue object at 0x7f2fea1b50>
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.motion.foyer    ] - Initializing motion detector
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic foyer/frame/decode/motion, <queue.Queue object at 0x7f2c013fd0>
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.motion.foyer    ] - Starting decoder thread
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.motion.foyer    ] - Running decoder foyer.motion_detection at 1s interval, every 3 frame(s)
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic foyer/frame/scan/motion, <queue.Queue object at 0x7f2c013b80>
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.motion.foyer    ] - Motion detector initialized
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic foyer/frame/processed/motion, <queue.Queue object at 0x7f2c0139a0>
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.nvr.foyer       ] - Starting camera
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.foyer    ] - Starting capture thread
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.recorder.foyer  ] - Initializing ffmpeg recorder
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.stream.foyer] - FFMPEG decoder command: foyer -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -rtsp_transport tcp -i rtsp://*****:*****@192.168.0.88:554/cam/realmonitor?channel=17@subtype=1 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.recorder.foyer  ] - Creating folder /segments/Foyer
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.nvr.foyer       ] - Waiting for first frame
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.nvr.foyer       ] - NVR thread initialized
viseron    | [2021-06-08 18:26:11] [INFO    ] [viseron                 ] - Initialization complete
viseron    | [2021-06-08 18:26:11] [DEBUG   ] [viseron.camera.stream_segments.foyer] - FFMPEG decoder command: foyer_segments -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -rtsp_transport tcp -i rtsp://*****:*****@192.168.0.88:554/cam/realmonitor?channel=17@subtype=0 -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy /segments/Foyer/%Y%m%d%H%M%S.mp4
viseron    | [2021-06-08 18:26:17] [DEBUG   ] [viseron.nvr.foyer       ] - First frame received
[2021-06-08 18:40:55] [DEBUG   ] [viseron.nvr.foyer.object] - Objects: [], message repeated 154 times
viseron    | 

The logs of my MQTT border indicate that a connection has been made from Viseron

l-maia commented 3 years ago

Mine has a different message and am unable to access the user interface at port 8888

From your logs it seems you didn't specify the h264_nvmpi codec for hardware acceleration, so it should be doing software decoding.

weitheng commented 3 years ago

My bad, missed that out. Here's what I get after including that:

viseron    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
viseron    | [s6-init] ensuring user provided files have correct perms...exited 0.
viseron    | [fix-attrs.d] applying ownership & permissions fixes...
viseron    | [fix-attrs.d] done.
viseron    | [cont-init.d] executing container initialization scripts...
viseron    | [cont-init.d] 10-adduser: executing... 
viseron    | ************************ UID/GID *************************
viseron    | User uid:    0
viseron    | User gid:    0
viseron    | ************************** Done **************************
viseron    | [cont-init.d] 10-adduser: exited 0.
viseron    | [cont-init.d] 20-gid-video-device: executing... 
viseron    | [cont-init.d] 20-gid-video-device: exited 0.
viseron    | [cont-init.d] 30-edgetpu-permission: executing... 
viseron    | ************** Setting EdgeTPU permissions ***************
viseron    | Coral Vendor IDs:
viseron    | "1a6e"
viseron    | "18d1"
viseron    | No EdgeTPU USB device was found
viseron    | ************************** Done **************************
viseron    | [cont-init.d] 30-edgetpu-permission: exited 0.
viseron    | [cont-init.d] 40-set-env-vars: executing... 
viseron    | ****** Checking for hardware acceleration platforms ******
viseron    | OpenCL cannot be used
viseron    | VA-API cannot be used
viseron    | CUDA cannot be used
viseron    | *********************** Done *****************************
viseron    | [cont-init.d] 40-set-env-vars: exited 0.
viseron    | [cont-init.d] 50-check-if-rpi: executing... 
viseron    | ********** Checking if we are running on an RPi **********
viseron    | Not running on any supported RPi
viseron    | *********************** Done *****************************
viseron    | [cont-init.d] 50-check-if-rpi: exited 0.
viseron    | [cont-init.d] done.
viseron    | [services.d] starting services
viseron    | [services.d] done.
viseron    | [2021-06-08 19:01:50] [INFO    ] [viseron                 ] - -------------------------------------------
viseron    | [2021-06-08 19:01:50] [INFO    ] [viseron                 ] - Initializing...
viseron    | [2021-06-08 19:01:50] [DEBUG   ] [viseron.watchdog        ] - Starting scheduler
viseron    | [2021-06-08 19:01:50] [DEBUG   ] [viseron                 ] - Starting cleanup scheduler
viseron    | [2021-06-08 19:01:50] [DEBUG   ] [viseron                 ] - Running initial cleanup
viseron    | [2021-06-08 19:01:50] [DEBUG   ] [viseron.cleanup         ] - Running cleanup
viseron    | [2021-06-08 19:01:50] [INFO    ] [viseron.mqtt            ] - Initializing MQTT connection
viseron    | [2021-06-08 19:01:50] [DEBUG   ] [viseron.mqtt            ] - MQTT connected with returncode 0
viseron    | [2021-06-08 19:01:50] [DEBUG   ] [viseron.detector        ] - Initializing object detector darknet
viseron    | [2021-06-08 19:01:51] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f60a880a0>
viseron    | [2021-06-08 19:01:51] [DEBUG   ] [viseron.detector        ] - Object detector initialized
viseron    | [2021-06-08 19:01:51] [INFO    ] [viseron                 ] - Initializing NVR threads
viseron    | [2021-06-08 19:01:51] [DEBUG   ] [viseron.nvr.foyer       ] - Initializing NVR thread
viseron    | [2021-06-08 19:01:51] [DEBUG   ] [viseron.camera.foyer    ] - Initializing camera Foyer
viseron    | [2021-06-08 19:01:51] [DEBUG   ] [viseron.camera.stream.foyer] - Getting stream information for rtsp://*****:*****@192.168.0.88:554/cam/realmonitor?channel=17@subtype=1
viseron    | [2021-06-08 19:01:54] [DEBUG   ] [viseron.camera.stream.foyer] - Stream information from FFprobe: Width: 704 Height: 576 FPS: 20.0 Video Codec: h264 Audio Codec: None
viseron    | Exception in thread setup.Foyer:
viseron    | Traceback (most recent call last):
viseron    |   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
viseron    |     self.run()
viseron    |   File "/src/viseron/__init__.py", line 144, in run
viseron    |     FFMPEGNVR(camera_config, self._detector)
viseron    |   File "/src/viseron/nvr.py", line 125, in __init__
viseron    |     self.camera = FFMPEGCamera(config, detector)
viseron    |   File "/src/viseron/camera/__init__.py", line 34, in __init__
viseron    |     self.initialize_camera(detector)
viseron    |   File "/src/viseron/camera/__init__.py", line 52, in initialize_camera
viseron    |     self._segments = Stream(
viseron    |   File "/src/viseron/camera/stream.py", line 58, in __init__
viseron    |     or not self.stream_config.audio_codec
viseron    | AttributeError: 'CameraConfig' object has no attribute 'audio_codec'
viseron    | [2021-06-08 19:01:54] [INFO    ] [viseron                 ] - Initialization complete
viseron    | [cont-finish.d] executing container finish scripts...
viseron    | [cont-finish.d] done.
viseron    | [s6-finish] waiting for services.
viseron    | [s6-finish] sending all processes the TERM signal.
viseron    | [s6-finish] sending all processes the KILL signal and exiting.

Something to do with audio codec?

roflcoopter commented 3 years ago

@eldadh Seems some packages are missing, just pushed a new verison with nvidia-l4t-core installed from apt

@weitheng Yes Viseron started up succesfully for you which is good news, but its not utilizing the hardware accelerated decoder h264_nvmpi, thats why you and eldadh are getting different results. Right now you have to add codec: h264_nvmpi manually but when im done it will be selected automatically. You should not specify audio_codec

l-maia commented 3 years ago

Something to do with audio codec? Yes.

The generated ffmpeg command is : -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://****:*****@192.168.1.2:554/Streaming/Channels/602/ -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /segments/Campainha/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1

Which returns:

[mp4 @ 0x55a11d93d0] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:1 --

Some cameras specify an audio channel (ex: doorbells)

If you set to ignore the audio track using -an it works as expected: like: ... copy -c:a copy -an /segments/ ...

weitheng commented 3 years ago

@eldadh Seems some packages are missing, just pushed a new verison with nvidia-l4t-core installed from apt

@weitheng Yes Viseron started up succesfully for you which is good news, but its not utilizing the hardware accelerated decoder h264_nvmpi, thats why you and eldadh are getting different results. Right now you have to add codec: h264_nvmpi manually but when im done it will be selected automatically. You should not specify audio_codec

Hmm, but I did include it in my config just now.

mqtt:
  broker: 192.168.0.87
  port: 1883
  client_id: viseron
  username: XXXX
  password: XXXX

cameras:
  - name: Foyer
    mqtt_name: viseron_foyer
    host: 192.168.0.88
    port: 554
    username: XXXX
    password: XXXX
    path: /cam/realmonitor?channel=17@subtype=0
    width: 1920
    height: 1080
    fps: 5
    motion_detection:
      interval: 1
      trigger_detector: false
    object_detection:
      interval: 1
      labels:
        - label: person
          confidence: 0.9
    substream:
      port: 554
      path: /cam/realmonitor?channel=17@subtype=1
      fps: 3
      width: 704
      height: 576
    codec: h264_nvmpi

logging:
  level: debug
weitheng commented 3 years ago

Something to do with audio codec? Yes.

The generated ffmpeg command is : -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://****:*****@192.168.1.2:554/Streaming/Channels/602/ -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /segments/Campainha/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1

Which returns:

[mp4 @ 0x55a11d93d0] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:1 --

Some cameras specify an audio channel (ex: doorbells)

If you set to ignore the audio track using -an it works as expected: like: ... copy -c:a copy -an /segments/ ...

Silly question here, how do I do that using docker compose?

roflcoopter commented 3 years ago

Something to do with audio codec? Yes.

The generated ffmpeg command is : -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://****:*****@192.168.1.2:554/Streaming/Channels/602/ -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /segments/Campainha/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1 Which returns: [mp4 @ 0x55a11d93d0] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:1 -- Some cameras specify an audio channel (ex: doorbells) If you set to ignore the audio track using -an it works as expected: like: ... copy -c:a copy -an /segments/ ...

Silly question here, how do I do that using docker compose?

You shouldnt have to do that, your camera does not have an audio output so no audio will be recorded

weitheng commented 3 years ago

Something to do with audio codec? Yes.

The generated ffmpeg command is : -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://****:*****@192.168.1.2:554/Streaming/Channels/602/ -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /segments/Campainha/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1 Which returns: [mp4 @ 0x55a11d93d0] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:1 -- Some cameras specify an audio channel (ex: doorbells) If you set to ignore the audio track using -an it works as expected: like: ... copy -c:a copy -an /segments/ ...

Silly question here, how do I do that using docker compose?

You shouldnt have to do that, your camera does not have an audio output so no audio will be recorded

Hmm, but it doesn't seem to be running now. What could be the problem then?

roflcoopter commented 3 years ago

Need to see a log to know whats going on, but if you are running with codec: h264_nvmpi you need to pull the image again and recreate the container.

l-maia commented 3 years ago

Something to do with audio codec? Yes.

The generated ffmpeg command is : -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://****:*****@192.168.1.2:554/Streaming/Channels/602/ -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /segments/Campainha/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1 Which returns: [mp4 @ 0x55a11d93d0] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:1 -- Some cameras specify an audio channel (ex: doorbells) If you set to ignore the audio track using -an it works as expected: like: ... copy -c:a copy -an /segments/ ...

Silly question here, how do I do that using docker compose?

You shouldnt have to do that, your camera does not have an audio output so no audio will be recorded

It does have an output. Some vendors even have an silent audio channel output.

roflcoopter commented 3 years ago

@l-maia Sorry for the confusion, weitheng does not have an audio stream from his camera as indicated by the log

viseron    | [2021-06-08 19:01:54] [DEBUG   ] [viseron.camera.stream.foyer] - Stream information from FFprobe: Width: 704 Height: 576 FPS: 20.0 Video Codec: h264 Audio Codec: None
eldadh commented 3 years ago

[2021-06-08 11:56:21] [INFO ] [viseron ] - ------------------------------------------- [2021-06-08 11:56:21] [INFO ] [viseron ] - Initializing... [2021-06-08 11:56:21] [DEBUG ] [viseron.watchdog ] - Starting scheduler [2021-06-08 11:56:21] [DEBUG ] [viseron ] - Starting cleanup scheduler [2021-06-08 11:56:21] [DEBUG ] [viseron ] - Running initial cleanup [2021-06-08 11:56:21] [DEBUG ] [viseron.cleanup ] - Running cleanup [2021-06-08 11:56:21] [INFO ] [viseron.mqtt ] - Initializing MQTT connection [2021-06-08 11:56:21] [DEBUG ] [viseron.detector ] - Initializing object detector darknet [2021-06-08 11:56:23] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0, message repeated 2 times [2021-06-08 11:56:24] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f352e4640> [2021-06-08 11:56:24] [DEBUG ] [viseron.detector ] - Object detector initialized [2021-06-08 11:56:24] [INFO ] [viseron ] - Initializing NVR threads [2021-06-08 11:56:24] [DEBUG ] [viseron.nvr.entrance ] - Initializing NVR thread [2021-06-08 11:56:24] [DEBUG ] [viseron.camera.entrance ] - Initializing camera Entrance [2021-06-08 11:56:24] [DEBUG ] [viseron.camera.stream.entrance] - Getting stream information for rtsp://:@192.168.3.82:8554/unicast [2021-06-08 11:56:29] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0, message repeated 3 times [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.stream.entrance] - Stream information from FFprobe: Width: 1920 Height: 1080 FPS: 25.0 Video Codec: h264 Audio Codec: None [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.entrance ] - Resolution: 1920x1080 @ 25.0 FPS [2021-06-08 11:56:30] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/decode/object, <queue.Queue object at 0x7f35b13430> [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.entrance ] - Starting decoder thread [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.entrance ] - Running decoder entrance.object_detection at 1.0s interval, every 25.0 frame(s) [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.entrance ] - Camera Entrance initialized [2021-06-08 11:56:30] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/processed/object, <queue.Queue object at 0x7f352e44c0> [2021-06-08 11:56:30] [DEBUG ] [viseron.motion.entrance ] - Initializing motion detector [2021-06-08 11:56:30] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/decode/motion, <queue.Queue object at 0x7f3403e340> [2021-06-08 11:56:30] [DEBUG ] [viseron.motion.entrance ] - Starting decoder thread [2021-06-08 11:56:30] [DEBUG ] [viseron.motion.entrance ] - Running decoder entrance.motion_detection at 1.0s interval, every 25.0 frame(s) [2021-06-08 11:56:30] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/scan/motion, <queue.Queue object at 0x7f352f2eb0> [2021-06-08 11:56:30] [DEBUG ] [viseron.motion.entrance ] - Motion detector initialized [2021-06-08 11:56:30] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/processed/motion, <queue.Queue object at 0x7f352f2df0> [2021-06-08 11:56:30] [DEBUG ] [viseron.nvr.entrance ] - Starting camera [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.entrance ] - Starting capture thread [2021-06-08 11:56:30] [DEBUG ] [viseron.recorder.entrance] - Initializing ffmpeg recorder [2021-06-08 11:56:30] [DEBUG ] [viseron.camera.stream.entrance] - FFMPEG decoder command: entrance -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://:@192.168.3.82:8554/unicast -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy /segments/Entrance/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1 [2021-06-08 11:56:30] [DEBUG ] [viseron.recorder.entrance] - Creating folder /segments/Entrance [2021-06-08 11:56:30] [DEBUG ] [viseron.nvr.entrance ] - Waiting for first frame [2021-06-08 11:56:30] [DEBUG ] [viseron.nvr.entrance ] - NVR thread initialized [2021-06-08 11:56:30] [INFO ] [viseron ] - Initialization complete [2021-06-08 11:56:31] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-08 11:56:33] [ERROR ] [viseron.camera.stream.entrance] - Failed to query video capabilities: Inappropriate ioctl for device [2021-06-08 11:56:33] [ERROR ] [viseron.camera.stream.entrance] - libv4l2: error getting capabilities: Inappropriate ioctl for device [2021-06-08 11:56:33] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-08 11:56:33] [ERROR ] [viseron.camera.entrance ] - FFmpeg process has exited [2021-06-08 11:56:37] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0, message repeated 2 times [2021-06-08 11:56:38] [ERROR ] [viseron.camera.entrance ] - Restarting frame pipe [2021-06-08 11:56:38] [DEBUG ] [viseron.camera.stream.entrance] - Performing a sanity check on the ffmpeg command [2021-06-08 11:56:39] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-08 11:56:41] [ERROR ] [viseron.camera.stream.entrance] - Error starting decoder command! Failed to query video capabilities: Inappropriate ioctl for device libv4l2: error getting capabilities: Inappropriate ioctl for device Retrying in 5 seconds [2021-06-08 11:56:47] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0, message repeated 4 times [2021-06-08 11:56:49] [ERROR ] [viseron.camera.stream.entrance] - Error starting decoder command! Failed to query video capabilities: Inappropriate ioctl for device libv4l2: error getting capabilities: Inappropriate ioctl for device Retrying in 5 seconds [2021-06-08 11:56:53] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0, message repeated 3 times

roflcoopter commented 3 years ago

@eldadh can you enable FFmpeg debug logging? Add this to your camera config:

    ffmpeg_loglevel: debug
eldadh commented 3 years ago

[2021-06-08 12:13:30] [INFO ] [viseron ] - ------------------------------------------- [2021-06-08 12:13:30] [INFO ] [viseron ] - Initializing... [2021-06-08 12:13:30] [DEBUG ] [viseron.watchdog ] - Starting scheduler [2021-06-08 12:13:30] [DEBUG ] [viseron ] - Starting cleanup scheduler [2021-06-08 12:13:30] [DEBUG ] [viseron ] - Running initial cleanup [2021-06-08 12:13:30] [DEBUG ] [viseron.cleanup ] - Running cleanup [2021-06-08 12:13:30] [INFO ] [viseron.mqtt ] - Initializing MQTT connection [2021-06-08 12:13:30] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-08 12:13:30] [DEBUG ] [viseron.detector ] - Initializing object detector darknet [2021-06-08 12:13:31] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f4f1e0250> [2021-06-08 12:13:31] [DEBUG ] [viseron.detector ] - Object detector initialized [2021-06-08 12:13:31] [INFO ] [viseron ] - Initializing NVR threads [2021-06-08 12:13:31] [DEBUG ] [viseron.nvr.entrance ] - Initializing NVR thread [2021-06-08 12:13:31] [DEBUG ] [viseron.camera.entrance ] - Initializing camera Entrance [2021-06-08 12:13:31] [DEBUG ] [viseron.camera.stream.entrance] - Getting stream information for rtsp://:@192.168.3.82:8554/unicast [2021-06-08 12:13:34] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0, message repeated 2 times [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Stream information from FFprobe: Width: 1920 Height: 1080 FPS: 25.0 Video Codec: h264 Audio Codec: None [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.entrance ] - Resolution: 1920x1080 @ 25.0 FPS [2021-06-08 12:13:35] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/decode/object, <queue.Queue object at 0x7f4f1d4880> [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.entrance ] - Starting decoder thread [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.entrance ] - Running decoder entrance.object_detection at 1.0s interval, every 25.0 frame(s) [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.entrance ] - Camera Entrance initialized [2021-06-08 12:13:35] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/processed/object, <queue.Queue object at 0x7f4f1e0d30> [2021-06-08 12:13:35] [DEBUG ] [viseron.motion.entrance ] - Initializing motion detector [2021-06-08 12:13:35] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/decode/motion, <queue.Queue object at 0x7f4c06deb0> [2021-06-08 12:13:35] [DEBUG ] [viseron.motion.entrance ] - Starting decoder thread [2021-06-08 12:13:35] [DEBUG ] [viseron.motion.entrance ] - Running decoder entrance.motion_detection at 1.0s interval, every 25.0 frame(s) [2021-06-08 12:13:35] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/scan/motion, <queue.Queue object at 0x7f4c06da60> [2021-06-08 12:13:35] [DEBUG ] [viseron.motion.entrance ] - Motion detector initialized [2021-06-08 12:13:35] [DEBUG ] [viseron.data_stream ] - Subscribing to data topic entrance/frame/processed/motion, <queue.Queue object at 0x7f4c06d880> [2021-06-08 12:13:35] [DEBUG ] [viseron.nvr.entrance ] - Starting camera [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.entrance ] - Starting capture thread [2021-06-08 12:13:35] [DEBUG ] [viseron.recorder.entrance] - Initializing ffmpeg recorder [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - FFMPEG decoder command: entrance -hide_banner -loglevel debug -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -stimeout 5000000 -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://:@192.168.3.82:8554/unicast -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy /segments/Entrance/%Y%m%d%H%M%S.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1 [2021-06-08 12:13:35] [DEBUG ] [viseron.recorder.entrance] - Creating folder /segments/Entrance [2021-06-08 12:13:35] [DEBUG ] [viseron.nvr.entrance ] - Waiting for first frame [2021-06-08 12:13:35] [DEBUG ] [viseron.nvr.entrance ] - NVR thread initialized [2021-06-08 12:13:35] [INFO ] [viseron ] - Initialization complete [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Splitting the commandline. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-avoid_negative_ts' ... matched as AVOption 'avoid_negative_ts' with argument 'make_zero'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-fflags' ... matched as AVOption 'fflags' with argument 'nobuffer'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-flags' ... matched as AVOption 'flags' with argument 'low_delay'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-strict' ...Routing option strict to both codec and muxer layer [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - matched as AVOption 'strict' with argument 'experimental'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+genpts'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-vsync' ... matched as option 'vsync' (video sync method) with argument '0'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-stimeout' ... matched as AVOption 'stimeout' with argument '5000000'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_nvmpi'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-i' ... matched as input url with argument 'rtsp://:@192.168.3.82:8554/unicast'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-f' ... matched as option 'f' (force format) with argument 'segment'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-segment_time' ... matched as AVOption 'segment_time' with argument '5'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-reset_timestamps' ... matched as AVOption 'reset_timestamps' with argument '1'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-strftime' ... matched as AVOption 'strftime' with argument '1'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '/segments/Entrance/%Y%m%d%H%M%S.mp4' ... matched as output url. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-filter:v' ... matched as option 'filter' (set stream filtergraph) with argument 'fps=1'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'nv12'. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Reading option 'pipe:1' ... matched as output url. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Finished splitting the commandline. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Parsing a group of options: global . [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Applying option hide_banner (do not show program banner) with argument 1. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Applying option loglevel (set logging level) with argument debug. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Applying option vsync (video sync method) with argument 0. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Successfully parsed a group of options. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Parsing a group of options: input url rtsp://:@192.168.3.82:8554/unicast. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Applying option c:v (codec name) with argument h264_nvmpi. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Successfully parsed a group of options. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Opening an input file: rtsp://:@192.168.3.82:8554/unicast. [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] No default whitelist set [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] Original list of addresses: [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] Address 192.168.3.82 port 8554 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] Interleaved list of addresses: [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] Address 192.168.3.82 port 8554 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] Starting connection attempt to 192.168.3.82 port 8554 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [tcp @ 0x557e8f2f60] Successfully connected to 192.168.3.82 port 8554 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] SDP: [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - v=0 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - o=- 1621115070442031 1 IN IP4 192.168.3.82 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - s=LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - i=LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - t=0 0 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=tool:LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=type:broadcast [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=control:* [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=range:npt=0- [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=x-qt-text-nam:LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=x-qt-text-inf:LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - m=video 0 RTP/AVP 96 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - c=IN IP4 0.0.0.0 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - b=AS:168 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=rtpmap:96 H264/90000 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=fmtp:96 profile-level-id=4d4028;sprop-parameter-sets=Z01AKJ2oHgCJ+WEAAAMAAQAAAwAyhA==,aO48gA== [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=x-dimensions:1920,1080 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - a=control:track1 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - Failed to parse interval end specification '' [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] video codec set to: h264 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] RTP Profile IDC: 4d Profile IOP: 40 Level: 28 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] Extradata set to 0x557e8f4370 (size: 34) [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] setting jitter buffer size to 0 [2021-06-08 12:13:35] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] hello state=0 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - Failed to parse interval end specification '' [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 7(SPS), nal_ref_idc: 3 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 8(PPS), nal_ref_idc: 3 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 7(SPS), nal_ref_idc: 3 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 8(PPS), nal_ref_idc: 3 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] Format yuv420p chosen by get_format(). [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] Reinit context to 1920x1088, pix_fmt: yuv420p [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] Frame num gap 5 3 [2021-06-08 12:13:36] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Last message repeated 18 times [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 7(SPS), nal_ref_idc: 3 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 8(PPS), nal_ref_idc: 3 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 7(SPS), nal_ref_idc: 3 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 8(PPS), nal_ref_idc: 3 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 5(IDR), nal_ref_idc: 3 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264 @ 0x557e8f3460] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] All info found [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 9.750000 0.015298 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Last message repeated 1 times [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Last message repeated 1 times [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 10.000000 0.003346 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 10.083333 0.008698 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 10.166667 0.018717 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 19.750000 0.016283 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 19.833333 0.010649 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Last message repeated 1 times [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 20.000000 0.013384 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 40.000000 0.019512 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [rtsp @ 0x557e8f2570] rfps: 50.000000 0.018620 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Input #0, rtsp, from 'rtsp://:@192.168.3.82:8554/unicast': [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Metadata: [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - title : LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - comment : LIVE555 Streaming Media v2020.05.15 [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Duration: N/A, start: 1623154416.139233, bitrate: N/A [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Stream #0:0, 22, 1/90000: Video: h264, 1 reference frame, yuv420p(progressive, left), 1920x1080 (1920x1088), 0/1, 25 fps, 9.92 tbr, 90k tbn, 50 tbc [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Successfully opened the file. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Parsing a group of options: output url /segments/Entrance/%Y%m%d%H%M%S.mp4. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Applying option f (force format) with argument segment. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Applying option c:v (codec name) with argument copy. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Successfully parsed a group of options. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Opening an output file: /segments/Entrance/%Y%m%d%H%M%S.mp4. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Successfully opened the file. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Parsing a group of options: output url pipe:1. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Applying option filter:v (set stream filtergraph) with argument fps=1. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Applying option f (force format) with argument rawvideo. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Applying option pix_fmt (set pixel format) with argument nv12. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Successfully parsed a group of options. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Opening an output file: pipe:1. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [pipe @ 0x557e92fcb0] Setting default whitelist 'crypto,data' [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Successfully opened the file. [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - [h264_mp4toannexb @ 0x557e8f0c40] The input looks like it is Annex B already [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - Failed to query video capabilities: Inappropriate ioctl for device [2021-06-08 12:13:38] [DEBUG ] [viseron.camera.stream.entrance] - libv4l2: error getting capabilities: Inappropriate ioctl for device [2021-06-08 12:13:38] [DEBUG ] [viseron.mqtt ] - MQTT connected with returncode 0 [2021-06-08 12:13:38] [ERROR ] [viseron.camera.entrance ] - FFmpeg process has exited

weitheng commented 3 years ago

Need to see a log to know whats going on, but if you are running with codec: h264_nvmpi you need to pull the image again and recreate the container.

Pulled the updated image, and included codec: h264_nvmpi in both mainstream and substream fields.

cameras:
  - name: Foyer
    mqtt_name: viseron_foyer
    host: 192.168.0.88
    port: 554
    username: XXXX
    password: XXXX
    path: /cam/realmonitor?channel=17@subtype=0
    width: 1920
    height: 1080
    fps: 5
    codec: h264_nvmpi
    ffmpeg_loglevel: debug
    motion_detection:
      interval: 1
      trigger_detector: false
    object_detection:
      interval: 1
      labels:
        - label: person
          confidence: 0.9
    substream:
      port: 554
      path: /cam/realmonitor?channel=17@subtype=1
      fps: 3
      width: 704
      height: 576
      codec: h264_nvmpi

Here's the docker logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 10-adduser: executing... 
************************ UID/GID *************************
User uid:    0
User gid:    0
************************** Done **************************
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-gid-video-device: executing... 
[cont-init.d] 20-gid-video-device: exited 0.
[cont-init.d] 30-edgetpu-permission: executing... 
************** Setting EdgeTPU permissions ***************
Coral Vendor IDs:
"1a6e"
"18d1"
No EdgeTPU USB device was found
************************** Done **************************
[cont-init.d] 30-edgetpu-permission: exited 0.
[cont-init.d] 40-set-env-vars: executing... 
****** Checking for hardware acceleration platforms ******
OpenCL cannot be used
VA-API cannot be used
CUDA cannot be used
*********************** Done *****************************
[cont-init.d] 40-set-env-vars: exited 0.
[cont-init.d] 50-check-if-rpi: executing... 
********** Checking if we are running on an RPi **********
Not running on any supported RPi
*********************** Done *****************************
[cont-init.d] 50-check-if-rpi: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2021-06-08 20:24:12] [INFO    ] [viseron                 ] - -------------------------------------------
[2021-06-08 20:24:12] [INFO    ] [viseron                 ] - Initializing...
[2021-06-08 20:24:12] [DEBUG   ] [viseron.watchdog        ] - Starting scheduler
[2021-06-08 20:24:12] [DEBUG   ] [viseron                 ] - Starting cleanup scheduler
[2021-06-08 20:24:12] [DEBUG   ] [viseron                 ] - Running initial cleanup
[2021-06-08 20:24:12] [DEBUG   ] [viseron.cleanup         ] - Running cleanup
[2021-06-08 20:24:12] [INFO    ] [viseron.mqtt            ] - Initializing MQTT connection
[2021-06-08 20:24:12] [DEBUG   ] [viseron.mqtt            ] - MQTT connected with returncode 0
[2021-06-08 20:24:12] [DEBUG   ] [viseron.detector        ] - Initializing object detector darknet
[2021-06-08 20:24:13] [DEBUG   ] [viseron.data_stream     ] - Subscribing to data topic */frame/scan/object, <queue.Queue object at 0x7f582041c0>
[2021-06-08 20:24:13] [DEBUG   ] [viseron.detector        ] - Object detector initialized
[2021-06-08 20:24:13] [INFO    ] [viseron                 ] - Initializing NVR threads
[2021-06-08 20:24:13] [DEBUG   ] [viseron.nvr.foyer       ] - Initializing NVR thread
[2021-06-08 20:24:13] [DEBUG   ] [viseron.camera.foyer    ] - Initializing camera Foyer
Exception in thread setup.Foyer:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/src/viseron/__init__.py", line 144, in run
    FFMPEGNVR(camera_config, self._detector)
  File "/src/viseron/nvr.py", line 125, in __init__
    self.camera = FFMPEGCamera(config, detector)
  File "/src/viseron/camera/__init__.py", line 34, in __init__
    self.initialize_camera(detector)
  File "/src/viseron/camera/__init__.py", line 46, in initialize_camera
    self.stream = Stream(
  File "/src/viseron/camera/stream.py", line 58, in __init__
    or not self.stream_config.audio_codec
AttributeError: 'Substream' object has no attribute 'audio_codec'
[2021-06-08 20:24:13] [INFO    ] [viseron                 ] - Initialization complete
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
roflcoopter commented 3 years ago

@eldadh Okay there seems to be something wrong with the ffmpeg install that i dont know how to fix.

I need to take a step back and start over with some other base images. Building is really slow so it will probably take a few days

l-maia commented 3 years ago

I have checked the info from my rtsp stream that is working and i have two main differences,my camera is yuvj420p with a resolution of 1280x720. I seem to remember that previous versions of the ffmpeg patches had problems working with some not so standard resolutions.

@eldadh is it possible for you to drop the resolution in the camera to check if it has any impact (like 1280x720) ? And check with something like : sudo docker run --privileged -it --rm --runtime=nvidia roflcoopter/jetson-nano-ffmpeg:4.4 ffmpeg -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://admin:***@192.168.1.2:554/Streaming/Channels/601/ -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy -an /tmp/garbage.mp4 -filter:v fps=1 -f rawvideo -pix_fmt nv12 pipe:1

roflcoopter commented 3 years ago

Ahh interesting @l-maia! I didnt realize FFmpeg worked for you.

It could also be related to -pix_fmt nv12 actually.

@eldadh can you try this?

sudo docker run --privileged -it --rm --runtime=nvidia roflcoopter/jetson-nano-ffmpeg:4.4 ffmpeg -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://username:password@192.168.3.82:8554/unicast -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy -an /tmp/garbage.mp4 -filter:v fps=1 -f rawvideo pipe:1
eldadh commented 3 years ago

Working but very low FPS

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested ffmpeg version 8d172d9 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) configuration: --enable-nvmpi libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 Input #0, rtsp, from 'rtsp://:@192.168.3.80:8554/unicast': Metadata: title : LIVE555 Streaming Media v2020.05.15 comment : LIVE555 Streaming Media v2020.05.15 Duration: N/A, start: 2.260033, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 25 fps, 10 tbr, 90k tbn, 50 tbc Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 261 NVMEDIA: Reading vendor.tegra.display-size : status: 6 NvMMLiteBlockCreate : Block : BlockType = 261 Output #0, segment, to '/tmp/garbage.mp4': Metadata: title : LIVE555 Streaming Media v2020.05.15 comment : LIVE555 Streaming Media v2020.05.15 encoder : Lavf58.76.100 Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, q=2-31, 25 fps, 10 tbr, 12800 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:0 -> #1:0 (h264 (h264_nvmpi) -> rawvideo (native)) Press [q] to stop, [?] for help Output #1, rawvideo, to 'pipe:1': Metadata: title : LIVE555 Streaming Media v2020.05.15 comment : LIVE555 Streaming Media v2020.05.15 encoder : Lavf58.76.100 Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 1280x720, q=2-31, 11059 kb/s, 1 fps, 1 tbn Metadata: encoder : Lavc58.134.100 rawvideo frame= 24 fps=1.9 q=-1.0 q=-0.0 size=N/A time=00:00:01.64 bitrate=N/A speed=0.133x

roflcoopter commented 3 years ago

Yes it is capped at 1 FPS in the command, you can try this instead:

sudo docker run --privileged -it --rm --runtime=nvidia roflcoopter/jetson-nano-ffmpeg:4.4 ffmpeg -c:v h264_nvmpi -rtsp_transport tcp -i rtsp://username:password@192.168.3.82:8554/unicast -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy -an /tmp/garbage.mp4 -f rawvideo pipe:1
l-maia commented 3 years ago

Working but very low FPS

remove fps=1 , sorry i left it there from the my tests.

i'm getting 23fps