java输入流cpu_为什么HLS流需要这么多CPU?

我想在Debian机器上使用 nginx+rtmp module 重新启动网络摄像头 . 当我重新调整一个凸轮时,它工作得很好而且流畅,但它占用了很多CPU:

这是我的配置:

user www-data;

worker_processes auto;

pid /run/nginx.pid;

include /etc/nginx/modules-enabled/*.conf;

events {

worker_connections 1024;

}

rtmp_auto_push on;

rtmp {

live on;

hls on;

hls_fragment 5s;

respawn_timeout 15s;

chunk_size 8192;

server {

listen 1935;

application cam1 {

hls_path /tmp/cam1;

}

exec_static /usr/bin/ffmpeg -i http://cam-ip:8080/flv?login=user&channelid=channalid&password=pass&count=0

-acodec copy -vcodec libx264 -vprofile baseline -f flv rtmp://server-ip/cam1/stream;

}

}

http {

server {

listen 8080;

location /stat {

rtmp_stat all;

rtmp_stat_stylesheet stat.xsl;

}

location stat.xsl {

root /stat;

}

location / {

types {

application/vnd.apple.mpegurl m3u8;

video/mp2t ts;

}

root /tmp/;

add_header Cache-Control no-cache;

add_header Access-Control-Allow-Origin *;

add_header 'Access-Control-Expose-Headers' 'Content-Length';

if ($request_method = 'OPTIONS') {

add_header 'Access-Control-Allow-Origin' '*';

add_header 'Access-Control-Max-Age' 1728000;

add_header 'Content-Type' 'text/plain charset=UTF-8';

add_header 'Content-Length' 0;

return 204;

}

}

}

sendfile on;

tcp_nopush on;

tcp_nodelay on;

keepalive_timeout 65;

types_hash_max_size 2048;

include /etc/nginx/mime.types;

default_type application/octet-stream;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE

ssl_prefer_server_ciphers on;

access_log /var/log/nginx/access.log;

error_log /var/log/nginx/error.log;

gzip on;

gzip_disable "msie6";

include /etc/nginx/conf.d/*.conf;

}

之后我在配置中添加了12个网络摄像头,当我看到凸轮时,我得到了可怕的滞后 . 并且100%的CPU使用率:

为什么我在htop中有这么多的ffmpeg进程?

为什么需要这么多CPU呢?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值