1 Star 1 Fork 1

idler41 / media-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ubuntu 服务器安装

  1. 去除开机耗时问题
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
  1. 卸载无用软件
# 移除 cloud-init 软件包及文件夹
sudo apt purge cloud-init -y
sudo rm -rf /etc/cloud && sudo rm -rf /var/lib/cloud/
  1. 设置时区无效
sudo timedatectl set-timezone Asia/Shanghai
  1. 安装docker
# 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
  1. docker-compose安装
# 查看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
  1. 安装集显驱动
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
MIT License Copyright (c) 2023 idler41 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

摄像头web在线监控,无需安装插件,windows/linux跨平台,支持软/硬解码,同时多屏播放 展开 收起
Java 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/idler41/media-server.git
git@gitee.com:idler41/media-server.git
idler41
media-server
media-server
master

搜索帮助