码迷,mamicode.com
首页 > 其他好文 > 详细

shinobi使用(1)

时间:2020-10-27 11:39:30      阅读:24      评论:0      收藏:0      [点我收藏+]

标签:环境   connect   api   其他   design   谷歌   网页   没有   eve   

测试环境:zhonghang docker方式

shinobi docker安装参考:https://gitlab.com/Shinobi-Systems/Shinobi/-/tree/dev/Docker

1) bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh)

2)bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh)
Docker version 19.03.11, build 42e35e61f3
You are missing Docker Compose
docker-compose not found!
Get it here : https://docs.docker.com/compose/install
以上提示缺少docker-compose

chmod +x /usr/local/bin/docker-compose

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose 可选实际没有运行

docker-compose --version验证如下:
docker-compose version 1.27.4, build 40524192

再次运行bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh)
提示错误:
Creating network "root_default" with the default driver
ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait
-t nat -I DOCKER -i br-6024c97a708a -j RETURN: iptables: No chain/target/match by that name.
(exit status 1)) 意思是没有docker链

看docker默认的iptables规则如下:

-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 172.18.0.0/16 ! -o br-6024c97a708a -j MASQUERADE
-A POSTROUTING -s 172.168.186.200/32 -d 10.1.30.0/24 -j MASQUERADE
-A POSTROUTING -s 100.10.186.200/32 -d 10.1.30.0/24 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN

-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -s 100.10.186.200/32 -d 10.1.30.0/24 -j ACCEPT
-A FORWARD -s 172.168.186.200/32 -d 10.1.30.0/24 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN

-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.18.0.0/16 ! -o br-231925b6f570 -j MASQUERADE
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 172.18.0.0/16 ! -o br-6024c97a708a -j MASQUERADE
-A POSTROUTING -s 172.168.186.200/32 -d 10.1.30.0/24 -j MASQUERADE
-A POSTROUTING -s 100.10.186.200/32 -d 10.1.30.0/24 -j MASQUERADE
-A DOCKER -i br-231925b6f570 -j RETURN
-A DOCKER -i docker0 -j RETURN

-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o br-231925b6f570 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o br-231925b6f570 -j DOCKER
-A FORWARD -i br-231925b6f570 ! -o br-231925b6f570 -j ACCEPT
-A FORWARD -i br-231925b6f570 -o br-231925b6f570 -j ACCEPT
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -s 100.10.186.200/32 -d 10.1.30.0/24 -j ACCEPT
-A FORWARD -s 172.168.186.200/32 -d 10.1.30.0/24 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i br-231925b6f570 ! -o br-231925b6f570 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o br-231925b6f570 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN

  1. 从一个CHAIN里可以jump到另一个CHAIN, jump到的那个CHAIN是子CHAIN.
  2. 从子CHAIN return后,回到触发jump的那条规则,从那条规则的下一条继续匹配.
  3. 如果return不是在子CHAIN里,而是在main CHAIN,那么就以默认规则进行.
    参考:https://blog.csdn.net/taiyangdao/article/details/88844558

再次运行bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh)
Docker version 19.03.11, build 42e35e61f3
docker-compose version 1.27.4, build 40524192
Shinobi - Do you want to Install Object Detection? (TensorFlow.js)
(y)es or (N)o
y
version: "3"
services:
shinobi:
image: shinobisystems/shinobi:dev
container_name: Shinobi
environment:
- PLUGIN_KEYS={"Tensorflow":"92a809b0533cb64e033131f8e60ae"}
- SSL_ENABLED=false
volumes:
- /root/Shinobi/config:/config
- /root/Shinobi/customAutoLoad:/home/Shinobi/libs/customAutoLoad
- /root/Shinobi/database:/var/lib/mysql
- /root/Shinobi/videos:/home/Shinobi/videos
- /root/Shinobi/plugins:/home/Shinobi/plugins
- /dev/shm/Shinobi/streams:/dev/shm/streams
- /etc/localtime:/etc/localtime:ro
ports:
- 8080:8080
restart: unless-stopped

shinobiplugintensorflow:
    image: shinobisystems/shinobi-tensorflow:latest
    container_name: shinobi-tensorflow
    environment:
      - PLUGIN_KEY=92a809b0533cb64e033131f8e60ae
      - PLUGIN_HOST=Shinobi
    volumes:
      - /root/Shinobi/docker-plugins/tensorflow:/config
    restart: unless-stopped

