Skip to content

[camerax] ResolutionPreset.medium image stream generates 640x480 images on Android, not 720x480 ones like with camera_android and as stated in the doc #141766

@andynewman10

Description

@andynewman10

Steps to reproduce

  1. Create a simple Flutter application.
  2. Use the following dependencies on your pubspec.yaml:
camera: ^0.10.5+9
  1. Set up a camera controller using ResolutionPreset.medium and start an image stream through startImageStream.
  2. Run the application on a real device. I use a Sony Z5C with Android 7.1.1 and a Google Pixel 6a with Android 14.
  3. Now update your pubspec.yaml:
camera: ^0.10.5+9
camera_android_camerax: ^0.5.0+26
  1. Perform a flutter clean (to be on the safe side) and run your application again.

Expected results

The CameraImage image instance obtained from the stream should have a resolution of 720x480 in all cases (camera_android and camera_android_camerax) - shouldn't it?

The documentation of ResolutionPreset states:

  /// 480p (640x480 on iOS, 720x480 on Android and Web)
  medium,

I haven't tried with other ResolutionPresets.

Actual results

CameraImage has a resolution of

  • 720x480 when camera_android is used (this matches what the documentation says). The aspect ratio of the camera preview is 720/480=1.5.
  • 640x480 when camera_android_camerax is used. The aspect ratio of the camera preview is 640/480=1.333.

I am (personally) fine if 640x480 is used with camera_android_camerax, but the documentation needs to be updated (or the code of camera_android_camerax or camera_android needs to be changed?)

640x480 matches the iOS resolution.

Code sample

Code sample

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.16.7, on Microsoft Windows [version 10.0.22000.2538], locale fr-FR)
    • Flutter version 3.16.7 on channel stable at C:\Users\andy\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ef1af02aea (7 days ago), 2024-01-11 15:19:26 -0600
    • Engine revision 4a585b7929
    • Dart version 3.2.4
    • DevTools version 2.28.5

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\andy\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.0.2)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.0.31919.166
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.2)
    • Android Studio at C:\Users\andy\Documents\Applications\android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at C:\Users\andy\Documents\Applications\IntelliJ
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.85.1)
    • VS Code at C:\Users\andy\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.80.0

[√] Connected device (5 available)
    • Pixel 6a (mobile) • 29231JEGR03669 • android-arm64  • Android 14 (API 34)
    • E5823 (mobile)    • CB5A28LMYH     • android-arm64  • Android 7.1.1 (API 25)
    • Windows (desktop) • windows        • windows-x64    • Microsoft Windows [version 10.0.22000.2538]
    • Chrome (web)      • chrome         • web-javascript • Google Chrome 120.0.6099.218
    • Edge (web)        • edge           • web-javascript • Microsoft Edge 120.0.2210.133

[√] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listfound in release: 3.16Found to occur in 3.16found in release: 3.19Found to occur in 3.19has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions