我正在做一个项目,我想将数据包写入 RTMP 容器。
我所取得的成就是:
- 使用 RED5 启动一个监听 RTMP 请求的应用程序。让我们说 rtmp://localhost/myapp
- 我可以使用 IContainerFormat 的输出格式打开 IContainer,例如 ("flv", "rtmp://localhost/myapp/test", null)
出了什么问题:
- 我想将数据包写入这个为我打开的 RTMP 通道。
- 问题是 FFMPEG 开始给出错误 32。与此错误相关的一些搜索表明,这通常是因为客户端 - 服务器数据消耗之间存在滞后。但我真的无法解决这个问题。我搜索了很多,但每个人都在为同样的问题哭泣。我得到的错误是:
- 我想将数据包写入这个为我打开的 RTMP 通道。
12:57:20.242 [Thread-0] 错误 org.ffmpeg - WriteN,RTMP 发送错误 32(129 字节) 12:57:20.246 [Thread-0] 错误 org.ffmpeg - WriteN,RTMP 发送错误 32(45 字节) 12:57:20.246 [Thread-0] 错误 org.ffmpeg - WriteN,RTMP 发送错误 9(42 字节)
这是我在 Red5 服务器上收到的错误
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Provider connect
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Stream start
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Provider connect
[ERROR] [NioProcessor-1] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Error decoding buffer
org.red5.server.net.protocol.ProtocolException: Error during decoding
at org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decode(RTMPProtocolDecoder.java:203) [red5.jar:na]
at org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeBuffer(RTMPProtocolDecoder.java:122) [red5.jar:na]
at org.red5.server.net.rtmp.codec.RTMPMinaProtocolDecoder.decode(RTMPMinaProtocolDecoder.java:61) [red5.jar:na]
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:225) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969) [mina-core-2.0.0-RC1.jar:na]
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) [mina-core-2.0.0-RC1.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_07]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_07]
Caused by: java.lang.IllegalArgumentException: null
at java.nio.Buffer.limit(Unknown Source) [na:1.7.0_07]
at org.red5.io.amf.Input.bufferToString(Input.java:275) [red5.jar:na]
at org.red5.io.amf.Input.getString(Input.java:258) [red5.jar:na]
at org.red5.io.amf.Input.readPropertyName(Input.java:565) [red5.jar:na]
at org.red5.io.amf.Input.readKeyValues(Input.java:351) [red5.jar:na]
at org.red5.io.amf.Input.readSimpleObject(Input.java:501) [red5.jar:na]
at org.red5.io.amf.Input.readObject(Input.java:537) [red5.jar:na]
at org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeStreamMetadata(RTMPProtocolDecoder.java:978) [red5.jar:na]
at org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeMessage(RTMPProtocolDecoder.java:564) [red5.jar:na]
at org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodePacket(RTMPProtocolDecoder.java:385) [red5.jar:na]
at org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decode(RTMPProtocolDecoder.java:190) [red5.jar:na]
... 18 common frames omitted
[WARN] [NioProcessor-1] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Closing connection because decoding failed: RTMPMinaConnection from 127.0.0.1 : 44814 to localhost (in: 3569 out 3521 )
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Close
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Provider disconnect
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Provider disconnect
[INFO] [NioProcessor-1] org.red5.server.net.rtmp.RTMPHandler - Connecting to: [Scope@5f524524 Depth = 2, Path = '/default/myapp', Name = 'test']
[INFO] [NioProcessor-1] org.red5.server.net.rtmp.RTMPHandler - Remembering client buffer on stream: 300
[ERROR] [NioProcessor-1] org.red5.server.service.ServiceInvoker - Method FCSubscribe with parameters [teststream] not found in org.red5.core.Application@b9e19da
[WARN] [NioProcessor-1] org.red5.server.stream.PlayEngine - Subscribe to teststream provider failed
我是媒体流的新手,所以不确定我是否遗漏了什么。
提前致谢。