public void addImage(Renderer renderer, FrameBuffer out) {
            if (freeItems == null) {
                return;
            }
            try {
                final WorkItem item = freeItems.take();
                usedItems.add(item);
                item.buffer.clear();
                renderer.readFrameBufferWithFormat(out, item.buffer, Image.Format.BGRA8);
                executor.submit(new Callable<Void>() {

                    @Override
                    public Void call() throws Exception {
                        Screenshots.convertScreenShot(item.buffer, item.image);
                        item.data = writer.writeImageToBytes(item.image, quality);
                        while (usedItems.peek() != item) {
                            Thread.sleep(1);
                        }
                        writer.addImage(item.data);
                        usedItems.poll();
                        freeItems.add(item);
                        return null;
                    }
                });
            } catch (InterruptedException ex) {
                Logger.getLogger(VideoRecorderAppState.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
Set the video image quality from 0(worst/smallest) to 1(best/largest).
@param quality the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
jme3-desktop/src/main/java/com/jme3/app/state/VideoRecorderAppState.java