nginx-rtmp流媒体服务器搭建【转】 (2)

(6).hls_path和location /hls{alias}的路径保持一样如:/home/dev/pengqiuyuan/streaming ,目录下面保存的是客户端推送到流服务器的m3u8、ts文件

# For more information on configuration, see: # * Official English Documentation: # * Official Russian Documentation: user nginx; worker_processes 1; #error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } rtmp { server{ listen 1935; chunk_size 4096; application hls { live on; hls on; hls_path /home/dev/pengqiuyuan/streaming; hls_fragment 11s; hls_playlist_length 55s; allow play all; } } } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; server{ listen 80; server_name ; access_log logs/redmine.access.log; error_log logs/redmine.error.log info; client_body_buffer_size 128k; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffer_size 256k; proxy_buffers 8 256k; proxy_busy_buffers_size 512k; proxy_temp_file_write_size 512k; location /stat{ rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl{ root /home/dev/pengqiuyuan/nginx-rtmp-module-master/; } location /test{ alias /home/dev/pengqiuyuan/nginx-rtmp-module-master/test/rtmp-publisher/; } location /hls{ #server hls fragments types{ application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias /home/dev/pengqiuyuan/streaming; expires -1; } } } 4.客户端部分,采集桌面视频以及ffmpeg转换以及流化音视频

之前遇到丢帧的问题,real-time buffer 276% full! frame dropped!

问题: https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/37

桌面音视频采集成功的例子:

ffmpeg -f dshow -i video=screen-capture-recorder -f dshow -i audio=virtual-audio-capturer -vf scale=1280:720 -vcodec libx264 -r 60.97 -acodec libvo_aacenc -ac 2 -ar 44100 -ab 128 -pix_fmt yuv420p -tune zerolatency -preset ultrafast -f flv "rtmp://192.168.1.50/hls/test"

ffmpeg(带脚本)下载地址,流媒体服务器搭建好之后,修改bat脚本里的推送地址“rtmp://192.168.1.50/hls/test”,直接点击运行就可以向服务器推送了,之后“/home/dev/pengqiuyuan/streaming”目录下面会生产m3u8、ts文件就成功了 下载地址:

阿里云就1M的带宽,被占的满满的,下载地址换到csdn上面好了

img

img

 

img

img

5.视频直播+实时聊天部分,之后补充

整体思路是 nginx-rtmp(流媒体服务) + nodejs(即时聊天)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzfzjy.html