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.66k stars 171 forks source link

h265 error on jetson nano #493

Closed fevenor closed 1 year ago

fevenor commented 1 year ago

jetson nano has an error when processing h265

[2023-03-02 22:51:17] [ERROR   ] [viseron.components.gstreamer.camera.cctv_test] - Restarting frame pipe
[2023-03-02 22:51:17] [DEBUG   ] [viseron.components.gstreamer.stream.cctv_test] - GStreamer decoder command: gstreamer_cctv_test --gst-debug-level=1 -q rtspsrc location=rtsp://*****:*****@10.0.7.4:554/Streaming/Channels/101 name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer do-lost=true drop-on-latency=true ! rtph265depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! fdsink depayed_stream. ! queue ! rtph265depay ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/cctv_test/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0
[2023-03-02 22:51:17] [ERROR   ] [viseron.components.gstreamer.stream.cctv_test] - 0:00:00.114517331   665   0x558d282350 ERROR           GST_PIPELINE grammar.y:740:gst_parse_perform_link: could not link queue1 to rtph265depay1
[2023-03-02 22:51:17] [ERROR   ] [viseron.components.gstreamer.stream.cctv_test] - WARNING: erroneous pipeline: could not link queue1 to rtph265depay1
[2023-03-02 22:51:17] [ERROR   ] [viseron.components.gstreamer.camera.cctv_test] - GStreamer process has exited

works fine if changed to rtsp encoded for h264

[2023-03-02 22:52:55] [DEBUG   ] [viseron.components.gstreamer.stream.cctv_test] - GStreamer decoder command: gstreamer_cctv_test --gst-debug-level=1 -q rtspsrc location=rtsp://*****:*****@10.0.7.5:554/Streaming/Channels/101 name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer do-lost=true drop-on-latency=true ! rtph264depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! fdsink 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/cctv_test/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0
[2023-03-02 22:52:55] [INFO    ] [viseron.components.nvr.nvr.cctv_test] - NVR for camera cctv test initialized
roflcoopter commented 1 year ago

Saw something that may have been a misstake from me in the generated pipeline.

If you exec into the container, does this command work? (You need to add in your user and password)

gstreamer_cctv_test --gst-debug-level=1 -q rtspsrc location=rtsp://*****:*****@10.0.7.4:554/Streaming/Channels/101 name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer do-lost=true drop-on-latency=true ! rtph265depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! fdsink depayed_stream. ! queue ! h265parse ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/cctv_test/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0
fevenor commented 1 year ago

Saw something that may have been a misstake from me in the generated pipeline.

If you exec into the container, does this command work? (You need to add in your user and password)

gstreamer_cctv_test --gst-debug-level=1 -q rtspsrc location=rtsp://*****:*****@10.0.7.4:554/Streaming/Channels/101 name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer do-lost=true drop-on-latency=true ! rtph265depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! fdsink depayed_stream. ! queue ! h265parse ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/cctv_test/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0

The terminal keeps outputting, which seems to be normal.

JagerSprinkles commented 1 year ago

I might be seeing a similar issue on my Jetson Nano as well. Both ffmpeg and gstreamer will not stream my Reolink cameras. I spent a while debugging but don't have enough knowledge about ffmpeg or gstreamer to know what is happening here.

Let me know if this should be opened as a new issue or anything.

When I run the ffmpeg command from the terminal it runs for a few seconds and then get a segmentation fault. If I modify the command and remove the "pipe:1" at the end it seems to work fine. I tried to remove it with output_args but then found those are only for the recorder settings so that didn't work.

Command used. I got this from catching the command Viseron is running. Error output is attached. ffmpeg_back_porch -hide_banner -loglevel info -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_nvv4l2dec -rtsp_transport tcp -i rtsp://user:pass@IPADDRESS:554/h264Preview_01_sub -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /tmp/back_porch/%Y%m%d%H%M%S.mp4 -vf fps=1.0 -f rawvideo -pix_fmt nv12 pipe:1

viseron ffmpeg error from docker.txt viseron ffmpeg error from terminal.txt

roflcoopter commented 1 year ago

Saw something that may have been a misstake from me in the generated pipeline. If you exec into the container, does this command work? (You need to add in your user and password)

gstreamer_cctv_test --gst-debug-level=1 -q rtspsrc location=rtsp://*****:*****@10.0.7.4:554/Streaming/Channels/101 name=input_stream do-timestamp=true latency=0 protocols=tcp ! rtpjitterbuffer do-lost=true drop-on-latency=true ! rtph265depay ! tee name=depayed_stream ! queue ! nvv4l2decoder enable-max-performance=true drop-frame-interval=2 !  nvvidconv ! video/x-raw,format=(string)NV12 ! fdsink depayed_stream. ! queue ! h265parse ! splitmuxsink async-finalize=true send-keyframe-requests=true max-size-bytes=0 name=mux muxer=mp4mux max-size-time=5000000000 location=/segments/cctv_test/%01d.mp4 input_stream. ! queue ! decodebin ! audioconvert ! queue ! voaacenc ! mux.audio_0

The terminal keeps outputting, which seems to be normal.

Thanks, will make a fix and push to dev soon, will let you know when you can test

roflcoopter commented 1 year ago

I might be seeing a similar issue on my Jetson Nano as well. Both ffmpeg and gstreamer will not stream my Reolink cameras. I spent a while debugging but don't have enough knowledge about ffmpeg or gstreamer to know what is happening here.

Let me know if this should be opened as a new issue or anything.

When I run the ffmpeg command from the terminal it runs for a few seconds and then get a segmentation fault. If I modify the command and remove the "pipe:1" at the end it seems to work fine. I tried to remove it with output_args but then found those are only for the recorder settings so that didn't work.

Command used. I got this from catching the command Viseron is running. Error output is attached. ffmpeg_back_porch -hide_banner -loglevel info -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_nvv4l2dec -rtsp_transport tcp -i rtsp://user:pass@IPADDRESS:554/h264Preview_01_sub -f segment -segment_time 5 -reset_timestamps 1 -strftime 1 -c:v copy -c:a copy /tmp/back_porch/%Y%m%d%H%M%S.mp4 -vf fps=1.0 -f rawvideo -pix_fmt nv12 pipe:1

viseron ffmpeg error from docker.txt viseron ffmpeg error from terminal.txt

ffmpeg does not work very well with the Nano unfortunately, so i would suggest you use gstreamer instead. If you have problems with that, i think its best if you open a new issue since it seems your camera is using h264

roflcoopter commented 1 year ago

Pushed to dev tag now, try it out when you get the chance

fevenor commented 1 year ago

Pushed to dev tag now, try it out when you get the chance

try with dev, h265 works fine now