RTSP 笔记

github 加速

1
2
3
4
5
6
7
8
9
# 方法一(替换URL)
git clone https://gitclone.com/github.com/tendermint/tendermint.git

# 方法二(设置git参数)
git config --global url."https://gitclone.com/".insteadOf https://
git clone https://github.com/tendermint/tendermint.git

# 方法三(使用cgit客户端)
cgit clone https://github.com/tendermint/tendermint.git

phpmyadmin session 时间

/libraries/config.default.php

1
$cfg['LoginCookieValidity'] = 144000;

config.inc.php

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
/**
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '192.168.1.2';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

php.ini

1
session.gc_maxlifetime = 144001

Windows 刷新DNS

1
ipconfig /flushdns

docker 导出和导入镜像

1
2
docker save laijw/wechatpy:latest -o wechatpy-latest.tar
docker load -i wechatpy-latest.tar.tar

Windows Tab 切换

1
2
Ctrl + PageUP
Ctrl + PageDown

局域网网段

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
10.0.0.0 - 10.255.255.255
255.0.0.0
A 类网

172.16.0.0 - 172.31.255.255
255.255.0.0
B 类网

192.168.0.0 - 192.168.255.255
255.255.255.0
C 类网

dnsmasq-docker

/opt/dnsmasq.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#dnsmasq config, for a complete example, see:
#  http://oss.segetech.com/intra/srv/dnsmasq.conf
#log all dns queries
log-queries
#dont use hosts nameservers
no-resolv
#use cloudflare as default nameservers, prefer 1^4
server=119.29.29.29
server=8.8.8.8
strict-order
#serve all .company queries using a specific nameserver
server=/cn/114.114.114.114
server=/aliyun.com/223.5.5.5
server=/google.com/8.8.8.8
server=/baidu.com/119.29.29.29
server=/qq.com/119.29.29.29
#explicitly define host-ip mappings
address=/local.com/127.0.0.1
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
docker run -itd \
  --name dnsmasq \
  --restart always \
  --log-opt "max-size=100m" \
  -e "HTTP_USER=admin" \
  -e "HTTP_PASS=123456" \
  -v ~/WWW/docker/dnsmasq/dnsmasq.conf:/etc/dnsmasq.conf \
  -p 53:53/udp \
  -p 5380:8080 \
  jpillora/dnsmasq

Debian apt 源替换

1
2
sed -i "s/deb.debian.org/mirrors.aliyun.com/g" /etc/apt/sources.list
apt update

Mac 常用软件配置文件路径

Chrome 书签

1
/Users/ljw/Library/Application Support/Google/Chrome/Default/Bookmarks

Chrome 历史

使用 sqlite3 打开

1
/Users/ljw/Library/Application Support/Google/Chrome/Default/History

VS Code 项目历史

1
/Users/ljw/Library/Application Support/Code/storage.json

Webstorm 项目历史

1
/Users/ljw/Library/Application Support/JetBrains/WebStorm2021.2/options/recentProjects.xml

Webstorm 可执行文件

1
/Users/ljw/Library/Application Support/JetBrains/Toolbox/apps/WebStorm/ch-0/212.5284.41/WebStorm.app/Contents/MacOS/webstorm

VUEX正则替换

1
2
\{\n.+key: '(.+)',\n.+value: (.+),\n.+}
{ key: '$1', value: $2 }

pip 当前目录安装依赖

1
2
pip3 install numpy -t .
pip3 install -r requirements.txt -t .

webhook

1
pm2 start webhook --name webhook -- -hooks config.json -port 8110 -hotreload -verbose

livego

推流服务器 文档

支持多种播放协议,播放地址如下:

  • RTMP:rtmp://localhost:1935/{appname}/movie
  • FLV:http://127.0.0.1:7001/{appname}/movie.flv
  • HLS:http://127.0.0.1:7002/{appname}/movie.m3u8

获取 channelkey

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
docker run -itd \
  --name livego \
  --restart unless-stopped \
  -p 1935:1935 \
  -p 7001:7001 \
  -p 7002:7002 \
  -p 8090:8090 \
  gwuhaolin/livego

http://192.168.110.165:8090/control/get?room=movie

flv文件推流

1
2
3
4
ffmpeg -re -stream_loop -1 -i "/Users/ljw/Downloads/demo.flv" -c copy -f flv "rtmp://192.168.110.165:1935/live/L17LTlsVqMNTZyLKMIFSD2x28MlgPJ0SDZVHnHJPxMKi0tWx"

http://192.168.110.165:7001/live/movie.flv
http://192.168.110.165:7002/live/movie.m3u8

rtsp 推流

1
2
3
4
5
ffmpeg -re -rtsp_transport tcp -i "rtsp://admin:HuaWei123@192.168.110.102:10554/LiveMedia/ch1/Media1" -vcodec copy -acodec copy -f flv "rtmp://192.168.110.165:1935/live/rfBd56ti2SMtYvSgD5xAV0YU99zampta7Z7S575KLkIZ9PYk"

http://192.168.110.165:7001/live/camera.flv
http://192.168.110.165:7002/live/camera.m3u8
https://camera.local.laijw.com/flv/live/camera.flv

OBS 推流

1
2
rtmp://192.168.110.165:1935/live
u3pQJ71N5GWfOIGTdSWXbRLGAwD1IkzuZ5G1pEDzqqm3sncC

线上环境 Nginx 配置

1
2
3
/data/site/estate_bsgoal_net_cn/download/weadmin
cd /data/site/estate_bsgoal_net_cn/ROOT
vim /usr/local/openresty/nginx/conf/vhost/estate_bsgoal_net_cn.conf

Nginx 开机自启

vi /etc/init.d/nginx

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
#
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf

########### need to modify the path ###################
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/nginx.pid
#######################################################

RETVAL=0
prog="nginx"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $nginxd ] || exit 0

# Start nginx daemons functions.
start() {

  if [ -e $nginx_pid ]; then
    echo "nginx already running...."
    exit 1
  fi

  echo -n $"Starting $prog: "
  daemon $nginxd -c ${nginx_config}
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
  return $RETVAL

}

# Stop nginx daemons functions.
stop() {
  echo -n $"Stopping $prog: "
  killproc $nginxd
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}

# reload nginx service functions.
reload() {

  echo -n $"Reloading $prog: "
  $nginxd -s reload
  #if your nginx version is below 0.8, please use this command: "kill -HUP `cat ${nginx_pid}`"
  RETVAL=$?
  echo

}

# See how we were called.
case "$1" in
start)
  start
  ;;

stop)
  stop
  ;;

reload)
  reload
  ;;

restart)
  stop
  start
  ;;

status)
  status $prog
  RETVAL=$?
  ;;
*)
  echo $"Usage: $prog {start|stop|restart|reload|status|help}"
  exit 1
  ;;
esac

exit $RETVAL

保存脚本文件后设置文件的执行权限

1
chmod a+x /etc/init.d/nginx

注册成服务

1
chkconfig --add /etc/init.d/nginx

设置开机启动

1
chkconfig nginx on

对 nginx 服务执行停止/启动/重新读取配置文件操作

1
2
3
4
systemctl start nginx.service
systemctl stop nginx.service
systemctl restart nginx.service
systemctl reload nginx.service

Git 忽略证书验证

1
git config --global http.sslVerify false

UserLAnd 默认端口

GitHub

1
2
ssh laijw@127.0.0.1 -p 2202
vnc 127.0.0.1:5951

Docker phpRedisAdmin

Github

1
2
3
4
5
6
7
docker run -itd \
  --name phpredisadmin \
  --restart unless-stopped \
  -e REDIS_1_HOST=192.168.110.19 \
  -e REDIS_1_NAME=BSG \
  -p 8150:80 \
  erikdubbelboer/phpredisadmin

Docker adguardhome

Github

1
2
3
4
5
6
7
docker run --name adguardhome \
  --restart unless-stopped \
  -v ~/WWW/docker/adguardhome/work:/opt/adguardhome/work \
  -v ~/WWW/docker/adguardhome/conf:/opt/adguardhome/conf \
  -p 53:53/tcp -p 53:53/udp \
  -p 8160:80/tcp -p 8170:3000/tcp \
  -d adguard/adguardhome

QtScrcpy

Github

无线连接步骤(保证手机和电脑在同一个局域网):

  1. 安卓手机端在开发者选项中打开usb调试
  2. 通过usb连接安卓手机到电脑
  3. 点击刷新设备,会看到有设备号更新出来
  4. 点击获取设备IP
  5. 点击启动adbd
  6. 无线连接
  7. 再次点击刷新设备,发现多出了一个IP地址开头的设备,选择这个设备
  8. 启动服务

备注:启动adbd以后不用再连着usb线了,以后连接断开都不再需要,除非安卓adbd停了需要重新启动

界面按钮介绍:

  • 启动配置:启动服务前的功能参数设置

    分别可以设置本地录制视频的比特率、分辨率、录制格式、录像保存路径等。

    • 仅后台录制:启动服务不现实界面,只是录制Android设备屏幕
    • 窗口置顶:Android设备视频窗口置顶显示
    • 自动息屏:启动服务以后,自动关闭Android设备屏幕节省电量
    • 使用reverse:服务启动模式,出现服务启动失败报错more than one device可以去掉这个勾选尝试连接
  • 刷新设备列表:刷新当前连接的设备

  • 启动服务:连接到Android设备

  • 停止服务:断开与Android设备的连接

  • 停止所有服务:断开所有已连接的Android设备

  • 获取设备ip:获取到Android设备的ip地址,更新到“无线”区域中,方便进行无线连接

  • 启动adbd:启动Android设备的adbd服务,无线连接之前,必须要启动。

  • 无线连接:使用无线方式连接Android设备

  • 无线断开:断开无线方式连接的Android设备

  • adb命令行:方便执行自定义adb命令(目前不支持阻塞命令,例如shell)

主要功能

  • 实时显示Android设备屏幕

  • 实时键鼠控制Android设备

  • 屏幕录制

  • 截图为png

  • 无线连接

  • 最多支持16台设备连接(PC性能允许的情况下可以增加,需要自己编译)

  • 全屏显示

  • 窗口置顶

  • 安装apk:拖拽apk到视频窗口即可安装

  • 传输文件:拖拽文件到视频窗口即可发送文件到Android设备

  • 后台录制:只录制,不显示界面

  • 复制粘贴

    在计算机和设备之间双向同步剪贴板:

    • Ctrl + c将设备剪贴板复制到计算机剪贴板;
    • Ctrl + Shift + v将计算机剪贴板复制到设备剪贴板;
    • Ctrl +v 将计算机剪贴板作为一系列文本事件发送到设备(不支持非ASCII字符)。
  • 群控

快捷键

功能快捷键(Windows)快捷键 (macOS)
切换全屏Ctrl+fCmd+f
调整窗口大小为 1:1Ctrl+gCmd+g
调整窗口大小去除黑边Ctrl+w | 左键双击Cmd+w | 左键双击
点击 主页Ctrl+h | 点击鼠标中键Ctrl+h | 点击鼠标中键
点击 BACKCtrl+b | 右键双击Cmd+b | 右键双击
点击 APP_SWITCHCtrl+sCmd+s
点击 MENUCtrl+mCtrl+m
点击 VOLUME_UPCtrl+ (上)Cmd+ (上)
点击 VOLUME_DOWNCtrl+ (下)Cmd+ (下)
点击 POWERCtrl+pCmd+p
打开电源右键双击右键双击
关闭屏幕 (保持投屏)Ctrl+oCmd+o
打开下拉菜单Ctrl+nCmd+n
关闭下拉菜单Ctrl+Shift+nCmd+Shift+n
复制到剪切板Ctrl+cCmd+c
剪切到剪切板Ctrl+xCmd+x
同步剪切板并粘贴Ctrl+vCmd+v
注入电脑剪切板文本Ctrl+Shift+vCmd+Shift+v

鼠标左键双击黑色区域可以去除黑色区域

如果电源关闭,鼠标右键双击打开电源;如果电源开启,鼠标右键双击相当于返回

JS 正则表达式提取手机号

1
str.match(/\d{11}/g)

Docker nginx-proxy-manager

nginx-proxy-manager

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
docker run -d \
  --restart always \
  --name=nginx-proxy-manager \
  -p 8080:80 \
  -p 8181:81 \
  -p 4443:443 \
  -e "DB_MYSQL_HOST=192.168.110.165" \
  -e "DB_MYSQL_PORT=3306" \
  -e "DB_MYSQL_USER=root" \
  -e "DB_MYSQL_PASSWORD=LFp6nM3NA6KttiRw" \
  -e "DB_MYSQL_NAME=root" \
  -v ~/WWW/docker/proxy/data:/data \
  -v ~/WWW/docker/proxy/letsencrypt:/etc/letsencrypt \
  jc21/nginx-proxy-manager:latest

Docker Jenkins

1
2
3
4
5
docker run -d \
  --restart unless-stopped \
  --name jenkins \
  -p 8300:8080 \
  jenkinsci/blueocean

获取初始化密码

1
2
docker exec -it jenkins bash
cat /var/jenkins_home/secrets/initialAdminPassword

Docker Redis

1
2
3
4
5
docker run -d \
  --restart always \
  --name redis \
  -p 6379:6379 \
  redis:5.0-alpine

aliyun-log-cli

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
pip3 install -U aliyun-log-cli

aliyunlog log get_log_all \
  --project="bsg-device-log" \
  --logstore="bsg-mkj-android-log" \
  --query="SN" \
  --from_time="2022-02-22 08:30:00+08:00" \
  --to_time="2022-02-22 08:31:00+08:00" \
  --region-endpoint="cn-shenzhen.log.aliyuncs.com" \
  --format-output=no_escape \
  --jmes-filter="join('\n', map(&to_string(@), @))" \
  --access-id="LTAIAdoWQrS14ocT" \
  --access-key="qdXaRZzrvJfBT5laW3d4ZeIMFFTiIN" \
  >> log.json

wvp_pro

Github

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
docker run -itd \
  --restart unless-stopped \
  --name wvp_pro \
  -p 80:80 \
  -p 18080:18080 \
  -p 1935:1935 \
  -p 5060:5060/tcp \
  -p 5060:5060/udp \
  --env WVP_IP="192.168.110.165" \
  648540858/wvp_pro

OBS 推流

1
2
rtmp://192.168.110.165:1935/live/test
035c73f7-bb6b-4889-a715-d9eb2d1925cc

Docker 木及简历

1
2
3
4
5
docker run -d \
  --restart unless-stopped \
  --name muji \
  -p 8300:80 \
  yanzhiwei147/muji