问题
I am writing a Red5 application that will need to use the Xuggler library to capture an rtps stream and convert it to flv.
Here is the following code that I'm calling after the Red5 app start method is called.
private static void helloXuggler()
{
String sourceUrl = "rtsp://10.0.1.68:8554/CH001.sdp?AuthMode=Web&AuthValue=6049";
String destinationUrl = "xuggler.m4v";
System.out.printf("transcode %s -> %s\n", sourceUrl, destinationUrl);
// create the media reader, not that no BufferedImages need to be
// created because the video is not going to be manipulated
IMediaReader reader = ToolFactory.makeReader(sourceUrl);
// add a viewer to the reader, to see progress as the media is
// transcoded
//reader.addListener(ToolFactory.makeViewer(true));
// create the media writer
reader.addListener(ToolFactory.makeWriter(destinationUrl, reader));
// read packets from the source file, which dispatch events to the
// writer, this will continue until
while(true){
IError err = null;
if (reader != null)
err = reader.readPacket();
if(err != null ){
System.out.println("Error: " + err);
break;
}
}
}
This is the error that I get
picture is not of the same PixelType as this Coder expected (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1430)
[ERROR] [Launcher:/AEWings] org.red5.server.scope.Scope - Could not start scope Scope [name=AEWings, path=/default, type=APPLICATION, autoStart=true, creationTime=1401067145214, depth=1, enabled=true, running=false] java.lang.RuntimeException: failed to encode video
[ERROR] [Finalizer] com.xuggle.xuggler - Disposing of dangling container but could not write trailer (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:564)
[ERROR] [Finalizer] com.xuggle.xuggler - Disposing of dangling container but could not write trailer (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:564)
回答1:
Change your destination to be an flv file and you may also need to set the pixel type to 420P. I have more low-level xuggler detail on this answer: https://stackoverflow.com/a/3606006/127938
来源:https://stackoverflow.com/questions/23861774/xuggler-with-red5-picture-is-not-of-the-same-pixeltype-as-this-coder-expected