在nginx_rtmp_module上未创建HLS文件(.m3u8,.ts)

时间:2018-03-06 05:35:05

标签: nginx ffmpeg

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

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

我在Docker上测试(amazonlinux图片)。

我可以通过VLC播放器访问和播放http://localhost:8088/live/camera1.m3u8,但无法访问docker run -it -p 8088:8088 -p 1935:1935 -v $(pwd):/tmp/share amazonlinux bash

docker run命令:

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;
    }
  }
}

nginx.conf:

rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

ffmpeg命令:(使用示例视频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 &

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

ffmpeg版本:

nginx version: nginx/1.13.9

nginx版本:nginx-rtmp-module-1.2.1

nginx_rtmp_module版本: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

和目录权限:

    @IBAction func btnChooseImageAction(_ sender: Any) {

    if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum   {
        print("Button capture")

        imagePicker.delegate = self
        imagePicker.sourceType = .savedPhotosAlbum;
        imagePicker.allowsEditing = false

        self.present(imagePicker, animated: true, completion: nil)
        }
     }

...帮助

1 个答案:

答案 0 :(得分:0)

我解决了自己。

我发现自己在README中写了GUESS C0001G1 GENTS ROSE GOLD TONE AND BLUE BRUSH POLISHED SMART WATCH WITH VOICE COMMAND. FITTED WITH A BLUE SMOOTH SILICONE STRAP.BOXED AND PAPERS. RRP £259.00 GUESS I14503L1 LADIES SPORT WATCH WITH POLISHED SILVER COLOUR CASE WITH CRYSTALS, SILVER DIAL AND POLISHED SILVER COLOUR BRACELET. RRP £159 GUESS W0111L2 LADIES WATCH. POLISHED GOLD COLOUR CASE WITH CRYSTALS AND GOLD COLOUR MULTI-FUNCTION DIAL AND BRACELET. RRP £189 GUESS W0072L3 LADIES TREND WATCH. POLISHED ROSE GOLD CASE WITH CRYSTALS AND ROSE GOLD DIAL. POLISHED ROSE GOLD MULTI-CHAIN BRACELET WITH ADJUSTING G-LINK. RRP £159 GUESS W0330L2 LADIES SPORT WATCH. POLISHED ROSE GOLD COLOUR CASE WITH ROSE GOLD COLOUR CHRONO LOOK MULTI FUNCTION DIAL AND ROSE GOLD COLOUR BRACELET. RRP £169 GUESS W13573L1 LADIES SPORT WATCH. POLISHED GOLD COLOURED CASE WITH CRYSTAL AND WHITE MULTI FUNCTION DAIL AND POLISHED GOLD COLOURED BRACELET. RRP £169 GUESS W0674G6 MENS WATCH. ROSE GOLD CASE WITH BLACK TRIM AND SUN/ BLACK MULTI FUNCTION DIAL AND BLACK CROCODILE STYLE LEATHER BRACELET. RRP £169 GUESS W0564L1 LADIES SPORT WATCH. ROSE GOLD COLOUR CASING WITH BLUE TRIM AND CRYSTALS, WHITE MULTI FUNCTION DIAL WITH SMOOTH SILICONE STRAP. RRP £149 GUESS W0425L3 LADIES SPORT WATCH. POLISHED ROSE GOLD/ ANIMAL PRINT CASE AND SUN ROSE GOLD AND ANIMAL DAIL WITH POLISHES ROSE GOLD AND ANIMAL PRINT BRACELET. RRP £189 ...

因此,我将Incoming stream must be in H264/AAC.添加到ffmpeg命令中:

-vcodec libx264