首页 > 解决方案 > 在 http 连接上触发 exec_pull

问题描述

exec_pull是否可以在http连接上触发?例如,我有以下Nginx配置:

server {

 listen 80;

location /hls {

  types {
    application/vnd.apple.mpegurl m3u8;
    video/mp2t ts;
  }

                  root /mnt;
                  add_header Cache-Control no-cache;
                  index index.m3u8 index.ts;
                  add_header Access-Control-Allow-Origin *;
            }
        }

}

rtmp {

    server {
        listen 1935;
        allow play all;

application hls {

live on;
exec_options on;

exec_pull /usr/bin/ffmpeg -re -i http://example.com:333/293.m3u8 -c copy -f flv rtmp://localhost:1935/hls/$name;
}

application hls {

    live on;
    hls on;
    hls_path /mnt/hls;
    hls_fragment 3s;
}

     }
  }

我想exec_pull触发 HLS http 请求。例如,如果我请求http://my-serverip.com/hls/293.m3u8那么它应该启动 ffmpeg 来开始创建hls文件。

我已经为此工作了 5-6 天,无法弄清楚如何触发exec_pullhttp 请求。

标签: nginxffmpeghttp-live-streamingrtmp

解决方案


推荐阅读