【问题标题】:HLS files(.m3u8, .ts) does not created on nginx_rtmp_moduleHLS 文件(.m3u8,.ts)不在 nginx_rtmp_module 上创建
【发布时间】:2018-03-06 14:06:50
【问题描述】:

我想使用 ffmpeg 和 nginx_rtmp_module 将 RTSP 转码为 RTMP 转 HLS。

但没有创建 HLS 文件(.m3u8、.ts)。

我正在 Docker(amazonlinux 镜像)上进行测试。

我可以通过VLC Player访问和播放rtmp://localhost:1935/live/camera1,但无法访问http://localhost:8088/live/camera1.m3u8

docker 运行命令:

docker run -it -p 8088:8088 -p 1935:1935 -v $(pwd):/tmp/share amazonlinux bash

nginx.conf:

user root;
worker_processes  1;
error_log  /var/log/nginx/error.log debug;

events {
  worker_connections  1024;
}

rtmp {
  server {
    listen 1935;
    access_log  /var/log/nginx/rtmp_access.log;
    application live {
      live on;
      hls on;
      hls_path /usr/local/nginx/html/hls;
      hls_fragment 5s;
      hls_type live;
      hls_nested on;
    }
  }
}

http {
  server {
    listen      8088;

    location / {
      root /usr/local/nginx/html/;
    }

    location /hls {
      types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts;
        text/html html;
      }

      alias /usr/local/nginx/html/hls;
    }
  }
}

ffmpeg 命令:(使用示例视频rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

nohup /root/ffmpeg_sources/ffmpeg/ffmpeg -i "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov" -f flv -s 320x240 -an "rtmp://localhost:1935/live/camera1" </dev/null &

ffmpeg 版本:

bash-4.2# /root/ffmpeg_sources/ffmpeg/ffmpeg -version
ffmpeg version N-90214-gdd3f1e3 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/bin --enable-gpl --enable-libx264 --enable-nonfree
libavutil      56.  8.100 / 56.  8.100
libavcodec     58. 13.102 / 58. 13.102
libavformat    58. 10.100 / 58. 10.100
libavdevice    58.  2.100 / 58.  2.100
libavfilter     7. 12.100 /  7. 12.100
libswscale      5.  0.102 /  5.  0.102
libswresample   3.  0.101 /  3.  0.101
libpostproc    55.  0.100 / 55.  0.100

nginx版本:nginx version: nginx/1.13.9

nginx_rtmp_module 版本:nginx-rtmp-module-1.2.1

和目录权限:

bash-4.2# pwd
/usr/local/nginx/html
bash-4.2# ls -l
total 48
-rw-r--r-- 1 root root   537 Mar  5 07:24 50x.html
drwxrwxrwx 2 root root  4096 Mar  6 04:46 hls
-rw-r--r-- 1 root root   612 Mar  5 07:24 index.html
-rw------- 1 root root 36262 Mar  6 04:46 nohup.out

帮助...

【问题讨论】:

    标签: nginx ffmpeg


    【解决方案1】:

    我自己解决了。

    我发现Incoming stream must be in H264/AAC. 写在自述文件中。

    所以,我在 ffmpeg 命令中添加了-vcodec libx264

    nohup /root/ffmpeg_sources/ffmpeg/ffmpeg -stream_loop -1 -i "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov" -vcodec libx264 -f flv -s 320x240 -an "rtmp://localhost:1935/live/camera1" </dev/null &
    

    【讨论】:

      猜你喜欢
      • 2012-07-24
      • 2019-02-02
      • 1970-01-01
      • 2016-07-27
      • 1970-01-01
      • 2018-06-21
      • 2018-11-14
      • 2011-03-13
      • 2020-12-30
      相关资源
      最近更新 更多