0

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)
mattwallace
  • 4,132
  • 6
  • 43
  • 77

1 Answers1

0

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

Community
  • 1
  • 1
Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131
  • That'd be awesome dude. Thanks so much. I found a post here http://whaticode.com/2010/04/30/use-java-to-convert-any-media-type-to-flv-with-xuggler-part-2/ and implemented using that code but I'm still getting the same error. The error happens around line 76 when "super.onVideoPicture(asc)" is called http://grab.by/xcZI – mattwallace May 26 '14 at 20:21
  • I think I was able to fix this issue but I'm not 100% sure just yet but it did cause another problem that I'm not sure how to solve. http://bit.ly/1pgxSqr – mattwallace May 27 '14 at 21:48