【问题标题】:Transcode H264 stream into mpeg2 with ffmpeg and nginx-rtmp module使用 ffmpeg 和 nginx-rtmp 模块将 H264 流转码为 mpeg2
【发布时间】:2014-08-30 15:33:48
【问题描述】:

我正在使用 nginix 网络服务器和 nginx-rtmp 模块来管理以 h264 编码的视频流。这是我的 nginx 配置文件:

rtmp {
server {
    listen 1935;

    application big {
        live on;

    exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec 
         libx264 -vprofile baseline -acodec libvo_aacenc -ac 1 -ar 441000 
         -f flv rtmp://localhost:1935/hls/${name};
      }
   }

   application hls
   {
      live on;
      hls_path /usr/local/nginx/html/video;
   }
}

它在浏览器中运行良好,但是因为我的移动客户端是 Adob​​e Air,它只能在 Android 上运行,而不能在 Apple 上运行,因为 Apple 不支持通过 AIR 应用程序进行 H264 编码,所以我试图将流转码为支持的东西例如 mpeg。这就是我改变我的ffmpeg的方式:

    exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec 
         mpeg2video -acodec copy -b:v 10M -b:a 128k 
         -f mpegts rtmp://localhost:1935/hls/${name};

但是它不会在浏览器或设备上显示视频,我的假设是它可能无法转码。

也许我错过了什么?任何想法都受到高度赞赏。 谢谢。

【问题讨论】:

    标签: nginx air ffmpeg video-streaming rtmp


    【解决方案1】:

    您可能已经得到了答案,但以防万一:

    您没有正确使用该模块, 1) 在 iOS 上,您需要将浏览器指向 http://localhost:80/hls/${name} 以获取 HLS 流。 2)您在配置中缺少生成 HLS 流的 http 部分

    详情请看这里:How can we transcode live rtmp stream to live hls stream using ffmpeg?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-16
      • 2016-07-25
      • 1970-01-01
      • 2018-10-07
      • 2018-07-12
      • 2021-03-15
      • 2013-11-08
      • 2020-05-12
      相关资源
      最近更新 更多