FFmpeg 可以吗?
例如,如果我使用 Adobe 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
当我使用 Adobe 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/