Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gstreamer // ffmpeg #739

Closed
pathia opened this issue May 2, 2024 · 28 comments
Closed

gstreamer // ffmpeg #739

pathia opened this issue May 2, 2024 · 28 comments

Comments

@pathia
Copy link

pathia commented May 2, 2024

I'm using a Jetson Nano and I read that I need to use GStreamer for hardware offloading. But I cannot get the recordings to work.

The documentation states "As of now the gstreamer integration uses FFmpeg to create recordings when an object is detected and FFprobe to read stream information. Therefore, if you make changes to the recorder config you should keep in mind that it is in FFmpeg syntax."
I don't understand what I actually need to do for the recordings to work with GStreamer.
It is also not mentioned in the example config on the top of the page.
Thanks!

@roflcoopter
Copy link
Owner

Sorry thought i replied to this but must've missed to publish.
You should not have to change anything in order for it to work.

The documentation is there just to hint that if you need to set some output filters on the recordings, it has to be FFmpeg commands and not GStreamer commands.

Are you having any issues or do you need to set parameters on the recording?

@pathia
Copy link
Author

pathia commented May 7, 2024

Well, I have trouble setting up on my Jetson Nano.
This is my docker-compose.yaml:

  viseron:
    image: roflcoopter/jetson-nano-viseron:latest
    restart: always
    container_name: viseron
    volumes:
      - ./storage/recordings:/recordings
      - ./storage/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /tmp/argus_socket:/tmp/argus_socket
    ports:
      - 80:8888
    runtime: nvidia
    privileged: true

This is my configuration:

gstreamer:
  camera:
    patscam:
      name: patscam Reolink
      host: 192.168.3.2
      port: 554
      path: /Preview_01_main
      username: admin
      password: somepassword
      recorder:
        idle_timeout: 5

mog2:
  motion_detector:
    cameras:
      patscam:
        fps: 10
        trigger_recorder: true

nvr:
  patscam:

And this is the log output:

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  | No EdgeTPU PCI 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 is available!
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] 55-check-if-jetson: executing... 
viseron  | ****** Checking if we are running on a Jetson Board ******
viseron  | Running on a Jetson Nano
viseron  | *********************** Done *****************************
viseron  | [cont-init.d] 55-check-if-jetson: exited 0.
viseron  | [cont-init.d] 60-ffmpeg-path: executing... 
viseron  | ****************** Getting FFmpeg path *******************
viseron  | FFmpeg path: /usr/bin/ffmpeg
viseron  | *********************** Done *****************************
viseron  | [cont-init.d] 60-ffmpeg-path: exited 0.
viseron  | [cont-init.d] 70-gstreamer-path: executing... 
viseron  | ***************** Getting GStreamer path *****************
viseron  | GStreamer path: /usr/bin/gst-launch-1.0
viseron  | *********************** Done *****************************
viseron  | [cont-init.d] 70-gstreamer-path: exited 0.
viseron  | [cont-init.d] done.
viseron  | [services.d] starting services
viseron  | [services.d] done.
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.core] - -------------------------------------------
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.core] - Initializing Viseron
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setting up component data_stream
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setup of component data_stream took 0.0 seconds
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setting up component webserver
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setup of component webserver took 0.0 seconds
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setting up component gstreamer
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setting up component mog2
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setting up component nvr
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setup of component nvr took 0.0 seconds
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setup of component mog2 took 0.0 seconds
viseron  | [2024-05-07 20:35:25] [INFO    ] [viseron.components] - Setup of component gstreamer took 0.0 seconds
viseron  | [2024-05-07 20:35:26] [INFO    ] [viseron.components] - Setting up domain camera for component gstreamer with identifier patscam
viseron  | [2024-05-07 20:35:26] [INFO    ] [viseron.components] - Setting up domain motion_detector for component mog2 with identifier patscam
viseron  | [2024-05-07 20:35:26] [INFO    ] [viseron.components] - Setting up domain nvr for component nvr with identifier patscam
viseron  | [2024-05-07 20:35:29] [INFO    ] [viseron.components] - Setup of domain camera for component gstreamer with identifier patscam took 3.1 seconds
viseron  | [2024-05-07 20:35:29] [INFO    ] [viseron.components] - Setup of domain motion_detector for component mog2 with identifier patscam took 0.0 seconds
viseron  | [2024-05-07 20:35:29] [INFO    ] [viseron.components.nvr.nvr.patscam] - Object detector is disabled
viseron  | [2024-05-07 20:35:29] [INFO    ] [viseron.components.nvr.nvr.patscam] - NVR for camera patscam Reolink initialized
viseron  | [2024-05-07 20:35:29] [INFO    ] [viseron.components] - Setup of domain nvr for component nvr with identifier patscam took 0.0 seconds
viseron  | [2024-05-07 20:35:29] [INFO    ] [viseron.core] - Viseron initialized in 3.9 seconds
viseron  | Opening in BLOCKING MODE 
viseron  | NvMMLiteOpen : Block : BlockType = 261 
viseron  | NVMEDIA: Reading vendor.tegra.display-size : status: 6 
viseron  | NvMMLiteBlockCreate : Block : BlockType = 261 
viseron  | Stream format not found, dropping the frame
viseron  | Stream format not found, dropping the frame
viseron  | [2024-05-07 20:35:32] [INFO    ] [viseron.components.gstreamer.recorder.patscam] - Starting recorder
viseron  | [2024-05-07 20:35:33] [INFO    ] [viseron.components.nvr.nvr.patscam] - Stopping recording in: 4
viseron  | [2024-05-07 20:36:40] [ERROR   ] [viseron.components.gstreamer.camera.patscam] - Timeout waiting for frame
viseron  | [2024-05-07 20:36:50] [INFO    ] [viseron.components.gstreamer.recorder.patscam] - Stopping recorder
viseron  | [2024-05-07 20:36:55] [ERROR   ] [viseron.watchdog.thread_watchdog] - Failed to stop thread. Make sure poll_target ends the thread
viseron  | [2024-05-07 20:36:55] [ERROR   ] [viseron.watchdog.thread_watchdog] - Thread viseron.camera.patscam is dead, restarting
viseron  | [2024-05-07 20:37:02] [ERROR   ] [viseron.components.gstreamer.recorder.patscam] - Could not get duration for: /segments/patscam/20240507203531.mp4. Error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5591c80bf0] moov atom not found
viseron  | /segments/patscam/20240507203531.mp4: Invalid data found when processing input
viseron  | 
viseron  | [2024-05-07 20:37:02] [ERROR   ] [viseron.components.gstreamer.recorder.patscam] - No segments were found

