sudo vi /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service
[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-networkd-wait-online
RemainAfterExit=yes
# 添加内容
TimeoutStartSec=1sec
# 移除 cloud-init 软件包及文件夹
sudo apt purge cloud-init -y
sudo rm -rf /etc/cloud && sudo rm -rf /var/lib/cloud/
sudo timedatectl set-timezone Asia/Shanghai
# docker安装
sudo apt-get update
# 安装以下包,以使apt可以通过https来使用repository
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
# 添加Docker官方的GPG密钥并更新索引包
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# 设定稳定存储库 lsb_release -cs命令获取到的名称即可
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt-get update
# 查看支持的docker版本号
apt-cache madison docker-ce
# 安装指定版本docker
sudo apt-get -y install docker-ce=5:20.10.9~3-0~ubuntu-bionic
# 添加用户组
sudo groupadd docker
# 添加当前用户到docker (执行docker命令不用加sudo)
sudo usermod -aG docker $USER
# 开机启动docker
systemctl enable docker.service
# 验证是否开机启动
systemctl is-enabled docker.service
# 查看python版本
python3 -V
# 设置python3为默认python
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3.6 /usr/bin/python
# 安装pip (apt-get --purge remove -y python-pip)
sudo apt-get install -y python3-pip
# 配置pip3国内镜像源
sudo mkdir ~/.pip
sudo tee ~/.pip/pip.conf >/dev/null <<EOF
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
EOF
# 避免安装docker-compose报错
sudo pip3 install --upgrade pip
sudo pip3 install paramiko
# 安装docker-compose
sudo pip3 install docker-compose==1.29.2
lspci |grep -i vga
# 查看gpu使用情况
sudo apt-get install -y intel-gpu-tools
docker run --rm -it \
--device=/dev/dri:/dev/dri \
-v /home/zjl/ffmpeg:/config \
linuxserver/ffmpeg:version-4.4-cli \
-vaapi_device /dev/dri/renderD128 \
-i 'rtsp://admin:zjl12345@192.168.2.12:554/Streaming/Channels/1' \
-c:v h264_vaapi \
-b:v 4M \
-vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \
-c:a copy \
/config/output.mkv
docker run --rm -it \
--privileged=true \
--device=/dev/dri:/dev/dri \
-v /home/zjl/ffmpeg:/config \
jrottenberg/ffmpeg:4.1-vaapi \
-vaapi_device /dev/dri/renderD128 \
-i 'rtsp://admin:zjl12345@192.168.2.12:554/Streaming/Channels/1' \
-c:v h264_vaapi \
-b:v 4M \
-vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \
-c:a copy \
/config/output.mkv
tee /etc/apt/sources.list >/dev/null <<EOF
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
EOF
tee /etc/apt/sources.list >/dev/null <<EOF
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
EOF
ffmpeg -rtsp_transport tcp -i 'rtsp://admin:zjl12345@192.168.2.12:554/Streaming/Channels/1' -c:v libx265 -an -f mp4 a.mp4
ffmpeg -rtsp_transport tcp -i "rtsp://admin:zjl12345@192.168.1.50:554/Streaming/Channels/1" -vcodec hevc_qsv -an -f mp4 a.mp4
ffmpeg -vaapi_device /dev/dri/renderD128 -rtsp_transport tcp -i 'rtsp://admin:zjl12345@192.168.2.12:554/Streaming/Channels/1' -c:v h264_vaapi -vf 'format=nv12,hwupload' -c:a aac out.MP4
ffmpeg -vaapi_device /dev/dri/renderD128 -rtsp_transport tcp -i rtsp://admin:zjl12345@192.168.2.12:554/Streaming/Channels/1 -max_delay 1 -g 25 -r 25 -c:v h264_vaapi -preset:v ultrafast -c:v copy -strict -2 -tune:v zerolatency -c:a aac -pix_fmt yuv420p -crf 28 -threads 4 -flvflags no_duration_filesize -s 1280x720 -f flv out.flv
ffmpeg -vaapi_device /dev/dri/renderD128 -rtsp_transport tcp -i rtsp://admin:zjl12345@192.168.2.12:554/Streaming/Channels/1 -max_delay 1 -g 25 -r 25 -c:v h264_vaapi -preset:v ultrafast -c:v copy -strict -2 -tune:v zerolatency -c:a aac -pix_fmt yuv420p -crf 28 -threads 4 -flvflags no_duration_filesize -s 1280x720 -f flv tcp://127.0.0.1:1389
docker run -it --device=/dev/dri:/dev/dri ffmpeg-java8:1.0 bash
原网址: 访问
创建于: 2024-06-11 15:46:48
目录: default
标签: 无
未标明原创文章均为采集,版权归作者所有,转载无需和我联系,请注明原出处,南摩阿彌陀佛,知识,不只知道,要得到
最新评论