HI, Art
Thank you!
I first capture the whole screen by the tools of the SWT library:
Display display = new Display();
GC gc = new GC(display);
Image image = new Image(display, this.screenWidth,
this.screenHeight);
gc.copyArea(image, 0, 0);
byte [] imageData = image.getImageData().data;
imageData is the byteArray. It has RGB format.
Now I create a new IBuffer and VideoPicture:
IBuffer iBuffer = IBuffer.make(null, imageDataArray,0,
imageDataArray.length );
IVideoPicture ivideoPicture;
ivideoPicture = IVideoPicture.make(iBuffer,
IPixelFormat.Type.YUV420P, this.screenWidth, this.screenWidth);
The encoding works. Viva Xuggler.
BUT
I get wrong image format, e.g. the output has not correct colors.
I guess I am not using.
I am not an expert on color spaces, but I think I should indicate the
color type before calling IVideoPictureMake. e.g. before converting
to YUV420P.
for example, can it be done with RefCounted as an argument of the
IBuffer.make() method. I set it now as null. Maybe set it as
PixelFomat ?
Thank you!
Georgi
On Aug 31, 2:40 am, Art Clarke <
acla...@xuggle.com> wrote:
> See the IVideoPicture.make(...) methods, and explore using
> com.xuggle.ferry.IBuffer objects. IBuffer objects can wrap just about
> anything (although they will copy to a Direct ByteBuffer. If Swing has a
> Direct ByteBuffer (see java.nio documentation) then that will be the fastest
> as Xuggler does everything with native memory (not Java heap) at the end of
> the day.
>
> - Art
>
> On Mon, Aug 30, 2010 at 2:29 PM, Georgi Dzhambazov <
>
>
>
>
joro.dzhamba...@gmail.com> wrote:
> > Hi all.
>
> > I am using Xuggle to encode a video stream consisting of captured
> > screen frames. I am following the tutorial
> >
http://wiki.xuggle.com/Encoding_Video_from_a_sequence_of_Images
> > using the recommended java awt method
> > This returns the result in the java.awt.image.BufferedImage format.
>
> > However capturing the whole monitor is extremely slow on some moderate
> > processors like mine. I found out the the swt screen capturing is
> > quite faster.
>
> > See
> >
http://www.java2s.com/Tutorial/Java/0280__SWT/Screenshotscreencapture...
> > Still it returns an object of type org.eclipse.swt.graphics.Image;
> > This can be transformed into a byte array byte[].
> > My question is : Is there a way for the encoding method of xuggle to
> > work with byte array directly instead of BufferedImage.
>
> > If I have to convert to BufferedImage then I do not get any
> > performance gain. This conversion is slow.
>
> > Thank you,
> > regards Georgi
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "xuggler-users" group.
> > To post to this group, send email to
xuggle...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
xuggler-user...@googlegroups.com<
xuggler-users%2Bunsu...@googlegroups.com>
> > .
> --
http://www.xuggle.com/