@pathia
Copy link
Author

pathia commented May 12, 2024

@roflcoopter is there any debug logging I could do to get this solved? Thanks

@roflcoopter
Copy link
Owner

A quick google didnt yield any good results sadly.

You can enable debug logs this way:

logger:
  default_level: debug

The GStreamer command might have to be tweaked a little to work with that camera, just have to figure out what!

@pathia
Copy link
Author

pathia commented May 13, 2024

Ok thanks, I now have debug logging:

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  | No EdgeTPU PCI 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 is available!
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] 55-check-if-jetson: executing... 
viseron  | ****** Checking if we are running on a Jetson Board ******
viseron  | Running on a Jetson Nano
viseron  | *********************** Done *****************************
viseron  | [cont-init.d] 55-check-if-jetson: exited 0.
viseron  | [cont-init.d] 60-ffmpeg-path: executing... 
viseron  | ****************** Getting FFmpeg path *******************
viseron  | FFmpeg path: /usr/bin/ffmpeg
viseron  | *********************** Done *****************************
viseron  | [cont-init.d] 60-ffmpeg-path: exited 0.
viseron  | [cont-init.d] 70-gstreamer-path: executing... 
viseron  | ***************** Getting GStreamer path *****************
viseron  | GStreamer path: /usr/bin/gst-launch-1.0
viseron  | *********************** Done *****************************
viseron  | [cont-init.d] 70-gstreamer-path: exited 0.
viseron  | [cont-init.d] done.
viseron  | [services.d] starting services
viseron  | [services.d] done.
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.core] - -------------------------------------------
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.core] - Initializing Viseron
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setting up component logger
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setup of component logger took 0.0 seconds
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setting up component data_stream
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [viseron.components.data_stream] - ulimit -u output: unlimited
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [viseron.components.data_stream] - Max threads: 999999
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [viseron.watchdog] - Registering <RestartableThread(data_stream, initial daemon)> in the watchdog
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setup of component data_stream took 0.0 seconds
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setting up component webserver
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [asyncio] - Using selector: EpollSelector
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/domain/registered/camera, <bound method Webserver.camera_registered of <Webserver(Tornado Webserver, initial daemon)>>
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/domain/setup/domain_failed/camera/*, <bound method Webserver.camera_registered of <Webserver(Tornado Webserver, initial daemon)>>
viseron  | [2024-05-13 13:08:08] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic viseron/signal/shutdown, <bound method Webserver.stop of <Webserver(Tornado Webserver, initial daemon)>>
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setup of component webserver took 0.0 seconds
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setting up component mog2
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setting up component gstreamer
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setting up component nvr
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setup of component nvr took 0.0 seconds
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setup of component mog2 took 0.0 seconds
viseron  | [2024-05-13 13:08:08] [INFO    ] [viseron.components] - Setup of component gstreamer took 0.0 seconds
viseron  | [2024-05-13 13:08:09] [INFO    ] [viseron.components] - Setting up domain camera for component gstreamer with identifier patscam
viseron  | [2024-05-13 13:08:09] [INFO    ] [viseron.components] - Setting up domain motion_detector for component mog2 with identifier patscam
viseron  | [2024-05-13 13:08:09] [INFO    ] [viseron.components] - Setting up domain nvr for component nvr with identifier patscam
viseron  | [2024-05-13 13:08:09] [DEBUG   ] [viseron.components] - Domain nvr for component nvr with identifier patscam will wait for dependencies ['domain: camera, identifier: patscam']
viseron  | [2024-05-13 13:08:09] [DEBUG   ] [viseron.components] - Domain nvr for component nvr with identifier patscam will wait for optional dependencies ['domain: motion_detector, identifier: patscam']
viseron  | [2024-05-13 13:08:09] [DEBUG   ] [viseron.components] - Domain motion_detector for component mog2 with identifier patscam will wait for dependencies ['domain: camera, identifier: patscam']
viseron  | [2024-05-13 13:08:09] [DEBUG   ] [viseron.components.gstreamer.stream.patscam] - Getting stream information for rtsp://*****:*****@192.168.3.219:554/Preview_01_main
viseron  | [2024-05-13 13:08:09] [DEBUG   ] [viseron.components.ffmpeg.stream.patscam] - FFprobe command: ffprobe -hide_banner -loglevel error -print_format json -show_error -show_entries stream=codec_type,codec_name,width,height,avg_frame_rate rtsp://*****:*****@192.168.3.219:554/Preview_01_main
viseron  | [2024-05-13 13:08:09] [DEBUG   ] [viseron.components.webserver.websocket_api] - WebSocket opened
viseron  | [2024-05-13 13:08:10] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"subscribe_event","event":"domain/registered/camera","command_id":1}
viseron  | [2024-05-13 13:08:10] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"subscribe_event","event":"*/recorder/complete","command_id":2}
viseron  | [2024-05-13 13:08:10] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/domain/registered/camera, <function subscribe_event.<locals>.forward_event at 0x7f8ce990d0>
viseron  | [2024-05-13 13:08:10] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/*/recorder/complete, <function subscribe_event.<locals>.forward_event at 0x7f8ce99160>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.stream.patscam] - Stream information from FFprobe: Width: 2560 Height: 1920 FPS: 20 Video Codec: h264 Audio Codec: aac
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Connected from component gstreamer
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/camera/status, <bound method ConnectionStatusBinarySensor.handle_event of <viseron.domains.camera.entity.binary_sensor.ConnectionStatusBinarySensor object at 0x7f8cdba100>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_connected to state: off, attributes {'name': 'patscam Reolink Connected', 'domain': 'binary_sensor'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Connection from component gstreamer
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/camera/start, <bound method CameraConnectionToggle.handle_start_event of <viseron.domains.camera.entity.toggle.CameraConnectionToggle object at 0x7f8cdba310>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/camera/stop, <bound method CameraConnectionToggle.handle_stop_event of <viseron.domains.camera.entity.toggle.CameraConnectionToggle object at 0x7f8cdba310>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/camera/started, <bound method CameraConnectionToggle.handle_started_stopped_event of <viseron.domains.camera.entity.toggle.CameraConnectionToggle object at 0x7f8cdba310>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/camera/stopped, <bound method CameraConnectionToggle.handle_started_stopped_event of <viseron.domains.camera.entity.toggle.CameraConnectionToggle object at 0x7f8cdba310>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of toggle.patscam_connection to state: off, attributes {'name': 'patscam Reolink Connection', 'domain': 'toggle'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Access Token from component gstreamer
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_access_token to state: 66e1643fed003b96d63532aa44ff3c0c4722bb32cd4d60e03d867dfea4b4b279a83e977767e53a7a8d655ae7ba2773a973713cd0c8eca039ad99cd93fea01c46, attributes {'name': 'patscam Reolink Access Token', 'domain': 'sensor'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_access_token to state: 49fbfd9161255d6a418cf66e86416f5d2b25e39f9ddb6ca05560ee95f95a7cb2a2b0880d0ee97536628f768182caec5da61c956a95441a17b50605e9f5e35714, attributes {'name': 'patscam Reolink Access Token', 'domain': 'sensor'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.helpers] - Creating folder /recordings/patscam
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Running cleanup
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Recorder from component gstreamer
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/recorder/start, <bound method RecorderBinarySensor.handle_start_event of <viseron.domains.camera.entity.binary_sensor.RecorderBinarySensor object at 0x7f8cd51400>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/recorder/stop, <bound method RecorderBinarySensor.handle_stop_event of <viseron.domains.camera.entity.binary_sensor.RecorderBinarySensor object at 0x7f8cd51400>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_recorder to state: off, attributes {'name': 'patscam Reolink Recorder', 'domain': 'binary_sensor'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Latest Thumbnail from component gstreamer
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/recorder/start, <bound method ThumbnailImage.handle_event of <viseron.domains.camera.entity.image.ThumbnailImage object at 0x7f8cd51730>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of image.patscam_latest_thumbnail to state: unknown, attributes {'name': 'patscam Reolink Latest Thumbnail', 'domain': 'image', 'start_time': None, 'path': None, 'thumbnail_path': None}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Initializing gstreamer recorder
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.helpers] - Creating folder /segments/patscam
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic viseron/signal/shutdown, <bound method SegmentCleanup.shutdown of <viseron.components.ffmpeg.segments.SegmentCleanup object at 0x7f8cd51490>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Initializing camera patscam Reolink
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Resolution: 2560x1920 @ 20 FPS
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Camera patscam Reolink initialized
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.core] - Registering domain camera with identifier patscam
viseron  | [2024-05-13 13:08:12] [INFO    ] [viseron.components] - Setup of domain camera for component gstreamer with identifier patscam took 3.2 seconds
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Motion Detected from component mog2
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/motion_detected, <bound method MotionDetectionBinarySensor.handle_event of <viseron.domains.motion_detector.binary_sensor.MotionDetectionBinarySensor object at 0x7f8cd51670>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_motion_detected to state: off, attributes {'name': 'patscam Reolink Motion Detected', 'domain': 'binary_sensor'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.watchdog] - Registering <RestartableThread(patscam.motion_detection, initial daemon)> in the watchdog
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic motion_detector/patscam/scan, <queue.Queue object at 0x7f8cd59310>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/nvr/motion_detector/scan, <bound method AbstractMotionDetectorScanner.handle_stop_scan of <viseron.components.mog2.motion_detector.MotionDetector object at 0x7f8cd514f0>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic viseron/signal/shutdown, <bound method AbstractMotionDetectorScanner.stop of <viseron.components.mog2.motion_detector.MotionDetector object at 0x7f8cd514f0>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.core] - Registering domain motion_detector with identifier patscam
viseron  | [2024-05-13 13:08:12] [INFO    ] [viseron.components] - Setup of domain motion_detector for component mog2 with identifier patscam took 0.0 seconds
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.nvr.nvr.patscam] - Initializing NVR for camera patscam Reolink
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic motion_detector/patscam/result, <queue.Queue object at 0x7f2bb81f40>
viseron  | [2024-05-13 13:08:12] [INFO    ] [viseron.components.nvr.nvr.patscam] - Object detector is disabled
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic patscam/camera/frame_bytes, <queue.Queue object at 0x7f8ce6be50>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.watchdog] - Registering <RestartableThread(<viseron.components.nvr.nvr.NVR object at 0x7f5b6bcf10>, initial)> in the watchdog
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.nvr.nvr.patscam] - Waiting for first frame
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Adding entity patscam Reolink Operation State from component nvr
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/patscam/nvr/operation_state, <bound method OperationStateSensor.handle_event of <viseron.components.nvr.sensor.OperationStateSensor object at 0x7f8cd59b20>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_operation_state to state: unknown, attributes {'name': 'patscam Reolink Operation State', 'domain': 'sensor'}
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic viseron/signal/shutdown, <bound method NVR.stop of <viseron.components.nvr.nvr.NVR object at 0x7f5b6bcf10>>
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Starting capture thread
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.watchdog] - Registering <RestartableThread(viseron.camera.patscam, initial daemon)> in the watchdog
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.components.gstreamer.stream.patscam] - GStreamer decoder command: rtspsrc location=rtsp://*****:*****@192.168.3.219:554/Preview_01_main name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer ! rtph264depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! appsink sync=true max-buffers=1 drop=true name=sink emit-signals=true depayed_stream. ! queue ! h264parse ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/patscam/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0
viseron  | [2024-05-13 13:08:12] [INFO    ] [viseron.components.nvr.nvr.patscam] - NVR for camera patscam Reolink initialized
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.states] - Setting state of toggle.patscam_connection to state: on, attributes {'name': 'patscam Reolink Connection', 'domain': 'toggle'}
viseron  | [2024-05-13 13:08:12] [INFO    ] [viseron.components] - Setup of domain nvr for component nvr with identifier patscam took 0.0 seconds
viseron  | [2024-05-13 13:08:12] [INFO    ] [viseron.core] - Viseron initialized in 4.0 seconds
viseron  | [2024-05-13 13:08:12] [DEBUG   ] [viseron.watchdog] - Registering <viseron.watchdog.process_watchdog.RestartableProcess object at 0x7f8cd59d00> in the watchdog
viseron  | [2024-05-13 13:08:13] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_operation_state to state: scanning_for_motion, attributes {'name': 'patscam Reolink Operation State', 'domain': 'sensor'}
viseron  | Opening in BLOCKING MODE 
viseron  | NvMMLiteOpen : Block : BlockType = 261 
viseron  | NVMEDIA: Reading vendor.tegra.display-size : status: 6 
viseron  | NvMMLiteBlockCreate : Block : BlockType = 261 
viseron  | Stream format not found, dropping the frame
viseron  | Stream format not found, dropping the frame
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_connected to state: on, attributes {'name': 'patscam Reolink Connected', 'domain': 'binary_sensor'}
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.components.nvr.nvr.patscam] - First frame received
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.components.mog2.motion_detector.patscam] - Max motion area: 0.99334
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.components.mog2.motion_detector.patscam] - Motion detected
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_motion_detected to state: on, attributes {'name': 'patscam Reolink Motion Detected', 'domain': 'binary_sensor'}
viseron  | [2024-05-13 13:08:15] [INFO    ] [viseron.components.gstreamer.recorder.patscam] - Starting recorder
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.helpers] - Creating folder /recordings/patscam/2024-05-13
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.helpers] - Creating folder /recordings/thumbnails/patscam Reolink
viseron  | [2024-05-13 13:08:15] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Saving thumbnail in /recordings/thumbnails/patscam Reolink
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Pausing segment cleanup
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_recorder to state: on, attributes {'name': 'patscam Reolink Recorder', 'domain': 'binary_sensor', 'start_time': datetime.datetime(2024, 5, 13, 13, 8, 16, 19946), 'start_timestamp': 1715598496.019946, 'end_time': None, 'end_timestamp': None, 'date': '2024-05-13', 'path': '/recordings/patscam/2024-05-13/13:08:15.mp4', 'filename': '13:08:15.mp4', 'thumbnail_path': '/recordings/patscam/2024-05-13/13:08:15.jpg', 'objects': []}
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.states] - Setting state of image.patscam_latest_thumbnail to state: unknown, attributes {'name': 'patscam Reolink Latest Thumbnail', 'domain': 'image', 'start_time': '2024-05-13T13:08:16.019946', 'path': '/recordings/patscam/2024-05-13/13:08:15.mp4', 'thumbnail_path': '/recordings/patscam/2024-05-13/13:08:15.jpg'}
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_operation_state to state: recording, attributes {'name': 'patscam Reolink Operation State', 'domain': 'sensor'}
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.components.mog2.motion_detector.patscam] - Max motion area: 0
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.components.mog2.motion_detector.patscam] - Motion stopped
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_motion_detected to state: off, attributes {'name': 'patscam Reolink Motion Detected', 'domain': 'binary_sensor'}
viseron  | [2024-05-13 13:08:16] [DEBUG   ] [viseron.components.mog2.motion_detector.patscam] - Max motion area: 0
viseron  | [2024-05-13 13:08:40] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":3}
viseron  | [2024-05-13 13:09:10] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":4}
viseron  | [2024-05-13 13:09:23] [DEBUG   ] [viseron.watchdog.thread_watchdog] - Thread viseron.camera.patscam is stuck
viseron  | [2024-05-13 13:09:23] [ERROR   ] [viseron.components.gstreamer.camera.patscam] - Timeout waiting for frame
viseron  | [2024-05-13 13:09:23] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Stopping capture thread
viseron  | [2024-05-13 13:09:23] [DEBUG   ] [viseron.watchdog.thread_watchdog] - Stopping thread viseron.camera.patscam
viseron  | [2024-05-13 13:09:23] [DEBUG   ] [viseron.watchdog] - Removing <RestartableThread(viseron.camera.patscam, started daemon 546159251824)> from the watchdog
viseron  | [2024-05-13 13:09:28] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Timed out trying to stop camera. Killing pipe
viseron  | [2024-05-13 13:09:28] [DEBUG   ] [viseron.components.gstreamer.stream.patscam] - Sending exit event to gstreamer_patscam
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.watchdog] - Removing <viseron.watchdog.process_watchdog.RestartableProcess [2024-05-13 13:09:33] [DEBUG   ] [viseron.watchdog] - Removing <viseron.watchdog.process_watchdog.RestartableProcess object at 0x7f8cd59d00> from the watchdog, message repeated 2 times
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.components.gstreamer.stream.patscam] - gstreamer_patscam exited
viseron  | [2024-05-13 13:09:33] [INFO    ] [viseron.components.gstreamer.recorder.patscam] - Stopping recorder
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.states] - Setting state of toggle.patscam_connection to state: on, attributes {'name': 'patscam Reolink Connection', 'domain': 'toggle'}
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Pausing segment cleanup
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.states] - Setting state of binary_sensor.patscam_recorder to state: off, attributes {'name': 'patscam Reolink Recorder', 'domain': 'binary_sensor', 'start_time': datetime.datetime(2024, 5, 13, 13, 8, 16, 19946), 'start_timestamp': 1715598496.019946, 'end_time': datetime.datetime(2024, 5, 13, 13, 9, 33, 715397), 'end_timestamp': 1715598573.715397, 'date': '2024-05-13', 'path': '/recordings/patscam/2024-05-13/13:08:15.mp4', 'filename': '13:08:15.mp4', 'thumbnail_path': '/recordings/patscam/2024-05-13/13:08:15.jpg', 'objects': []}
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Concatenating segments
viseron  | [2024-05-13 13:09:33] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locked. Trying again in 1 second
viseron  | [2024-05-13 13:09:34] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_operation_state to state: scanning_for_motion, attributes {'name': 'patscam Reolink Operation State', 'domain': 'sensor'}
viseron  | [2024-05-13 13:09:34] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.m[2024-05-13 13:09:35] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locke[2024-05-13 13:09:36] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locke[2024-05-13 13:09:37] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locked. Trying again in 1 second, message repeated 4 times
viseron  | [2024-05-13 13:09:38] [ERROR   ] [viseron.watchdog.thread_watchdog] - Failed to stop thread. Make sure poll_target ends the thread
viseron  | [2024-05-13 13:09:38] [ERROR   ] [viseron.watchdog.thread_watchdog] - Thread viseron.camera.patscam is dead, restarting
viseron  | [2024-05-13 13:09:38] [DEBUG   ] [viseron.components.gstreamer.camera.patscam] - Starting capture thread
viseron  | [2024-05-13 13:09:38] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.m[2024-05-13 13:09:40] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locke[2024-05-13 13:09:41] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locked. Trying again in 1 second, message repeated 3 times
viseron  | [2024-05-13 13:09:41] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":5}
viseron  | [2024-05-13 13:09:42] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.m[2024-05-13 13:09:43] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locke[2024-05-13 13:09:44] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - /segments/patscam/20240513130814.mp4 is locked. Trying again in 1 second, message repeated 3 times
viseron  | [2024-05-13 13:09:45] [ERROR   ] [viseron.components.gstreamer.recorder.patscam] - Could not get duration for: /segments/patscam/20240513130814.mp4. Error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589ee1bf0] moov atom not found
viseron  | /segments/patscam/20240513130814.mp4: Invalid data found when processing input
viseron  | 
viseron  | [2024-05-13 13:09:45] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Segment information: {}
viseron  | [2024-05-13 13:09:45] [ERROR   ] [viseron.components.gstreamer.recorder.patscam] - No segments were found
viseron  | [2024-05-13 13:09:45] [DEBUG   ] [viseron.components.gstreamer.recorder.patscam] - Resuming segment cleanup
viseron  | [2024-05-13 13:10:11] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":6}
viseron  | [2024-05-13 13:10:42] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":7}
viseron  | [2024-05-13 13:11:12] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":8}
viseron  | [2024-05-13 13:11:42] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":9}
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"subscribe_event","event":"domain/registered/camera","command_id":10}
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/domain/registered/camera, <function subscribe_event.<locals>.forward_event at 0x7f8cd56e50>
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"subscribe_event","event":"domain/setup/domain_failed/camera/*","command_id":11}
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/domain/setup/domain_failed/camera/*, <function subscribe_event.<locals>.forward_event at 0x7f5c74d430>
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.webserver.api.handlers] - Routing to CamerasAPIHandler.get_cameras(*args=[], **kwargs={}, request_arguments={})
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"subscribe_event","event":"domain/setup/domain_loaded/camera/*","command_id":12}
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.webserver.api.handlers] - Routing to CamerasAPIHandler.get_failed_cameras(*args=[], **kwargs={}, request_arguments={})
viseron  | [2024-05-13 13:11:59] [DEBUG   ] [viseron.components.data_stream] - Subscribing to data topic event/domain/setup/domain_loaded/camera/*, <function subscribe_event.<locals>.forward_event at 0x7f8cd09160>
viseron  | [2024-05-13 13:12:00] [DEBUG   ] [viseron.components.webserver.api.handlers] - Routing to CameraAPIHandler.get_camera(*args=[], **kwargs={'camera_identifier': 'patscam'}, request_arguments={'failed': False})
viseron  | [2024-05-13 13:12:00] [DEBUG   ] [viseron.components.webserver.api.handlers] - Routing to CameraAPIHandler.get_snapshot(*args=[], **kwargs={'camera_identifier': 'patscam'}, request_arguments={'rand': 'bkxmw', 'width': 643, 'height': None, 'access_token': *****})
viseron  | [2024-05-13 13:12:12] [DEBUG   ] [viseron.components.webserver.api.handlers] - Routing to CameraAPIHandler.get_snapshot(*args=[], **kwargs={'camera_identifier': 'patscam'}, request_arguments={'rand': 'lpmbv', 'width': 643, 'height': None, 'access_token': *****})
viseron  | [2024-05-13 13:12:12] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":13}
viseron  | [2024-05-13 13:12:44] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":14}
viseron  | [2024-05-13 13:13:12] [DEBUG   ] [viseron.states] - Setting state of sensor.patscam_access_token to state: 46d25cc969c2051b5fdc8abc7051d353a8093b3cdb3adc3fa3a16cd7917dfea1ccf425560c8f0d1f524b5d876754408df8d9164e128c963b0b6ba5cd967481d2, attributes {'name': 'patscam Reolink Access Token', 'domain': 'sensor'}
viseron  | [2024-05-13 13:13:14] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":15}
viseron  | [2024-05-13 13:13:45] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":16}
viseron  | [2024-05-13 13:14:15] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":17}
viseron  | [2024-05-13 13:14:47] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":18}
viseron  | [2024-05-13 13:15:17] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":19}
viseron  | [2024-05-13 13:15:48] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":20}
viseron  | [2024-05-13 13:16:18] [DEBUG   ] [viseron.components.webserver.websocket_api] - Received {"type":"ping","command_id":21}
viseron  | [2024-05-13 13:16:34] [DEBUG   ] [viseron.components.webserver.api.handlers] - Routing to CameraAPIHandler.get_snapshot(*args=[], **kwargs={'camera_identifier': 'patscam'}, request_arguments={'rand': 'fdtcq', 'width': 643, 'height': None, 'access_token': *****})

@roflcoopter
Copy link
Owner

Do you have many files present in the folder /segments/patscam/?
Whats the size of the files?

@pathia
Copy link
Author

pathia commented May 14, 2024

Nothing at all. This is a clean install. So the directory is completely empty.
$ docker exec -it viseron ls -la /segments/patscam
total 8
drwxr-xr-x 2 root root 4096 May 14 11:00 .
drwxr-xr-x 1 root root 4096 May 13 13:08 ..

@roflcoopter
Copy link
Owner

Strange, you would need to play around with the raw_command and figure out a pipeline that works for your particular camera i am afraid.

Issues like these are near impossible for me to assist with since i dont have access to the same hardware

@pathia
Copy link
Author

pathia commented May 17, 2024

I don't have any gstreamer experiences. Can you please give me a starting point? Such like what is the current command now for example.....

@roflcoopter
Copy link
Owner

Sure! The command can be found in your debug logs, the default that is used right now is this:

gst-launch-1.0 rtspsrc location=rtsp://*****:*****@192.168.3.219:554/Preview_01_main name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer ! rtph264depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! appsink sync=true max-buffers=1 drop=true name=sink emit-signals=true depayed_stream. ! queue ! h264parse ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/patscam/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0

It is quite long but you can try to simplify it by removing the audio part for instance.

To quickly test new pipelines you can exec into the container and play around with the command:

docker exec -it viseron bash

@pathia
Copy link
Author

pathia commented May 18, 2024

Does it prove anything if I say that the command won't crash when I leave out the "location=/segments/patscam/%01d.mp4"

@pathia
Copy link
Author

pathia commented May 18, 2024

fyi if I run the original command (with correct username/password):

root@e44be2521a09:/src# gst-launch-1.0 rtspsrc location=rtsp://*****:*****@192.168.3.219:554/Preview_01_main name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer ! rtph264depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=\(string\)NV12 ! appsink sync=true max-buffers=1 drop=true name=sink emit-signals=true depayed_stream. ! queue ! h264parse ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/patscam/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://*****:*****@192.168.3.219:554/Preview_01_main
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 
Stream format not found, dropping the frame
Stream format not found, dropping the frame
ERROR: from element /GstPipeline:pipeline0/GstSplitMuxSink:mux/GstMP4Mux:mp4mux0: Could not multiplex stream.
Additional debug info:
gstqtmux.c(4561): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstSplitMuxSink:mux/GstMP4Mux:mp4mux0:
Buffer has no PTS.
Execution ended after 0:00:03.066785194
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
root@e44be2521a09:/src# ```

@roflcoopter
Copy link
Owner

Hmm strange. What audio and video codecs is your camera sending?

Could you try updating to 3.0.0b5 and see if that has any effect?

@pathia
Copy link
Author

pathia commented May 21, 2024

Input #0, rtsp, from 'rtsp://xxx:xxxxx@192.168.3.219/Preview_01_main':
  Metadata:
    title           : Session streamed by "preview"
  Duration: N/A, start: 0.000438, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 2560x1920, 20 fps, 20 tbr, 90k tbn, 40 tbc
    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

Still no go. Even with 3.0.0b5.
I've attached the container log file.

3.0.0b5 viseron log.txt

@roflcoopter
Copy link
Owner

Nothing obvious still :(

Can you try without audio?
Set audio_codec: null for the camera config

@pathia
Copy link
Author

pathia commented May 21, 2024

Tried it. Still no video in the live view, nor is it recording any events. And the message
"[ERROR ] [viseron.watchdog.thread_watchdog] - Thread viseron.camera.patscam is dead, restarting"
I can arrange remote access using teamviewer or so.

@pathia
Copy link
Author

pathia commented May 21, 2024

By the way I'm running this image: https://github.com/Qengineering/Jetson-Nano-Ubuntu-20-image
Not the Nvidia Jetson image since it was an older Ubuntu version.

@roflcoopter
Copy link
Owner

Hmm that could possibly be the reason why.
The container runs the official image which has 18.04, might be a conflict with some library.

Is it possible for you to backup your SD card, flash the official Jetson Nano image and try again?

If it still doesn't work we can rule that out at least

And hey, thanks for the coffees! 🎉

@pathia
Copy link
Author

pathia commented May 21, 2024

Sure, will try that! I'll let you know how it goes.

@pathia
Copy link
Author

pathia commented May 21, 2024

Too bad... Apart from the old docker version (had to use docker-dash-compose again. felt like a time traveller)
But in the end I didn't see any difference and still get [viseron.watchdog.thread_watchdog] - Thread viseron.camera.patscam is dead, restarting
Is it possible use the same gstreamer configuration in a regular vm on my ESXi host (as a test, because no offloading)?

@pathia
Copy link
Author

pathia commented May 21, 2024

OK, I've did a test with a vm on ESXi running Centos stream 9.
And it gave me the exact same results. No video image, no recordings, the 'is dead' message and so on.
docker-compose:

services:
  viseron:
    image: roflcoopter/viseron:latest
    restart: always
    container_name: viseron
    volumes:
      - ./storage/recordings:/recordings
      - ./storage/config:/config
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 80:8888
    devices:
      - /dev/dri:/dev/dri

config.yaml:

gstreamer:
  camera:
    patscam:
      name: patscam Reolink
      host: 192.168.3.219
      port: 554
      path: /Preview_01_main
      username: username
      password: password
      fps: 20
      width: 2560
      height: 1920
      codec: hevc
      #audio_codec: aac
      audio_codec: null
      recorder:
        idle_timeout: 5

mog2:
  motion_detector:
    cameras:
      patscam:
        fps: 10
        trigger_recorder: true

nvr:
  patscam:

logger:
  default_level: debug

@roflcoopter
Copy link
Owner

Interesting, i suspect the camera is doing something funky that GStreamer cant handle.

If you switch gstreamer with ffmpeg, does that work?

@roflcoopter
Copy link
Owner

What Reolink model do you have?

@pathia
Copy link
Author

pathia commented May 22, 2024

It's the Reolink Doorbell PoE version. But I think I found something. Somewhere along the line I've set the codec to hevc instead of h264.
Not sure when that happened. Now doing some testing and next step will be switch to ubuntu 20 again for security patches and so.

@pathia
Copy link
Author

pathia commented May 22, 2024

By the way I found it when I was trying to put in a test stream of https://rtsp.stream/ . This site seems to offer nice free test streams. I couldn't find any other working rtsp streams..

@pathia
Copy link
Author

pathia commented Jun 2, 2024

OK, I've ordered a Google Coral. We can close this one.

@pathia pathia closed this as completed Jun 2, 2024
@roflcoopter
Copy link
Owner

So this was caused by some misconfiguration between your camera and Viseron?

@pathia
Copy link
Author

pathia commented Jun 10, 2024

So this was caused by some misconfiguration between your camera and Viseron?

Not really. I still couldn't get it to work. Only thing is somewhere along the line while trying and testing I messed up the codec setting. Will continue testing, but now with the Coral TPU. Thanks for the help so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants