Skip to content

[video_player] Videos recorded with an orientation of 180° ( landscapeRight) are reversed #60327

@laurentP22

Description

@laurentP22

When playing a video recorded with an orientation of 180° ( landscapeRight) the video is reversed. I could reproduce the error using the example of the video_player plugin.

When playing the video with the gallery of the phone there is no problem, the orientation is respected.

I tried with the others orientations (landscapeLeft, portraitDown and portraitUp) and there is no problem.

The problem might comes from the dependencie exoplayer2 which is applying a rotation of 180 to the surface when it is unnecessary.

Related issue : #41169

Steps to Reproduce

  1. Record a video with the device's camera application, screen's orientation: landscapeRight.
  2. Add the video to the assets of the example of the video_player plugin.
  3. Update the pubsec.yaml to reference the video.
  4. Update the controller of the _ButterFlyAssetVideoState class to load the video :
    _controller = VideoPlayerController.asset('assets/video_name.mp4');

Expected results:
The video should be displayed with the same orientation as it was recorded.
expected_orientation

Actual results:
The video is reversed.
bad_orientation

Logs
I/ExoPlayerImpl(15219): Init 1dbf3a4 [ExoPlayerLib/2.9.6] [river, moto g(7), motorola, 29]
I/MediaCodec(15219): (0x76bd584600) init name(OMX.qcom.video.decoder.avc)
I/OMXClient(15219): IOmx service obtained
I/MediaCodec(15219): (0x76bd584600) Component Allocated (OMX.qcom.video.decoder.avc)
I/MediaCodec(15219): (0x76bd584600) configure surface(0x772a1cf000) crypto(0x0) flags(0)
D/MediaCodec(15219): (0x76bd584600) configure format: AMessage(what = 0x00000000) = {
D/MediaCodec(15219):       Buffer csd-1 = {
D/MediaCodec(15219):         00000000:  00 00 00 01 68 ee 06 e2  c0                       ....h....
D/MediaCodec(15219):       }
D/MediaCodec(15219):       int32_t max-height = 1080
D/MediaCodec(15219):       int32_t max-width = 1920
D/MediaCodec(15219):       string mime = "video/avc"
D/MediaCodec(15219):       int32_t width = 1920
D/MediaCodec(15219):       int32_t priority = 0
D/MediaCodec(15219):       int32_t rotation-degrees = 180
D/MediaCodec(15219):       int32_t max-input-size = 335781
D/MediaCodec(15219):       int32_t height = 1080
D/MediaCodec(15219):       Buffer csd-0 = {
D/MediaCodec(15219):         00000000:  00 00 00 01 67 64 00 28  ac b4 03 c0 11 3f 2c ac  ....gd.(.....?,.
D/MediaCodec(15219):         00000010:  18 18 18 1b 42 84 d4                              ....B..
D/MediaCodec(15219):       }
D/MediaCodec(15219):     }
D/SurfaceUtils(15219): connecting to surface 0x772a1cf010, reason connectToSurface
I/MediaCodec(15219): [OMX.qcom.video.decoder.avc] setting surface generation to 15584260
D/SurfaceUtils(15219): disconnecting from surface 0x772a1cf010, reason connectToSurface(reconnect)
D/SurfaceUtils(15219): connecting to surface 0x772a1cf010, reason connectToSurface(reconnect)
I/ACodec  (15219): DRC Mode: Dynamic Buffer Mode
I/ExtendedACodec(15219): setupVideoDecoder()
I/ACodec  (15219): [OMX.qcom.video.decoder.avc] setupVideoDecoder Width Height (1920x1080)
I/ACodec  (15219): mime (video/avc) compressionFormat (7)
I/ExtendedACodec(15219): Decoder will be in frame by frame mode
I/MediaCodec(15219): (0x76bd584600) start
D/SurfaceUtils(15219): set up nativeWindow 0x772a1cf010 for 1920x1080, color 0x7fa30c06, rotation 180, usage 0x20002900
I/MediaCodec(15219): (0x76bd584600) kWhatStartCompleted
I/MediaCodec(15219): (0x76bd585400) init name(OMX.google.aac.decoder)
I/OMXClient(15219): IOmx service obtained
I/MediaCodec(15219): (0x76bd585400) Component Allocated (OMX.google.aac.decoder)
I/MediaCodec(15219): (0x76bd585400) configure surface(0x0) crypto(0x0) flags(0)
D/MediaCodec(15219): (0x76bd585400) configure format: AMessage(what = 0x00000000) = {
D/MediaCodec(15219):       float operating-rate = 48000.000000
D/MediaCodec(15219):       int32_t sample-rate = 48000
D/MediaCodec(15219):       string mime = "audio/mp4a-latm"
D/MediaCodec(15219):       int32_t channel-count = 2
D/MediaCodec(15219):       int32_t priority = 0
D/MediaCodec(15219):       int32_t max-input-size = 998
D/MediaCodec(15219):       Buffer csd-0 = {
D/MediaCodec(15219):         00000000:  11 90                                             ..
D/MediaCodec(15219):       }
D/MediaCodec(15219):     }
I/ACodec  (15219): codec does not support config priority (err -2147483648)
I/ACodec  (15219): codec does not support config operating rate (err -2147483648)
I/MediaCodec(15219): (0x76bd585400) start
I/MediaCodec(15219): (0x76bd585400) kWhatStartCompleted
D/MediaCodec(15219): (0x76bd585400) kWhatOutputBuffersChanged
D/SurfaceUtils(15219): set up nativeWindow 0x772a1cf010 for 1920x1088, color 0x7fa30c06, rotation 180, usage 0x20002900
D/MediaCodec(15219): (0x76bd584600) kWhatOutputBuffersChanged
I/MediaCodec(15219): (0x76bd584600) setParameters
E/qdgralloc(15219): Unknown Color Space = 0
D/AudioTrack(15219): getTimestamp_l(310): device stall time corrected using current time 25545472079019
W/AudioTrack(15219): getTimestamp_l(310): retrograde timestamp time corrected, 25545476506623 < 25545482079801
E/qdgralloc(15219): Unknown Color Space = 0
I/MediaCodec(15219): (0x76b4524e00) stop
I/ExoPlayerImpl(15219): Release 5db5b5b [ExoPlayerLib/2.9.6] [river, moto g(7), motorola, 29] [goog.exo.core]
E/BufferQueueProducer(15219): [SurfaceTexture-0-15219-2] cancelBuffer: BufferQueue has been abandoned
I/chatty  (15219): uid=10457(io.flutter.plugins.videoplayerexample) JNISurfaceTextu identical 5 lines
E/BufferQueueProducer(15219): [SurfaceTexture-0-15219-2] cancelBuffer: BufferQueue has been abandoned
D/SurfaceUtils(15219): disconnecting from surface 0x76d5a67010, reason disconnectFromSurface
I/MediaCodec(15219): (0x76b4524e00) release
I/MediaCodec(15219): (0x76b4525c00) stop
I/MediaCodec(15219): (0x76b4525c00) release
E/qdgralloc(15219): Unknown Color Space = 0
Analyzing video_player...                                               
No issues found! (ran in 9.8s)
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F101, locale en-MX)
    • Flutter version 1.17.3 at /Users/laurent/Tools/flutter
    • Framework revision b041144f83 (3 weeks ago), 2020-06-04 09:26:11 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/laurent/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/laurent/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.11.0

[✓] Connected device (1 available)
    • moto g 7 • ZY225BM4TR • android-arm64 • Android 10 (API 29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 2.2Found to occur in 2.2found in release: 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: video_playerThe Video Player pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions