owaisawan / xuggle

Automatically exported from code.google.com/p/xuggle
0 stars 0 forks source link

cannot open MPEG2VIDEO codec : YUV420 versus YUV420P. #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Code snapshot:
        IContainerParameters parameters = IContainerParameters.make();
        parameters.setVideoHeight(height);
        parameters.setVideoWidth(width);
        parameters.setPixelFormat(IPixelFormat.Type.YUV420P);
        container.setParameters(parameters);

        container.open(url, IContainer.Type.WRITE, format, true, false);
        video = container.addNewStream(0);

        videoCoder = video.getStreamCoder();
        videoCoder.setCodec(ID.CODEC_ID_MPEG2VIDEO);
        ICodec codec = videoCoder.getCodec();
        boolean can = codec.canEncode();
        IRational timebase = IRational.make(1, 25);
        videoCoder.setTimeBase(timebase);
        videoCoder.setWidth(width);
        videoCoder.setHeight(height);
        videoCoder.getPixelType();
        videoCoder.open();
        container.writeHeader();

Error report:
15:16:58.877 [AWT-EventQueue-0] ERROR org.ffmpeg - [mpeg2video @ 0x100905800] 
only 
YUV420 and YUV422 are supported
15:16:58.884 [AWT-EventQueue-0] DEBUG com.xuggle.xuggler - Error: could not 
open codec 
(../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:616)

What operating system and JVM version are you using.
MAC OSX 1.5.6 with J"1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

Original issue reported on code.google.com by benoit.c...@gmail.com on 22 Apr 2009 at 1:31

GoogleCodeExporter commented 9 years ago
I digged a little bit. YUV420 is the same as YUV420P
it is ffmpeg avcodec_open that is returning an error.

I found the issue. I have to set the pixelType of the coder. 
This solved the problem:
videoCoder.setPixelType(Type.YUV420P);

Original comment by benoit.c...@gmail.com on 22 Apr 2009 at 2:04

GoogleCodeExporter commented 9 years ago
yup.

Original comment by art.cla...@gmail.com on 22 Apr 2009 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by art.cla...@gmail.com on 19 May 2009 at 1:39