Answers.Body: <p>ffprobe is correct.</p>
  <p>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.</p>
  <p>See the following in the ffprobe readouts:</p>
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20230531_083540.mp4':
  ...
  Side data:
    displaymatrix: rotation of -180.00 degrees
  </code></pre>
  <p>and</p>
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20230531_085120.mp4':
  ...
  Side data:
    displaymatrix: rotation of 90.00 degrees
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-02T15:32:22.760Z
Answers.Text: Oh, okay! Yeah, I figure it was something like that but didn't pay attention to that Side data. Thanks a lot!
Answers.UserDisplayName: Patrícia Villela
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-02T15:34:17.113Z
Answers.Text: Though it's strange how Samsung shows the resolution after the rotation.
Answers.UserDisplayName: Patrícia Villela
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-01T13:08:45.703Z
Answers.LastActivityDate: 2023-06-01T13:08:45.703Z
Answers.UserDisplayName: Gyan
Body: <p>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.</p>
  <p><a href="https://i.sstatic.net/7BItZm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7BItZm.png" alt="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." /></a></p>
  <p><a href="https://i.sstatic.net/RqzJTm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RqzJTm.png" alt="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." /></a></p>
  <p>However if I use <code>ffprobe</code> to get video resolution, they both show 1280x720.</p>
  <pre class="lang-bash prettyprint-override"><code>$ 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
  </code></pre>
  <p>Is there something I'm missing? Complete <code>ffprobe</code> output for both files below.</p>
  <pre class="lang-bash prettyprint-override"><code>$ 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]
  </code></pre>
  
Tags: <ffmpeg><ffprobe>
Title: ffmpeg showing "landscape resolution" for portrait video
UserDisplayName: Patrícia Villela
ThreadText: # ffmpeg showing "landscape resolution" for portrait video
  
  (Asked by: username_0 on 2023-06-01)
  
  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.](https://i.sstatic.net/7BItZm.png)](https://i.sstatic.net/7BItZm.png)
  
  [![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.](https://i.sstatic.net/RqzJTm.png)](https://i.sstatic.net/RqzJTm.png)
  
  However if I use `ffprobe` to get video resolution, they both show 1280x720.
  
  ```bash
  $ 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.
  
  ```bash
  $ 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]
  
  ```
  
  **Tags:** ffmpeg, ffprobe
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-06-01. Score: 1 | Accepted answer
  
  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
  
  ```
  
  > **Comments:**
  > **username_0**: Oh, okay! Yeah, I figure it was something like that but didn't pay attention to that Side data. Thanks a lot!  
  > **username_0**: Though it's strange how Samsung shows the resolution after the rotation.  
  
  ---
  
  