1

I have two video files, one on landscape and one on portrait. On my phone's gallery detail screen their resolutions are, respectively, 1280x720 and 720x1280. This is correct because the landscape video has the width larger than the height and the portrait one has the opposite.

Smartphone screenshot showing file information. File name: 20230531_083540.mp4; file path: /Internal storage/DCMI/Camera; device name: Samsung SM-S908E; other information: 128.31 MB, 1280x720, HD, 3:20, HEVC, AAC, 30fps.

Smartphone screenshot showing file information. File name: 20230531_085120.mp4; file path: /Internal storage/DCMI/Camera; device name: Samsung SM-S908E; other information: 147.38 MB, 720x1280, HD, 4:27, HEVC, AAC, 30fps.

However if I use ffprobe to get video resolution, they both show 1280x720.

$ ffprobe -v quiet -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 20230531_083540.mp4 
1280x720

$ ffprobe -v quiet -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 20230531_085120.mp4 
1280x720

Is there something I'm missing? Complete ffprobe output for both files below.

$ ffprobe 20230531_083540.mp4 
ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20230531_083540.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2023-05-31T11:40:02.000000Z
    com.android.version: 13
    com.android.capture.fps: 30.000000
  Duration: 00:03:20.57, start: 0.000000, bitrate: 5366 kb/s
  Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1280x720, 5111 kb/s, 30.01 fps, 30 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2023-05-31T11:40:02.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of -180.00 degrees
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2023-05-31T11:40:02.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]

$ ffprobe 20230531_085120.mp4 
ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20230531_085120.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2023-05-31T11:59:27.000000Z
    com.android.version: 13
    com.android.capture.fps: 30.000000
  Duration: 00:04:27.17, start: 0.000000, bitrate: 4627 kb/s
  Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1280x720, 4370 kb/s, 29.78 fps, 30 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      rotate          : 270
      creation_time   : 2023-05-31T11:59:27.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of 90.00 degrees
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2023-05-31T11:59:27.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]

1 Answer 1

1

ffprobe is correct.

Generally, cameras will store portrait videos as landscape along with metadata to indicate to players if the video needs to be re-oriented for display.

See the following in the ffprobe readouts:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20230531_083540.mp4':
...
Side data:
  displaymatrix: rotation of -180.00 degrees

and

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20230531_085120.mp4':
...
Side data:
  displaymatrix: rotation of 90.00 degrees
2
  • Oh, okay! Yeah, I figure it was something like that but didn't pay attention to that Side data. Thanks a lot! Jun 2 at 15:32
  • Though it's strange how Samsung shows the resolution after the rotation. Jun 2 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.