red5 接受 rtmp 流 使用 saveas 或者 record 方式推送 进行录制流问题

2016-03-05 14:03:15 +08:00
 s451124894

red5 服务端接受 rtmp 流 h.264 编码 进行保存 报错 求解决办法
@Override
public void streamPublishStart(IBroadcastStream stream) {
String streamName=stream.getPublishedName();
iapp = new Application();
iconn = Red5.getConnectionLocal();//得到当前的连接
iscope = iconn.getScope();//一组连入服务器的客户
iapp.connect(iconn,iscope,null);
System.out.println("connection Established!");
//注意 stream name ,在 flash 端也需要匹配
istream = (ClientBroadcastStream)iapp.getBroadcastStream(iscope,streamName);
System.out.println("The publisher's name is: "+stream.getPublishedName()+", created at: "+stream.getCreationTime());
System.out.println("the stream Name is: "+streamName);
try {
istream.saveAs(streamName, false);
System.out.println(istream.toString()+"__Sd");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

super.streamPublishStart(stream);

}
报错内容
[WARN] [Red5_Scheduler_Worker-12] org.red5.server.stream.consumer.FileConsumer - Exception waiting for write result. Timeout: 500ms
java.util.concurrent.ExecutionException: java.nio.InvalidMarkException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:262) ~[na:1.7.0]
at java.util.concurrent.FutureTask.get(FutureTask.java:119) ~[na:1.7.0]
at org.red5.server.stream.consumer.FileConsumer.acquireWriteFuture(FileConsumer.java:370) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.consumer.FileConsumer.writeQueuedDataSlice(FileConsumer.java:284) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.consumer.FileConsumer.pushMessage(FileConsumer.java:273) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.RecordingListener.processQueue(RecordingListener.java:303) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.RecordingListener.access$300(RecordingListener.java:57) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.RecordingListener$EventQueueJob.execute(RecordingListener.java:367) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.scheduling.QuartzSchedulingServiceJob.executeInternal(QuartzSchedulingServiceJob.java:89) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:112) [spring-context-support-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.1.7.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-2.1.7.jar:na]
Caused by: java.nio.InvalidMarkException: null
at java.nio.Buffer.reset(Buffer.java:298) ~[na:1.7.0]
at org.apache.mina.core.buffer.AbstractIoBuffer.reset(AbstractIoBuffer.java:414) ~[mina-core-2.0.8.jar:na]
at org.red5.io.flv.impl.FLVWriter.writeTag(FLVWriter.java:312) ~[red5-io-1.0.5-RELEASE.jar:na]
at org.red5.server.stream.consumer.FileConsumer.write(FileConsumer.java:633) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.consumer.FileConsumer.doWrites(FileConsumer.java:541) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.stream.consumer.FileConsumer$1.run(FileConsumer.java:289) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) ~[na:1.7.0]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) ~[na:1.7.0]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) ~[na:1.7.0]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) ~[na:1.7.0]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) ~[na:1.7.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) ~[na:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) ~[na:1.7.0]
at java.lang.Thread.run(Thread.java:722) ~[na:1.7.0]

3010 次点击
所在节点    Java
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/261300

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX