測試環境: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
- 從一個CHAIN里可以jump到另一個CHAIN, jump到的那個CHAIN是子CHAIN.
- 從子CHAIN return后,回到觸發jump的那條規則,從那條規則的下一條繼續匹配.
- 如果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