A video can have stored dimensions of 640×360 and still produce a portrait thumbnail. If your upload pipeline chooses a resize or crop from ffprobe width and height alone, that difference can be confusing.
This tutorial builds a small MP4 with a 90° display rotation, inspects its metadata, and extracts two thumbnails using the same resize filter. The results show which dimensions reach the filter when FFmpeg's automatic rotation is enabled.
The commands were tested on macOS arm64 with FFmpeg and ffprobe 8.1.2. You need a build with the libx264 encoder and the testsrc2 source. The example uses square pixels and a pure 90° rotation; it does not cover arbitrary display matrices or anamorphic video.
Create a clip whose rotation is separate from its pixels
Run these commands in a new directory:
ffmpeg -hide_banner -loglevel error \
-f lavfi -i 'testsrc2=size=640x360:rate=24:duration=2' \
-c:v libx264 -pix_fmt yuv420p encoded.mp4
ffmpeg -hide_banner -loglevel error \
-display_rotation:v:0 90 -i encoded.mp4 \
-map 0:v:0 -c copy rotated.mp4
The first command creates a two-second, silent H.264 test pattern. The second stream-copies that video into another MP4 while setting its display rotation. It does not re-encode the video into portrait-shaped frames.
-display_rotation is an input option, so it belongs before -i. The FFmpeg video options documentation describes how it overrides the input's rotation information. This command creates a controlled test fixture; it is not an instruction to add 90° to an arbitrary phone recording.
Inspect both the dimensions and the rotation
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,width,height,sample_aspect_ratio:stream_side_data=rotation \
-of json rotated.mp4
The relevant stream object from the tested output is:
{
"codec_name": "h264",
"width": 640,
"height": 360,
"sample_aspect_ratio": "1:1",
"side_data_list": [
{
"rotation": 90
}
]
}
The dimensions describe the stored video frames. Rotation appears separately in display-matrix side data. Both observations are useful: the width and height do not, by themselves, describe the orientation of a frame after automatic rotation.
For this square-pixel, quarter-turn example, applying the rotation changes the frame dimensions from 640×360 to 360×640.
Resize the first frame with automatic rotation enabled
FFmpeg enables -autorotate by default and applies the rotation during filtering when transcoding. Extract a frame with both dimensions bounded by 320 pixels:
ffmpeg -hide_banner -loglevel error -i rotated.mp4 \
-vf 'scale=320:320:force_original_aspect_ratio=decrease' \
-frames:v 1 -update 1 auto.png
Here, 320:320 defines a resize bound. The force_original_aspect_ratio=decrease option lets the dimensions shrink as needed to preserve the aspect ratio; it does not add padding to fill a square. See the scale filter documentation.
With automatic rotation enabled, the filter receives a 360×640 frame. Halving its dimensions produces a 180×320 PNG.
Run the same filter with automatic rotation disabled
ffmpeg -hide_banner -loglevel error -noautorotate -i rotated.mp4 \
-vf 'scale=320:320:force_original_aspect_ratio=decrease' \
-frames:v 1 -update 1 raw.png
-noautorotate is also an input option. This command scales the unrotated 640×360 frame to a 320×180 PNG.
The flag controls automatic rotation in this processing path. It does not remove the rotation metadata from the source MP4. The PNG outputs make the comparison easy to inspect without depending on how a video player interprets an MP4 display matrix.
Actual first-frame extracts from the synthetic test clip, enlarged 1.5× for this diagram. Dashed squares represent the resize bound; the surrounding space is diagram background, not padding encoded into either PNG.
Measure the outputs instead of guessing from the preview
for image in auto.png raw.png; do
printf '%s: ' "$image"
ffprobe -v error -select_streams v:0 \
-show_entries stream=width,height \
-of csv=p=0 "$image"
done
Measured output:
auto.png: 180,320
raw.png: 320,180
| Processing path | Frame reaching the scale filter | Extracted PNG |
|---|---|---|
| Default automatic rotation | 360×640 | 180×320 |
-noautorotate |
640×360 | 320×180 |
For a thumbnail workflow that should honor the file's display rotation, the default path gives the portrait result in this example. Inspect an extracted frame before choosing coordinates for a later crop. Adding a separate rotation filter without checking the automatic rotation step can turn the picture again.
When adapting this check to an upload, keep the original file and replace rotated.mp4 in the inspection and extraction commands. Check its actual rotation, pixel aspect ratio, and visible orientation. A missing rotation field does not establish that every possible input is landscape, and arbitrary transforms need more analysis than swapping width and height.
This test establishes thumbnail dimensions for one controlled clip and FFmpeg version. If your final output is another video file, inspect that exported file's metadata and playback separately; PNG extraction does not test the video encoder or destination player.
AI disclosure: This article was generated by an AI assistant. The reported measurements come from local command execution on a synthetic clip using FFmpeg and ffprobe 8.1.2.
For a browser-based conversion workflow, VideoBee's video converter offers resolution and frame-rate settings, according to its product page. After exporting, check the file's orientation, dimensions, and playback before sharing it; the FFmpeg experiment above does not verify that service's rotation handling.

Top comments (0)