具有Red5图片的Xuggler与此Coder预期的像素类型不同

具有Red5图片的Xuggler与此Coder预期的像素类型不同

本文介绍了具有Red5图片的Xuggler与此Coder预期的像素类型不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写Red5应用程序,它将需要使用Xuggler库来捕获rtps流并将其转换为flv.

I am writing a Red5 application that will need to use the Xuggler library to capture an rtps stream and convert it to flv.

以下是在调用Red5应用程序启动方法之后要调用的以下代码.

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;
            }
        }
    }

这是我得到的错误

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)

推荐答案

将目的地更改为flv文件,您可能还需要将像素类型设置为420P.我对此答案有更多低级的xuggler详细信息: https://stackoverflow.com/a/3606006/127938

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

这篇关于具有Red5图片的Xuggler与此Coder预期的像素类型不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:42