Creating network "root_default" with the default driver
Pulling shinobi (shinobisystems/shinobi:dev)...
dev: Pulling from shinobisystems/shinobi
d121f8d1c412: Pull complete
Creating shinobi-tensorflow ... done
Creating Shinobi ... done

Default Superuser : admin@shinobi.video
Default Password : admin

https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh 内容:

!/bin/bash

if ! [ -x "$(command -v docker)" ]; then
echo "You are missing Docker"
echo "docker not found!"
echo "Get it here : https://docs.docker.com/engine/install/"
exit 1
else
docker -v
fi
if ! [ -x "$(command -v docker-compose)" ]; then
echo "You are missing Docker Compose"
echo "docker-compose not found!"
echo "Get it here : https://docs.docker.com/compose/install/"
exit 1
else
docker-compose -v
fi

PLUGIN_LIST=‘‘
PLUGIN_YMLS=();

SSL_TOGGLE="$(echo "$1" | awk ‘{print tolower($0)}‘)"
if [ "$SSL_TOGGLE" = "true" ]; then
SSL_TOGGLE=‘true‘
else
SSL_TOGGLE=‘false‘
fi

echo "Shinobi - Do you want to Install Object Detection? (TensorFlow.js)"
echo "(y)es or (N)o"
read -r TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE
TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE="$(echo "$TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE" | awk ‘{print tolower($0)}‘)"
if [ "$TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE" = "y" ]; then
TENSORFLOW_PLUGIN_KEY=$(head -c 1024 < /dev/urandom | sha256sum | awk ‘{print substr($1,1,29)}‘)
PLUGIN_YMLS+=(‘"Tensorflow":"‘$TENSORFLOW_PLUGIN_KEY‘"‘)
PLUGIN_LIST+=$(cat <<-END

shinobiplugintensorflow:
    image: shinobisystems/shinobi-tensorflow:latest
    container_name: shinobi-tensorflow
    environment:
      - PLUGIN_KEY=$TENSORFLOW_PLUGIN_KEY
      - PLUGIN_HOST=Shinobi
    volumes:
      - $HOME/Shinobi/docker-plugins/tensorflow:/config
    restart: unless-stopped

END
)
fi

Join Plugin Keys

PLUGIN_YMLS=$(printf ",%s" "${PLUGIN_YMLS[@]}")
PLUGIN_YMLS=${PLUGIN_YMLS:1}
PLUGIN_YMLS="{$PLUGIN_YMLS}"
cat > docker-compose.yml <<- EOM
version: "3"
services:
shinobi:
image: shinobisystems/shinobi:dev
container_name: Shinobi
environment:
- PLUGIN_KEYS=$PLUGIN_YMLS
- SSL_ENABLED=$SSL_TOGGLE
volumes:
- $HOME/Shinobi/config:/config
- $HOME/Shinobi/customAutoLoad:/home/Shinobi/libs/customAutoLoad
- $HOME/Shinobi/database:/var/lib/mysql
- $HOME/Shinobi/videos:/home/Shinobi/videos
- $HOME/Shinobi/plugins:/home/Shinobi/plugins
- /dev/shm/Shinobi/streams:/dev/shm/streams
- /etc/localtime:/etc/localtime:ro
ports:
- 8080:8080
restart: unless-stopped
$PLUGIN_LIST
EOM
cat docker-compose.yml
docker-compose up -d

rm docker-compose.yml

具有参考意义的文档:https://www.right.com.cn/forum/thread-405347-1-1.html
https://ngx.hk/2018/11/03/通过docker部署摄像头录制软件shinobi.html
https://ngx.hk/2018/05/19/安装配置开源的监控摄像头录制软件shinobi.html

docker安装shinobi https://gitlab.com/Shinobi-Systems/Shinobi/-/tree/dev/Docker

