flutterffmpeguint8list

How can I display an image from Uint8List with the format AVFormat.RGBA8888 more quickly in Flutter?


I'm looking to display images as quickly as possible. input data is in the form of Uint8List from dart:typed_data, data is encoded in AVFormat.RGBA8888 from ffmpeg.

I'm looking for a solution to improve the performance of my graphics rendering code. And to see if it's possible to do it in a thread (isolate or compute).

Here's my current working code.

    final buffer = await ui.ImmutableBuffer.fromUint8List(data.data);
    final descriptor = ui.ImageDescriptor.raw(
      buffer,
      width: data.width,
      height: data.height,
      pixelFormat: ui.PixelFormat.rgba8888,
    );
    final codec = await descriptor.instantiateCodec(); // native codec of ui.Image
    final frameInfo = await codec.getNextFrame();

This is done in my main thread


Solution

  • I managed to improve my performance by switching to native code to create my image for display. This provides decent performance.