From b076269c5dafba4aa8bf32c28de596fa4af1facd Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 11 Apr 2020 02:55:51 +0000 Subject: [PATCH] investigate looks like ffmpeg is nice --- ffmpeg/ffmpegs.log | 0 ffmpeg/log | 68 +++++++++++++ ffmpeg/run.sh | 41 ++++++++ motion/cameras/wyze0.conf | 21 ++++ motion/cameras/wyze1.conf | 21 ++++ motion/cameras/wyze2.conf | 21 ++++ motion/cameras/wyze3.conf | 21 ++++ motion/motion.conf | 196 ++++++++++++++++++++++++++++++++++++++ motion/run.sh | 1 + openrtsp/install.sh | 6 ++ openrtsp/run.sh | 1 + 11 files changed, 397 insertions(+) create mode 100644 ffmpeg/ffmpegs.log create mode 100644 ffmpeg/log create mode 100644 ffmpeg/run.sh create mode 100644 motion/cameras/wyze0.conf create mode 100644 motion/cameras/wyze1.conf create mode 100644 motion/cameras/wyze2.conf create mode 100644 motion/cameras/wyze3.conf create mode 100644 motion/motion.conf create mode 100644 motion/run.sh create mode 100644 openrtsp/install.sh create mode 100644 openrtsp/run.sh diff --git a/ffmpeg/ffmpegs.log b/ffmpeg/ffmpegs.log new file mode 100644 index 0000000..e69de29 diff --git a/ffmpeg/log b/ffmpeg/log new file mode 100644 index 0000000..917572b --- /dev/null +++ b/ffmpeg/log @@ -0,0 +1,68 @@ +ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers + built with gcc 9 (Ubuntu 9.3.0-3ubuntu1) + configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared + libavutil 56. 31.100 / 56. 31.100 + libavcodec 58. 54.100 / 58. 54.100 + libavformat 58. 29.100 / 58. 29.100 + libavdevice 58. 8.100 / 58. 8.100 + libavfilter 7. 57.100 / 7. 57.100 + libavresample 4. 0. 0 / 4. 0. 0 + libswscale 5. 5.100 / 5. 5.100 + libswresample 3. 5.100 / 3. 5.100 + libpostproc 55. 5.100 / 55. 5.100 +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! +[h264 @ 0x555d65c14b80] non-existing PPS 0 referenced + Last message repeated 1 times +[h264 @ 0x555d65c14b80] decode_slice_header error +[h264 @ 0x555d65c14b80] no frame! diff --git a/ffmpeg/run.sh b/ffmpeg/run.sh new file mode 100644 index 0000000..c3cdecc --- /dev/null +++ b/ffmpeg/run.sh @@ -0,0 +1,41 @@ +#! /bin/bash + +echo to start: ${@:-83} + +for i in "${@:-83}"; do + echo starting $i... + ffmpeg \ + -threads 0 \ + -nostdin \ + -nostats \ + -loglevel error \ + -i rtsp://192.168.0.$i:8554/unicast \ + -an \ + -map 0 \ + -force_key_frames "expr:gte(t,n_forced*9)" \ + -f segment \ + -segment_time ${SEG:-10} \ + -segment_format mp4 \ + -strftime 1 \ + -minrate .05k \ + -vcodec copy \ + "/tmp/ffmpeg_cap/ffmpeg_capture-$i-%Y%m%d_%H%M%S.mp4" \ + -vf "select=gt(scene\,0.003),setpts=N/(15*TB)" \ + 2>&1 \ + < /dev/null \ + | grep -vE 'RTP: missed|max delay reached. need to consume packet|decode_slice_header|no.frame|non.existing.PPS|Last.message.repeated' \ + >> ./ffmpegs.log & +done + +clean() { + kill -9 $(jobs -p) +} +trap clean EXIT ERR + +for i in "${@:-83}"; do + if ! wait -n 1; then + echo "Something died" >&2 + exit 1 + fi + exit 0 +done diff --git a/motion/cameras/wyze0.conf b/motion/cameras/wyze0.conf new file mode 100644 index 0000000..f1b19d4 --- /dev/null +++ b/motion/cameras/wyze0.conf @@ -0,0 +1,21 @@ +# /etc/motion/camera1.conf +# +# This config file was generated by motion 4.2.2 + +########################################################### +# Configuration options specific to camera 1 +############################################################ +# User defined name for the camera. +camera_name Wyze0 + +# Numeric identifier for the camera. +camera_id 0 + +# The full URL of the network camera stream. +netcam_url rtsp://192.168.0.83:8554/unicast + +# Text to be overlayed in the lower left corner of images +#text_left WYZE0 + +height 1080 +width 1920 diff --git a/motion/cameras/wyze1.conf b/motion/cameras/wyze1.conf new file mode 100644 index 0000000..532c29c --- /dev/null +++ b/motion/cameras/wyze1.conf @@ -0,0 +1,21 @@ +# /etc/motion/camera1.conf +# +# This config file was generated by motion 4.2.2 + +########################################################### +# Configuration options specific to camera 1 +############################################################ +# User defined name for the camera. +camera_name Wyze1 + +# Numeric identifier for the camera. +camera_id 1 + +# The full URL of the network camera stream. +netcam_url rtsp://192.168.0.96:8554/unicast + +# Text to be overlayed in the lower left corner of images +#text_left WYZE1 + +height 720 +width 1280 diff --git a/motion/cameras/wyze2.conf b/motion/cameras/wyze2.conf new file mode 100644 index 0000000..3361d49 --- /dev/null +++ b/motion/cameras/wyze2.conf @@ -0,0 +1,21 @@ +# /etc/motion/camera1.conf +# +# This config file was generated by motion 4.2.2 + +########################################################### +# Configuration options specific to camera 1 +############################################################ +# User defined name for the camera. +camera_name Wyze2 + +# Numeric identifier for the camera. +camera_id 2 + +# The full URL of the network camera stream. +netcam_url rtsp://192.168.0.97:8554/unicast + +# Text to be overlayed in the lower left corner of images +#text_left WYZE2 + +height 720 +width 1280 diff --git a/motion/cameras/wyze3.conf b/motion/cameras/wyze3.conf new file mode 100644 index 0000000..2574bfb --- /dev/null +++ b/motion/cameras/wyze3.conf @@ -0,0 +1,21 @@ +# /etc/motion/camera1.conf +# +# This config file was generated by motion 4.2.2 + +########################################################### +# Configuration options specific to camera 1 +############################################################ +# User defined name for the camera. +camera_name Wyze3 + +# Numeric identifier for the camera. +camera_id 3 + +# The full URL of the network camera stream. +netcam_url rtsp://192.168.0.98:8554/unicast + +# Text to be overlayed in the lower left corner of images +#text_left WYZE3 + +height 720 +width 1280 diff --git a/motion/motion.conf b/motion/motion.conf new file mode 100644 index 0000000..502c42e --- /dev/null +++ b/motion/motion.conf @@ -0,0 +1,196 @@ +# Rename this distribution example file to motion.conf +# +# This config file was generated by motion 4.2.2 +# Documentation: /usr/share/doc/motion/motion_guide.html +# +# This file contains only the basic configuration options to get a +# system working. There are many more options available. Please +# consult the documentation for the complete list of all options. +# + +############################################################ +# System control configuration parameters +############################################################ + +# Start in daemon (background) mode and release terminal. +daemon off + +# Start in Setup-Mode, daemon disabled. +setup_mode off + +# File to store the process ID. +; pid_file value + +# File to write logs messages into. If not defined stderr and syslog is used. +log_file /var/log/motion/motion.log + +# Level of log messages [1..9] (EMG, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). +log_level 9 + +# Target directory for pictures, snapshots and movies +target_dir /var/lib/motion + +# Video device (e.g. /dev/video0) to be used for capturing. +# videodevice /dev/video0 + +# Parameters to control video device. See motion_guide.html +; vid_control_params value + +# The full URL of the network camera stream. +; netcam_url value + +# Name of mmal camera (e.g. vc.ril.camera for pi camera). +; mmalcam_name value + +# Camera control parameters (see raspivid/raspistill tool documentation) +; mmalcam_control_params value + +############################################################ +# Image Processing configuration parameters +############################################################ + +# Image width in pixels. +width 1920 + +# Image height in pixels. +height 1080 + +# Maximum number of frames to be captured per second. +framerate 25 + +# Text to be overlayed in the lower left corner of images +#text_left CAMERA1 + +# Text to be overlayed in the lower right corner of images. +#text_right %Y-%m-%d\n%T-%q + +text_left +text_right + +############################################################ +# Motion detection configuration parameters +############################################################ + +# Always save pictures and movies even if there was no motion. +emulate_motion off + +# Threshold for number of changed pixels that triggers motion. +threshold 1500 + +# Noise threshold for the motion detection. +; noise_level 32 + +# Despeckle the image using (E/e)rode or (D/d)ilate or (l)abel. +despeckle_filter EedDl + +# Number of images that must contain motion to trigger an event. +minimum_motion_frames 1 + +# Gap in seconds of no motion detected that triggers the end of an event. +event_gap 60 + +# The number of pre-captured (buffered) pictures from before motion. +pre_capture 15 + +# Number of frames to capture after motion is no longer detected. +post_capture 10 + +############################################################ +# Script execution configuration parameters +############################################################ + +# Command to be executed when an event starts. +; on_event_start value + +# Command to be executed when an event ends. +; on_event_end value + +# Command to be executed when a movie file is closed. +; on_movie_end value + +############################################################ +# Picture output configuration parameters +############################################################ + +# Output pictures when motion is detected +picture_output off + +# File name(without extension) for pictures relative to target directory +picture_filename %Y%m%d%H%M%S-%q + +############################################################ +# Movie output configuration parameters +############################################################ + +# Create movies of motion events. +movie_output on + +# Maximum length of movie in seconds. +movie_max_time 60 + +# The encoding quality of the movie. (0=use bitrate. 1=worst quality, 100=best) +movie_quality 45 + +# Container/Codec to used for the movie. See motion_guide.html +movie_codec mkv + +# File name(without extension) for movies relative to target directory +movie_filename %t-%Y%m%d%H%M%S + +############################################################ +# Webcontrol configuration parameters +############################################################ + +# Port number used for the webcontrol. +webcontrol_port 5080 + +# Restrict webcontrol connections to the localhost. +webcontrol_localhost off + +# Type of configuration options to allow via the webcontrol. +webcontrol_parms 0 + +############################################################ +# Live stream configuration parameters +############################################################ + +# The port number for the live stream. +stream_port 5081 + +# Restrict stream connections to the localhost. +stream_localhost off + +stream_quality 10 + +############################################################## +# Camera config files - One for each camera. +############################################################## +; camera /etc/motion/camera1.conf +; camera /etc/motion/camera2.conf +; camera /etc/motion/camera3.conf +; camera /etc/motion/camera4.conf + +############ +# Bel +############ + +emulate_motion on +threshold 1 +framerate 5 +pre_capture 0 +post_capture 0 +stream_port 0 + +#emulate_motion off +#threshold 1500 +#framerate 15 +#pre_capture 5 +#post_capture 5 + + +############################################################## +# Directory to read '.conf' files for cameras. +############################################################## +; camera_dir /etc/motion/conf.d +camera_dir /home/bel/Go/src/local/containers/cctv/motion/cameras + diff --git a/motion/run.sh b/motion/run.sh new file mode 100644 index 0000000..8696de5 --- /dev/null +++ b/motion/run.sh @@ -0,0 +1 @@ +motion -n -c motion.conf diff --git a/openrtsp/install.sh b/openrtsp/install.sh new file mode 100644 index 0000000..57ddcdd --- /dev/null +++ b/openrtsp/install.sh @@ -0,0 +1,6 @@ +sudo apt-get install libssl-dev +wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz +tar -xzf live555-latest.tar.gz +cd live +./genMakefiles linux +sudo make install diff --git a/openrtsp/run.sh b/openrtsp/run.sh new file mode 100644 index 0000000..fdf27bc --- /dev/null +++ b/openrtsp/run.sh @@ -0,0 +1 @@ +openRTSP -w 1920 -h 1080 -f 15 -D 1 -c -B 10000000 -b 10000000 -4 -Q -F /tmp/openrtsp/83 -d 28800 -P 10 -t rtsp://192.168.0.83:8554/unicast