FFmpeg for beginners: make a landscape AI demo vertical without cropping the subject

A finished AI demo can look right on a laptop and still fail in a vertical feed. Zoom a landscape screen recording to fill 9:16, and you often lose menus, results, or other details the viewer needs.

This guide keeps the complete sharp 16:9 frame. An enlarged blurred copy fills the portrait space behind it. The result is a 1080×1920 video with a centered main frame that remains intact and easy to review.

FFmpeg is an open source tool for reading, filtering, and encoding video and audio streams. We use it for one job here: turn an existing MP4 into a vertical MP4. We will not generate new footage, narration, or captions.

Who this guide is for

You have a short product demo, lesson explanation, or screen recording in landscape format. It is already approved, but you need a portrait preview without cutting away the interface or final result.

You will finish with:

  • one 1080×1920 vertical MP4
  • the complete sharp main frame visible
  • a blurred background that fills 9:16
  • the first audio stream included when present
  • a visual and technical check of the final file

Install and check FFmpeg

Get FFmpeg through the official FFmpeg download page. It links to packages and builds for Linux, Windows, and macOS. Installation differs between operating systems.

We tested this path on Ubuntu:

sudo apt update
sudo apt install ffmpeg
ffmpeg -version
ffprobe -version

Check that your build exposes the libx264 and aac encoders:

ffmpeg -hide_banner -encoders

Look for libx264 and aac in the output. Not every FFmpeg build includes libx264.

Sources: FFmpeg Download and FFmpeg codec documentation.

Prepare the source file

Create a dedicated working folder and put a copy of your video inside it. Rename the copy:

demo-landscape.mp4

The command below was tested with an ordinary square-pixel 16:9 video containing one video stream and no more than one audio track. Inspect the source first:

ffprobe -v error \
  -show_entries stream=codec_type,width,height,sample_aspect_ratio \
  -of json demo-landscape.mp4

For this guide, the video should be 16:9 and sample_aspect_ratio should be 1:1. Adapt the workflow if it is not. This recipe does not try to preserve subtitles, chapters, extra audio tracks, or HDR and color metadata.

How the two video layers work

FFmpeg splits the same video into two visual layers:

  1. The background copy grows until it covers 1080×1920. FFmpeg crops the excess and blurs the image.
  2. The main video scales down until the complete 16:9 frame fits inside the portrait canvas.
  3. The sharp main frame is centered over the blurred background.

"Without cropping" describes the main video. The background copy is intentionally cropped to fill the canvas.

Run the vertical conversion

Run this command in the same folder as the source file:

ffmpeg -y -i demo-landscape.mp4 \
  -filter_complex "[0:v]split=2[bg][fg];[bg]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,boxblur=30:10[bgv];[fg]scale=1080:1920:force_original_aspect_ratio=decrease[fgv];[bgv][fgv]overlay=(W-w)/2:(H-h)/2:shortest=1,setsar=1[outv]" \
  -map "[outv]" -map 0:a:0? \
  -c:v libx264 -crf 20 -preset medium -pix_fmt yuv420p \
  -c:a aac -b:a 128k -movflags +faststart \
  demo-vertical.mp4

The -y flag overwrites an existing demo-vertical.mp4 without asking. Change the output filename if you need to keep an earlier version.

The long filter step does six useful things:

  • split creates the background and main-video layers.
  • increase, crop, and boxblur fill and soften the background.
  • decrease fits the complete main frame.
  • overlay centers the layers.
  • -map 0:a:0? includes the first audio stream when one exists.
  • H.264 video and AAC audio are encoded into an MP4, while +faststart moves regular MP4 metadata toward the beginning of the file.

The audio is re-encoded as AAC, so it is not bit-identical to the source. We do not use a final output-level -shortest: if the audio stream ends first, that option could cut off the end of the picture.

Sources: FFmpeg documentation along with FFmpeg Filters Documentation and FFmpeg Formats Documentation.

Review the video, not only the numbers

Play demo-vertical.mp4 from beginning to end. Pause near the start, middle, and ending. Confirm that:

  • the complete main frame remains visible
  • the image is not stretched
  • no edge has been cut by mistake
  • the blurred layer fills the portrait canvas without black gaps
  • the picture reaches the expected final frame
  • the audio is clear and ends where you expect

Then run a compact technical check:

ffprobe -v error \
  -show_entries stream=codec_type,codec_name,width,height,sample_aspect_ratio,display_aspect_ratio \
  -show_entries format=duration \
  -of json demo-vertical.mp4

Look for 1080×1920, a 9:16 display aspect ratio, a 1:1 sample aspect ratio, H.264 video, and AAC audio when the source contained audio. Compare the duration with the original too.

ffprobe reads technical metadata. It cannot tell whether a button is outside the frame or the ending feels abrupt. Playback and visual spot checks still matter.

Source: ffprobe Documentation.

Common mistakes

Do not scale the sharp main video to fill the complete 9:16 canvas. That crops the information this guide is meant to preserve. Avoid forcing unrelated width and height values without preserving the aspect ratio, which can stretch the picture.

If the output is silent, you may have omitted the explicit audio mapping after mapping the filtered video. If libx264 is missing, use an FFmpeg build or another encoder supported by your environment.

Next step

You now have a repeatable workflow for one finished landscape video and one reviewed portrait copy. Captions, multiple export formats, and automated publishing belong in later steps.

If your team makes the same adaptation each week, Hammer Automation can package the command, filenames, review points, and approval into a repeatable workflow. You can also read how Adobe Firefly can add voice, music, and sound effects to a short product clip.

FAQ

Does this FFmpeg workflow crop the original video?

The sharp main video is scaled to fit completely. Only the enlarged blurred background copy is cropped to fill the 9:16 canvas.

Why use a blurred background instead of zooming in?

It fills the portrait canvas without stretching the main video or cutting away part of the demo.

Does the vertical video keep its audio?

The command maps the first audio stream when present and re-encodes it as AAC. Listen to the final file before using it.

Will this command work with every MP4 file?

No. It was tested with an ordinary square-pixel video containing one video stream and no more than one audio track. Check the source and available encoders first.

The Forge newsletter

Get new articles in your inbox

Pick the topics you care about. No noise, at most one email a week.

Get new articles in your inbox

We follow GDPR. Unsubscribe anytime.