c++ - 使用 FFmpeg 使用 session ID 通过 RTMP 连接到 nginx 服务器

标签 c++ nginx ffmpeg

FFmpeg 可以吗? 例如,如果我使用 Adob​​e ActionScript 中的 NetConnection.connect() 方法,我可以使用以下命令发送 session ID:

connection.connect(_server, _sessionId);

我使用这个字符串通过 FFmpeg 发布流:

ffmpeg -re -i D:\input.mp4 -c:v h264 -c:a aac -ar 8000 -ac 2 -f flv "rtmp://stream138.loadup.ru:443/broadcast/12950324_9893717_05515b7ad41d7e58005c14d3ff2c7947"

然后出现错误:

RTMP_ReadPacket, failed to read RTMP packet header:
rtmp://stream138.loadup.ru:443/broadcast/12950324_9893717_05515b7ad41d7e58005c14d3ff2c7947: Unknown error occured

当我使用 Adob​​e ActionScript 但使用 FFmpeg 时,是否可以执行相同的操作?

最佳答案

ffmpeg 使用 librtmp .支持的选项列在链接的手册页上。

您可以使用 conn 将任意 AMF 数据添加到连接中:

conn=type:data

Append arbitrary AMF data to the Connect message.

The type must be B for Boolean, N for number, S for string, O for object, or Z for null. For Booleans the data must be either 0 or 1 for FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or 1 to end or begin an object, respectively. Data items in subobjects may be named, by prefixing the type with 'N' and specifying the name before the value, e.g. NB:myFlag:1. This option may be used multiple times to construct arbitrary AMF sequences.

E.g.

conn=B:1 conn=S:authMe conn=O:1 conn=NN:code:1.23 conn=NS:flag:ok conn=O:0

关于c++ - 使用 FFmpeg 使用 session ID 通过 RTMP 连接到 nginx 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33869782/

相关文章:

node.js - 具有 nginx 和基本身份验证的 Node.js 服务器

python - Heroku 权限错误 : [Errno 13] Permission denied

shell - ffmpeg:如何为所有视频输出添加水印?

c++ - C++ 的 std::set 类如何为任何类型的数据结构实现二叉树?

c++ - 类派生设计

c++ - 二进制文件写入数据两次

video - AV帧数据格式

c++ - 光学字符识别 : Difference between two frames

asp.net-core - "Blocked loading mixed active content"在使用 IdentityServer4 的 Blazor WebAssembly 应用程序中

Laravel HTTPS URL 随机字符?