经过评估,官方提供的fedora不适合做音视频编解码处理,但是可以尝试做一下server。所以可以做一下直播服务器。
首先安装下nginx-rtmp服务,方法如下:
wget https://nginx.org/download/nginx-1.18.0.tar.gz
tar zxvf nginx-1.18.0.tar.gz
git clone https://github.com/arut/nginx-rtmp-module.git
cd nginx-1.18.0
./configure --add-module=/home/riscv/nginx-rtmp-module
make && make install
然后配置nginx.conf,配置支持rtmp server,配置如下:
[riscv@fedora-starfive nginx]$ cat /usr/local/nginx/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4000;
application mytv {
live on;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
[riscv@fedora-starfive nginx]$
然后启动nginx即可 sudo /usr/local/nginx/sbin/nginx
不过需要放开1935的tcp端口,因为rtmp的server配置的是1935
然后在本地用ffmpeg推个流试一下ffmpeg -re -f lavfi -i testsrc2=1280x720:r=25 -vcodec libx264 -g 25 -b:v 500k -f flv rtmp://172.17.10.64:1935/mytv/hello
推流完事后播放看一下效果:
|