Jetson Nano - NVR

Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.10.104-tegra aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

Expanded Security Maintenance for Applications is not enabled.

109 updates can be applied immediately.
87 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

35 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm

Last login: Tue May 14 15:39:08 2024 from xxx.xxx.xxx.xxx

在这里插入图片描述
sudo NO PASSWORD

/home/admin>sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:
admin   ALL=(ALL) NOPASSWD:ALL

#includedir /etc/sudoers.d
sudo apt-get install -y nasm yasm cmake mercurial
sudo apt-get install -y libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
sudo apt-get install -y libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev
sudo apt-get install -y libfreetype6-dev libsdl2-dev libtheora-dev
sudo apt-get install -y autoconf automake build-essential git libass-dev

sudo apt-get install libx264-dev
sudo apt-get install libx265-dev libnuma-dev
sudo apt-get install libvpx-dev
sudo apt-get install libmp3lame-dev
sudo apt-get install libopus-dev
sudo apt-get install libfdk-aac-dev

FFMpeg

/home/mic-711on/thinking>git clone https://github.com/Keylost/jetson-ffmpeg.git
Cloning into 'jetson-ffmpeg'...
remote: Enumerating objects: 520, done.
remote: Counting objects: 100% (520/520), done.
remote: Compressing objects: 100% (227/227), done.
remote: Total 520 (delta 304), reused 468 (delta 279), pack-reused 0
Receiving objects: 100% (520/520), 359.08 KiB | 2.70 MiB/s, done.
Resolving deltas: 100% (304/304), done.
/home/mic-711on/thinking>

1.build and install library

git clone https://github.com/Keylost/jetson-ffmpeg.git
cd jetson-ffmpeg
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig

在这里插入图片描述
2.patch ffmpeg and build

git clone git://source.ffmpeg.org/ffmpeg.git -b release/6.0 --depth=1
cd ffmpeg
cp ../jetson-ffmpeg/ffmpeg_patches/ffmpeg6.0_nvmpi.patch ffmpeg_nvmpi.patch
git apply ffmpeg_nvmpi.patch
../configure --enable-nvmpi --enable-libfreetype --enable-libfribidi --enable-libx264 --enable-libx265 --enable-gpl --enable-libfdk-aac --enable-libmp3lame --enable-libvpx --enable-libopus --enable-nonfree --prefix=../install

make

在这里插入图片描述
nginx-rtmp

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
wget http://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
wget http://nginx.org/download/nginx-1.25.5.tar.gz
wge https://github.com/arut/nginx-rtmp-module/archive/master.zip
git clone https://github.com/winshining/nginx-http-flv-module.git

sudo apt-get install openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev

./configure --add-module=nginx-rtmp-module --with-http_ssl_module --prefix=../install

在这里插入图片描述
curl http://127.0.0.1
在这里插入图片描述
golang

wget https://golang.google.cn/dl/go1.22.0.linux-arm64.tar.gz

export GOROOT=$HOME/go
export GOPATH=$GOROOT/goProject
export GOPROXY=https://goproxy.cn
export PATH=$PATH:$GOROOT/bin
export GOBIN=$GOROOT/bin

Cron Job : sys-job-hourly

/home/admin/bin>sudo su - admin -c "/home/admin/bin/sys-job-hourly"
-rw-r--r-- 1 admin root 91 May 13 16:04 /home/admin/install/html/data/capacity.json
/home/admin/bin>

ini/config.ini

cat ini/config.ini | sed 's/ //g' | awk -F'=' -v section=$INISECTION -v key=$INIKEY '{if($0=="["section"]"){flag=1;next}if(/\[/){flag=0;next;}if(flag==1){if(key==$1){print $2$3$4$5$6$7$8$9}}}'

在这里插入图片描述

/home/admin/bin>sudo service cron status
● cron.service - Regular background program processing daemon
     Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-05-14 08:46:29 CST; 3h 3min ago
       Docs: man:cron(8)
   Main PID: 697 (cron)
      Tasks: 1 (limit: 8478)
     Memory: 448.0K
     CGroup: /system.slice/cron.service
             └─697 /usr/sbin/cron -f

May 14 10:30:01 ubuntu CRON[6520]: pam_unix(cron:session): session opened for user root by (uid=0)
May 14 10:30:01 ubuntu CRON[6521]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
May 14 10:30:01 ubuntu CRON[6520]: pam_unix(cron:session): session closed for user root
May 14 11:17:01 ubuntu CRON[8606]: pam_unix(cron:session): session opened for user root by (uid=0)
May 14 11:17:01 ubuntu CRON[8607]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
May 14 11:17:01 ubuntu CRON[8606]: pam_unix(cron:session): session closed for user root
May 14 11:30:01 ubuntu CRON[8698]: pam_unix(cron:session): session opened for user root by (uid=0)
May 14 11:30:01 ubuntu CRON[8699]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
May 14 11:30:01 ubuntu CRON[8698]: pam_unix(cron:session): session closed for user root
May 14 11:44:01 ubuntu cron[697]: (*system*) RELOAD (/etc/crontab)
/home/admin/bin>sudo service cron reload
 * Reloading configuration files for periodic command scheduler cron                                                                                                      [ OK ]

/etc/crontab
在这里插入图片描述

/etc/rc.local

/home/admin>sudo ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
/home/admin>sudo touch /etc/systemd/system/rc-local.service

在这里插入图片描述

sudo systemctl enable rc-local.service
sudo systemctl start  rc-local.service
sudo systemctl enable rc-local.service

arm mediamtx

wget https://github.com/bluenviron/mediamtx/releases/download/v1.8.1/mediamtx_v1.8.1_arm64.tar.gz

arm yq yml

wget https://github.com/mikefarah/yq/archive/refs/tags/v4.44.1.tar.gz
if True:
    year = datetime.date.today().year
    baseTime = datetime.datetime(2024, 1, 1, 0, 0, 0, 0)
    nowTime = datetime.datetime(2025, 1, 1, 0, 0, 0, 0)

    baseTimestamp = int(time.mktime(baseTime.timetuple()))
    nowTimestamp = int(time.mktime(nowTime.timetuple()))
    displacement = nowTimestamp - baseTimestamp

    print(baseTime, baseTimestamp, nowTimestamp, displacement)
2024-05-01 00:00:00 1714492800
2025-05-01 00:00:00 1746028800
31536000
2024-01-01 00:00:00 1704038400
2025-01-01 00:00:00 1735660800
31622400
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
wget https://golang.google.cn/dl/go1.22.0.linux-amd64.tar.gz

apt install gcc-multilib
export GOPROXY=https://goproxy.cn

go build -o mediamtx
sqlite> select 'rtsp://' || UserId || '@' || UserPwd || '@' || Address from sys_device;
rtsp://admin@rate@123@10.10.20.231
rtsp://admin@rate@123@10.10.20.234
##############################################################################
# 
##############################################################################
_MIN_=`date "+%M"`
_SEC_=`date "+%S"`
elapsed=$((($_MIN_*60 + $_SEC_)))
left=$((3600-($_MIN_*60 + $_SEC_)))

echo $_MIN_:$_SEC_ $elapsed $left
##############################################################################
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值