2

I'm currently using Xuggler to receive the video stream of an AR.Drone. The stream format is H.264 720p. I can decode and display the video using the following code, but the processor usage is very high (100% on dual-core 2ghz) and there is a huge delay in the stream that keeps increasing.

        final IMediaReader reader = ToolFactory.makeReader("http://192.168.1.1:5555");
        reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);

        MediaListenerAdapter adapter = new MediaListenerAdapter()
        {
            public void onVideoPicture(IVideoPictureEvent e)
            {
                currentframe = e.getImage();
                //Draw frame
            }

            public void onOpenCoder(IOpenCoderEvent e) {
                videostreamopened = true;
            }
        };

        reader.addListener(adapter);

        while (!stop) {
            try {
                reader.readPacket();
            } catch(RuntimeException re) {
                // Errors happen relatively often
            }
        }

Using the Xuggler sample application resolves none of the problems, so I think my approach is correct. Also, when I decrease the resolution to 360p the stream is real-time and everything works OK. Does anybody know if this performance issues are normal or what I have to do to avoid this? I am very new to this, and I have not been able to find information, so does anybody have suggestions?

By the way, I tried changing the bitrate without success. Calling reader.getContainer().getStream(0).getStreamCoder().setBitRate(bitrate); seems to be ignored...

Thanks in advance!

UPDATE: I get many of these errors:

9593 [Thread-7] ERROR org.ffmpeg - [h264 @ 0x7f12d40e53c0] mmco: unref short failure
39593 [Thread-7] ERROR org.ffmpeg - [h264 @ 0x7f12d40e53c0] number of reference frames (0+2) exceeds max (1; probably corrupt input), discarding one
39593 [Thread-15] ERROR org.ffmpeg - [h264 @ 0x7f12d40e53c0] reference overflow
39593 [Thread-15] ERROR org.ffmpeg - [h264 @ 0x7f12d40e53c0] decode_slice_header error

UPDATE 2: Changing the codec solves the above errors, but performance is still poor.

laobeylu
  • 283
  • 3
  • 14

0 Answers0