How to reduce GoPro time lapse movie file size using FFmpeg (convert from H.264 to HEVC H.265 and vice versa)

Recently I was testing out the capabilities of the latest GoPro HERO6 Black camera. Specifically, I was testing the raw video modes - 60 fps 4K and 60fps 2.6k and 60fps 1080 in particular .

What I wasn't thinking about at the time however, was the significant file sizes (not such a big deal), but the required hardware / processing power to play the high resolution (4K) high frame rate (60fps) footage back smoothly. I have a mid level laptop with an i5 processor (4th gen) , 8GB RAM and solid state drive. But with only a shared Intel graphics card, playback of 4K video at 60 fps was jittery at best. So I decided to test ffMPEG, the awesomely powerful video processing tool, to reduce the resolution down to 1080, whilst maintaining 60 fps. The reality is that most screens are still 1080 resolution and I was not shooting a feature film or marketing video,  so I was not really gaining anything from the higher resolution. The results were buttery smooth playback and as an added bonus significantly smaller file sizes. Read on to see how easy it is.

The new H6 GoPros use the latest HEVC (also known as H.265) video compression for some modes (see here), superseding H.264 which is used in previous GoPro’s and most video recording devices to date.  It is a significant advance with typical file sizes only 50% of the H.264 encoded files. For time lapse however, it proved to be significantly better than that, as detailed below. The end of this blog post also addresses if you need to convert from HEVC/H.265 to the older H.264 so you can actually view the footage on older devices.

Installing FFmpeg

The commands here assume you have installed FFmpeg. You can download the tool from the official site here. V3.4.1 was the latest at the time of writing.

4K 60fps videos reduced to 1080 60 fps videos

I took some video footage on a recent holiday at 60 fps, 4K. The problem is that a standard laptop struggles to play back smoothly 4K at such a high frame rate and the files take up an inordinate amount of diskspace.

Given the 1080 60fps videos I took looked excellent for my purposes, I decided to run the 4K 60fps videos through ffMPEG and see what might happen to the video quality / file size. Both file formats were using HEVC/H.265.

In short, pretty great.

Equipment used:

  • HERO6

GoPro settings:

  • Time lapse mode, 30 fps
  • 4K, 2.6K, 1080 video modes - 60 fps and 30fps

Here are a few of the results:


4K 60 fps file size (H.265)

1080 60fps file size (H.265)

% reduction

270 MB

19.5 MB

92%

344 MB

35 MB

90%

258 MB

19 MB

93%

549 MB

26 MB

95%


Time Lapse Videos

Interestingly, the inbuilt time-lapse function of the GoPro H6 encodes in H.264. I took a bunch of time lapses at 2 second and 5 second intervals using the inbuilt GoPro time lapse video function. I then converted these videos to HEVC/H.265 at the same resolution and frame rate and achieved the following results:


1080 30 fps - original using H.264

1080 30 fps - processed using H.265

% reduction

285 MB

4 MB

98%

152 MB

2.5 MB

98%


A 37-second time lapse at 1920 x 1080 at 30fps was originally encoded natively by the GoPro in H.264 and was 152MB. Re-encoding at the same resolution and frame rate but using H.265 yielded a file size of only 2.5MB!! - an amazing 98% reduction. As the timelapse had no sound, with a largely static background, the compression was even better than normal.

Similarly a 285MB file reduced to 4MB due to the resolution cut and H.265 encoding, a 98% reduction for the same image quality.

Depending on the scene, time lapse can be heavily compressed as much of the scene is static which is how the compression works - it only encodes the difference between the frames. HEVC/H.265 is just much better at encoding that difference than H.264.

The command is as follows:

ffmpeg -i "C:\your-path-here\GH010054.MP4" -c:v libx265 -crf 28 -preset veryfast -vf scale=1920:1080 GH010054_reduced.mp4 -hide_banner

Help, I can’t view my footage - How do I convert from HEVC/H.265 back to H.264?

One issue with HEVC/H.265 is that it is fairly new and not all devices support it, in part due to the processing power required. GoPro has published a basic list of compatible devices here.

If you took footage using HEVC and want to convert back to H.264, FFmpeg can do this too. The file size will be bigger but at least you’ll be able to watch the footage!

Run this command instead - the default format for FFmpeg is H.264 so you don’t actually have to specify the codec but I have included the “-c:v libx264” switch for completeness (and in case the default changes in later versions):

ffmpeg -i "C:\your-path-here\GH010054.MP4" GH010054_reduced.mp4 -c:v libx264 -hide_banner

I ran a test on a 34 second 4K 60fps video - changing from H.265 to H.264 (retaining aac audio) surprisingly reduced the file size from 258 MB to 160MB - but this was because I left the defaults and the bit rate reduced from 188kbps to 127 kBps so there was a loss of data if you wanted to undertake editing of the video.


4K 60 fps file size (H.265)

4K 60fps file size (H.264)

% change

260 MB

160 MB

-38%


I hope this has been useful. See you next time!

Search

z