How can I compress videos so I don’t lose a lot of the quality? My phone, a Samsung Galaxy S10, makes really high quality videos but I would be satisfied if they looked like normal videos. Yanis

Videos take up a lot of space, and a lot of research goes into making them smaller. Other things being equal, a key factor is the size of the image, just as it is with still photographs. You can also reduce the file size by arbitrarily reducing the data rate or, for preference, by using a more efficient video compression system. The current favourite is MPEG-4/H.264/AVC (Advanced Video Coding), which is usually called MP4 for short. Technically, MP4 is the file container while H.264 is the codec that codes and decodes the video.

There are some good reasons for reducing video file sizes. For example, you might want to customise a high-resolution video for a low-resolution screen. You might also want to fit several videos on a device with limited storage, such as a smartphone or tablet, or an optical disc such as a CD-Rom or DVD. You might want to send the video to someone else; reducing the file size will reduce the upload and download times.

In general, however, it’s a bad idea to reduce the size of irreplaceable videos just to save space. Disk drives are cheap, and a £70 4TB drive can hold thousands of videos. You can also use cheap or free online storage at sites such as pCloud, Mega.nz, MediaFire and Yandex.Disk.

Screen resolutions keep increasing, and 640 x 480-pixel VGA videos that used to fill a screen now look tiny on today’s 3840 x 2160-pixel 4K screens. So, always shoot at the highest resolution that’s practical, and keep it. In the long run, you will need every pixel you can get.

Before we get to the details, a warning: never edit an original video file. Always keep external backups of original files, and always work with copies. Of course, this also applies to personal photos and audio files. However, losing a 2GB video of your holiday or a kid’s birthday party will hurt more than losing the odd photo.

Reducing resolution

Facebook Twitter Pinterest The resolution of the video – the number of pixels on screen at any one time – has a huge impact on the resulting file size, but also how good it looks on modern screens. Photograph: Jack Schofield/YouTube

A standard computer screen with a resolution of 1280 x 1024 shows 1,310,720 pixels, which is 1.25MB. Your Samsung Galaxy S10 can shoot videos at an even higher resolution of 3840 x 2160 pixels or UHD (ultra-high definition), where a full screen image needs 8,294,400 pixels or 7.9MB – more than six times as much. Even with compression, 30 frames per second adds up.

If you wanted to customise the video for a Windows laptop with a screen resolution of 1366 x 768 pixels (1MB per screen), you could make it much smaller.

To get some real numbers, I downloaded 4K Sample2.mp4 from the Samsung section of Ashok Patel’s AppsLoveWorld website, which offers a few free mp4 video files for testing or demo purposes. If you just want to look at it, it’s also on YouTube. It has been shot from a drone so perhaps not a phone, but either way, this 63-second video takes up 165MB.

Reducing the resolution from 3840 x 2160 pixels (UHD) to 1280 x 720 (HD) cut the file size from 165MB to 24MB, so I could almost fit seven videos into the space previously occupied by one. And while it no longer filled my 4K screen, it still looked good quality to me.

I used WonderFox’s free HD Video Converter Factory, which reduced the video to 24MB in less than 20 seconds. HandBrake reduced it to 21.3MB but worked the processor harder and took a minute longer. Any Video Converter reduced it to 7.6MB with a noticeable loss of visual quality. There are lots of programs that will do this job, so it’s just a question of finding one you like.

Pro tip: Handbrake can convert a smartphone’s variable frame rate videos to a constant frame rate for editing. (It stops the sound going out of sync.)

Aspect ratios

Facebook Twitter Pinterest Reducing the resolution of a video is an excellent way of cutting the file size, but may be detrimental in the long run. Photograph: Jack Schofield/The Guardian

When reducing video resolutions, it is very important to keep the same aspect ratio (width to height). If you don’t, clocks will no longer look round and faces will be distorted so they are either squashed or elongated like a Modigliani portrait.

Here’s a guide to the most common resolutions for people who can’t divide 1024 by 576 in their heads.

Today’s most popular video format has a 16:9 aspect ratio, which is widescreen. This covers HD (1280 x 720), Full HD (1920 x 1080) and UHD (3840 x 2160). You can also use 1024 x 576, 1600 x 900, 2560 x 1440 and other resolutions while keeping the aspect ratio the same.

