Problems with camera in flutter app (The selected imageFormatGroup is not supported by > Android. Defaulting to yuv420)

3,122

I had the exact same error when I used the camera on flutter. The message is just informing you that the imageFormatGroup parameter must be ImageFormatGroup.yuv420. So try this:

camController = new CameraController(
    cameras[0],
    ResolutionPreset.medium,
    imageFormatGroup: ImageFormatGroup.yuv420,
);
Share:
3,122
MCB
Author by

MCB

Living in the south of Austria, I'm student of computer science.

Updated on December 30, 2022

Comments

  • MCB
    MCB over 1 year

    I have problems with integration of a photography function in my app. I get asked if I permit the access to the camera, but after that nothing happens exept this errror:

    W/Camera (26849): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420

    I/CameraManagerGlobal(26849): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client...

    This is my code:

    class FaultReporting extends StatefulWidget {
      @override
      _FaultReportingState createState()=> _FaultReportingState();
    }
    
    class _FaultReportingState extends State<FaultReporting>{
      bool isReady=false;
      List<CameraDescription> cameras;
      CameraController camController;
    
      @override
      void initState() {
        super.initState();
        setupCameras();
      }
    
      Future<void> setupCameras() async {
        try {
          cameras = await availableCameras();
          camController = new CameraController(cameras[0], ResolutionPreset.medium);
          await camController.initialize();
        } on CameraException catch (_) {
          setState(() {
            isReady = false;
          });
        }
        setState(() {
          isReady = true;
        });
      }
    
    ...
    
    child: ElevatedButton(
                                    onPressed: (){
                                      if(!isReady && !camController.value.isInitialized)
                                        {
                                          return Container();
                                        }
                                        return AspectRatio(
                                          aspectRatio: camController.value.aspectRatio,
                                          child: CameraPreview(camController),
                                        );
                                    },
    ...