gpt4 book ai didi

nginx - 使用 ffmpeg 和 nginx-rtmp 模块将 H264 流转码为 mpeg2

转载 作者:行者123 更新时间:2023-12-04 22:50:57 24 4
gpt4 key购买 nike

我正在使用 nginix Web 服务器和 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};

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

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

最佳答案

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

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

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

关于nginx - 使用 ffmpeg 和 nginx-rtmp 模块将 H264 流转码为 mpeg2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24656553/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com