我正在尝试使用xuggle和red5在浏览器中生成流式视频。作为第一步,我只是尝试通过xuggle运行视频并将其显示在我的red5服务器上。问题是我不知道如何配置red5来连接我的java代码。我在这里有这个代码:
private static String outputUrl = "rtmp://localhost:5080/oflaDemo/";
private static String inputFilename = "/home/usr/jworkspace1/GetContainerInfo/aaa.ogg";
public static void main(String[] args)
{
IMediaReader mediaReader = ToolFactory.makeReader(inputFilename);
// create a media writer
IMediaWriter mediaWriter = ToolFactory.makeWriter(outputUrl, mediaReader);
// add a writer to the reader, to create the output file
mediaReader.addListener(mediaWriter);
// create a media viewer with stats enabled
IMediaViewer mediaViewer = ToolFactory.makeViewer(true);
// add a viewer to the reader, to see the decoded media
mediaReader.addListener(mediaViewer);
// read and decode packets from the source file and
// and dispatch decoded audio and video to the writer
while (mediaReader.readPacket() == null)
{
;
}
}
这给了我一个错误说:
java.lang.IllegalArgumentException: could not open: rtmp://localhost:5080/oflaDemo/
我的问题是如何打开red5从我的java程序中接收rtmp?
答案 0 :(得分:1)
我认为端口5080是http端口。
端口
默认情况下,Red5会打开以下端口:
- 5080(HTTP端口 - 嵌入式Tomcat)
- 1935(RTMP端口)
- 8443(RTMPS端口)
- 9980(JMX端口 - 管理和关闭)
您应该将端口1935用于rtmp