Im使用Red5從用戶錄製直播流。我能夠將流保存到磁盤,並生成一個FLV文件。Red 5從直播和Xuggle生成FLV
當我想讀一些FLV播放器FLV文件 - 它看起來像文件的元數據被破壞 - 這也使得進度條奇怪的行爲。
此外,我試圖玩使用Xuggle的文件。這似乎是不可能的,因爲生成的FLV中沒有編解碼器ID。
任何見解將不勝感激。
這裏是我的相關的Red5(JAVA)代碼:
public void record(IConnection conn, String streamName)
{
ClientBroadcastStream stream = (ClientBroadcastStream) getBroadcastStream(
conn.getScope(), streamName);
try {
stream.saveAs(streamName, false);
} catch (Exception e) {
System.out.print(e.getMessage());
}
}
public void encodeWithXuggler(IConnection conn, String streamName)
{
String nm = "C:\\Program Files\\Red5\\webapps\\Red5Recorder\\streams\\"+
streamName+".flv";
File f = new File(nm);
if (f.exists()) {
IMediaReader reader = ToolFactory.makeReader(nm);
reader.addListener(ToolFactory.makeWriter("output.mov", reader));
while (reader.readPacket() == null);
} else {
System.out.print("NOT EXiST");
}
}
而且Xuggle錯誤信息獲取:
Caused by: java.lang.IllegalArgumentException: null inputCodecId at com.xuggle.xuggler.IContainerFormat.establishOutputCodecId(IContainerFormat.java:295) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaWriter.addStreamFromContainer(MediaWriter.java:1141) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaWriter.getStream(MediaWriter.java:1046) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaWriter.encodeAudio(MediaWriter.java:837) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaWriter.onAudioSamples(MediaWriter.java:1448) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.AMediaToolMixin.onAudioSamples(AMediaToolMixin.java:89) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaReader.dispatchAudioSamples(MediaReader.java:628) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaReader.decodeAudio(MediaReader.java:555) [xuggle-xuggler.jar:3.4.1012] at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:469) [xuggle-xuggler.jar:3.4.1012]
順便說一句 - 我看過這個帖子http://stackoverflow.com/questions/2760570/xuggle-codec-identification-fail但我不知道這是同一個問題 – 2010-11-25 22:08:48