更改shinobi的密码:默认密码为admin
root@proxtest:~# cat Shinobi/config/super.json
[
{
"mail":"admin@shinobi.video",
"pass":"21232f297a57a5a743894a0e4a801fc3"
}
可以在后台的super页面perfence改为其他密码

["-loglevel","warning","-r","10","-progress","pipe:5","-use_wallclock_as_timestamps","1","-analyzeduration","1000000","-probesize","1000000","-fflags","+igndts","-rtsp_transport","tcp","-i","rtsp://admin:admin12345@10.1.30.26:8557/h264","-an","-c:v","mjpeg","-f","mpjpeg","-boundary_tag","shinobi","-strict","-2","-r","2","-vf","format=nv12,hwupload,scale_vaapi=w=640:h=480","pipe:1"]Thread Opening

cmd : -loglevel warning -r 20 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -i "rtsp://10.1.30.25:8557/h264" -an -c:v mjpeg -f image2pipe -strict -2 -r 2 pipe:1 -vf "fps=15" -s 640x480 -update 1 "/dev/shm/streams/CXLgPr6Htz/zhonghang25/s.jpg" -y

SEI type 86 size 720 truncated at 271

Process Crashed for Monitor

1)疑问:I-Frames https://hub.shinobi.video/articles/view/v0AFPFchfVcFGUS

2)tv channel的使用方法:

3)shinobi monitor设置中的preset是什么设置??

正常观察shinobi的步骤:
在identify中全部填上
在connection中将automatic设置为no,手动填写好相关的参数

在input:中填写Monitor Capture Rate(FPS)为小于或者等于(实际填写10或者20) 实际的rtsp fps(zenith摄像头);Use Camera Timestamps根据需要填写好;Accelerator实际填写为yes或no都可以

stream :
This section will designate the primary method of streaming out and its settings. This stream will be displayed in the dashboard. If you choose to use HLS, JPEG, or MJPEG then you can consume the stream through other programs.
(这部分为shinobi网页实时预览的解码)当设置为mjpeg 码率可以填写如下:
Quality 16
1 is High, 23 is Low
Low number means higher quality. Higher number means less quality.

Frame Rate 2
The speed in which frames are displayed to clients, in Frames Per Second. Be aware there is no default. This can lead to high bandwidth usage.

Width 640
Width of the stream image that is output after processing.

Height 480
Height of the stream image that is output after processing.

Rotate 翻转 no rotate
Change the viewing angle of the video stream.

jpeg api:设置为了 no 不知道是否有影响

timelapse: 设置no 不知道是否有影响

GLOBAL DETECTOR SETTINGS PRIMARY ENGINE : PIXEL ARRAY enable设置为no

当需要record:时,可以设置为 It is recommended that you set Record File Type to MP4 and Video Codec to copy or libx264 because your Input Type is set to H.264 / H.265 / H.265+. (这里的意思时当你的input类型设定为h264 h265 h265+时,可以考虑将record文件类型设定为mp4)
record录像文件无法在qq浏览器中播放(chrome内核),当stream设定为mjpeg时可以播放,但当设定为hls,flv(flv应该是flash格式)等时无法播放record为mp4的录像文件
参考:解决Chrome不能播放mp4视频的问题和HLS视频播放 https://www.jianshu.com/p/a4aee97775c1
解决.m3u8格式视频文件在chrome等浏览器中不能播放的问题 https://blog.csdn.net/zhenhanhong_tony/article/details/53151503

chrome基本上支持h264格式,flash已经被chrome抛弃。firefox还可以在老版本上安装下flash来播放hls flv mp4等格式。ie基本没戏

可以将rstp进行推流。目前的做法是通过海康sdk、大华sdk等推流,也可以通过ffmpeg来手动测试推流ffmpeg -i "rtsp://admin:admin123456@192.168.1.155:554/h264/ch1/main/av_stream" -vcodec libx264 -acodec copy -f flv "rtmp://127.0.0.1:1935/live/hik1"
参考:谷歌Chrome浏览器播放rtsp海康大华摄像头视频纯H5播放HTTP-FLV https://blog.csdn.net/zqw_4181/article/details/104608240

极度重要文章 在shinobi中调试camera How to Troubleshoot a Camera in Shinobi https://hub.shinobi.video/articles/view/v0AFPFchfVcFGUS

相关camera reolink.com

shinobi使用(1)

标签:环境   connect   api   其他   design   谷歌   网页   没有   eve   

原文地址:https://www.cnblogs.com/weihua2020/p/13881791.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!