Yesterday’s most popular format had a 4:3 aspect ratio, which used to be the standard for TV sets and early monitors. You can convert these videos to and from 640 x 480 (VGA), 800 x 600 (SVGA), 960 x 720, 1024 x 768 (XGA), 1440 x 1080, 1600 x 1200 (UXGA) and 2048 x 1536.

If you have a video with an odd aspect ratio, such as 16:10, then reprocess it to a popular widescreen width while keeping the height in proportion.

Cutting data rates

Facebook Twitter Pinterest Changing the bitrate of a video can help reduce the file size without changing the resolution, but too low and you will drastically reduce the quality of the video. Photograph: Jack Schofield/The Guardian

When you reduce the resolution of a video, it fills a smaller area, so you don’t need to send the screen as much data. However, in some video editors, you can set the data rate to almost anything you like. This will reduce the image quality as well as the file size.

Many people don’t perceive or don’t care about the difference in sound quality between mp3 music files at 128kbps instead of 256kbps or 320kbps. Similarly, many don’t care if their videos run at 2-3Mbps instead of 20Mbps or more. In fact, movie-streaming websites may reduce the data rate from 10-20Mbps to 2-3Mbps because it saves a huge amount of bandwidth.

When I converted the 4K sample above, HDVCF automatically reduced the original bit-rate of 21,722kbps to 3,346kbs, which is reasonable for the size. Any Video Converter reduced it to 996kbps, which was too much. I should have changed the quality setting from normal to high.

Alternatively, I could have retained the original resolution and reduced the data rate to a not-too-shabby 8,000kbps. Doing this in HDVCF reduced the file size from 165MB to 61MB, with watchable results. Dropping it to 2,659kbps (I asked for 3,000) reduced the file size to 20.2MB while retaining the original resolution, but with poor results – too many visual artefacts.

This approach works best with static subjects. A video of a talking head doesn’t need as much bandwidth as an ice hockey game.

Change the compression

Facebook Twitter Pinterest Switching to a more efficient compression system will save space, but may make sharing or playing back the video more difficult. Photograph: Samuel Gibbs/The Guardian

One of the best ways to reduce the size of a file is to change the way it’s compressed. Today’s leading codecs, mainly H.264, are much more efficient than the ones typically used in old mpg, wmv (Windows Media Video) and avi files. Video transcoding programs usually take it for granted that you’ll want to convert any old video into some form of MP4/H.264/AVC.

The catch, of course, is that your processor has to do a lot more work to decode the higher level of compression. Happily, processors are more powerful than they used to be, and Intel got round the problem by building H.264 decoding into the CPU, under the Quick Sync Video label. A year later, in 2012, AMD followed with VCE, its own Video Coding Engine.

Your Samsung phone uses MP4 as standard, but the settings let you turn on “high-efficiency video” and “record videos in HEVC format to save space”. Samsung warns: “You may not be able to play HEVC videos on other devices or share them online.”

Using HEVC would reduce the size of your videos, but I probably wouldn’t do it.

HEVC (high-efficiency video coding) is shorthand for H.265, which should have been a shoo-in to replace H.264, H.263, H.262 and so on. Unfortunately, it is heavily “patent encumbered” – and Samsung seems to own far more of the patents (4,249) that anyone else.

Along with the patents and patent sharing pools, H.265 brings a dramatic increase in royalties over H.264, plus the threat of content distribution fees. A breakaway group has therefore formed an Alliance for Open Media to create a royalty-free alternative called AV1.

Normally, this wouldn’t amount to a hill of beans. In this case, the alliance includes Amazon, Netflix, Apple, Google, Microsoft, Facebook, Intel, Arm, AMD, Nvidia, Cisco and … Samsung!

All bets are off until AV1 appears.

Have you got a question? Email it to Ask.Jack@theguardian.com

This article contains affiliate links, which means we may earn a small commission if a reader clicks through and makes a purchase. All our journalism is independent and is in no way influenced by any advertiser or commercial initiative. By clicking on an affiliate link, you accept that third-party cookies will be set. More information.