Changing Video Resolution with FFmpeg

Resolution describes the amount of visual information in a single video frame, expressed as logical pixels per dimension. A 1920 by 1080 frame, for instance, is made up of 1080 horizontal lines of one pixel height, each containing 1920 pixels across. This setting is usually referred to as 1080p, given that the width can differ depending on the aspect ratio. At this size, the dimensions yield the 16:9 aspect ratio common to cinema screens and modern televisions, and it is the standard for full HD content.

There is no universal "correct" resolution. The right choice depends solely on your use case. A simple embedded video player may only need a single resolution, whereas a DASH or HLS streaming setup might require several variants for adaptive bitrate switching. Adjusting resolution is one of the simplest transformations you can perform with FFmpeg.

If you do not have FFmpeg installed, you can set it up using Docker by following the Media application basics guide.

Creating lower resolution versions

Using the glocken.mov file prepared in the previous articles, you can generate smaller versions for different resolutions. The following commands will create both MP4 and WebM files:

  1. MP4

    /media # ffmpeg -i glocken.mov -b:v 350k -b:a 64k -s 1280x720 glocken_3g_720p.mp4
    
  2. WebM

    /media # ffmpeg -i glocken.mov -b:v 350k -b:a 64k -s 1280x720 glocken_3g_720p.webm
    

After running these commands, the following output files should be present:

/media # ls -l
-rw-r--r-- 1 root root  12080306 Mar  7 12:16 glocken.mov
-rwx------ 1 root root    531117 Mar  7 13:42 glocken_3g.mp4
-rwx------ 1 root root    706119 Mar  7 13:46 glocken_3g.webm
-rwx------ 1 root root    539414 Mar  7 14:15 glocken_3g_720p.mp4
-rwx------ 1 root root    735930 Mar  7 14:19 glocken_3g_720p.webm

A note on source quality

Always begin your conversion process from the highest resolution and bitrate master file you have available. If you are modernizing an older website, locate the original camera footage or other high-quality sources and transcode from those, rather than re-encoding already compressed web files. Starting from a lower quality source only compounds generation loss.