我已经在DigitalOcean托管的ubuntu中设置了Nginx。目前在我的桌面上以本地主机模式运行我的laravel应用程序。对直播来说,一切似乎都很顺利。我正在用本地主机JWPlayer和开放广播软件进行现场直播测试。它起作用了。但是,每当我需要将流视频记录到linux目录(/var/www)时,在OBS中单击“停止流”按钮后,似乎什么也没有发生,也没有任何错误。
我不知道录音是如何工作的,我尝试记录手册,它有链接在上面。单击start record,它将出现/var/rec/{mystream}.flv
这个手动版本的记录链接嵌入在laravel网站上:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
recorder rec1 {
record all manual;
record_suffix all.flv;
record_path /var/rec;
record_unique on;
}
}
}
}开始录音:
<a href="http://server.com/control/record/start?app=live&name=key&rec=rec1" target="_blank">Start rec1</a>http的nginx配置:
access_log logs/rtmp_access.log;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /var/www/;
}
location /control {
rtmp_control all;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}顺便提一下,,
计划B:我计划将我录制的流文件存储到Amazon s3。任何人都知道如何使用RTMP Nginx而不是使用Wowza Amazon.。
发布于 2021-02-03 11:08:02
您可以在shell脚本nginx中运行。首先检查权限:
chown -R nobody:nogroup foldername
chmod -R 700 foldernameShell脚本:
ffmpeg -v error -y -i "$1" -vcodec libx264 -acodec aac -f mp4 -movflags +faststart "/tmp/recordings/$2.mp4"
aws s3 cp "/tmp/recordings/$basname.mp4" "s3://bucketname/"
exec_record_done bash -c "/home/ubuntu/script/record.sh $path $basname";发布于 2016-10-26 14:50:53
您应该检查您试图记录到的目录上的权限(在本例中为/var/rec)。尽管Nginx是使用sudo启动的,但默认情况下,它会将工作进程生成为用户“无人”。您还可以尝试更改工作进程生成为:https://serverfault.com/a/534512/102045的用户。
发布于 2020-10-14 11:58:05
当我和我的搭档做这件事时,我会用
record_path /tmp/rec;然后在文件中设置一个crontab,永久地尝试将新文件(视频)发送到他的NextCloud FTP(在本例中可能是您的amazon )。
https://stackoverflow.com/questions/28302533
复制相似问题