2 s1139960819 s1139960819 于 2016.03.05 12:50 提问

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

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]

1个回答

Arodung
Arodung   2016.03.05 14:42

你再检查一下你的代码。。。。。。。

s1139960819
s1139960819 不是代码的问题,flex获取摄像头的流可以正常录制, 但是用obs或者ffmpeg推流给red5 就会报这个错
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!