Are you still sacrificing CPU resources encoding videos with FFmpeg?

Ivor.Pro
2 min readJan 31, 2021

Outsource your FFmpeg video encoding

Many of you who use FFmpeg to encode or transcode videos know it will consume a lot of CPU power unless you do it on a local machine with a CUDA supported GPU or use an (often costly) cloud service or GPU enabled cloud instance.

There is another way to get the job done!

It’s a known secret the largest video site on the web (no, I don’t mean pornhub), also uses FFmpeg to process uploaded videos.

No doubt they’ve optimized their process, resulting in great filesize/quality ratios. All videos are optimized for streaming, have their Moov Atoms where they need to be, etc…

I won’t write an extensive tutorial here, but there are some handy tools available allowing you to ‘outsource’ your video encoding without being confronted with high bills.

Step 1: Ensure your video source isn’t too exotic

This is where you do need to use some local resources to convert your source file into an acceptable format. Though this will only apply to any video that doesn’t have a regular format (mp4. wmv, flv, mov, avi, webm, etc).

The best way to find out if you need to prepare your source video is to visit Youtube and try to upload it there

Step 2: Prepare your environment

You’ll need a Google Cloud account, YouTube account, and a suitable Python (v2) environment. Regarding the latter Pyenv is the way to go here.

Step 3: Upload your video

There are two great Python tools you can use to upload your video from the CLI: https://github.com/tokland/youtube-upload and https://github.com/TheMengzor/youtube-upload

You can also use the GData client (https://github.com/google/gdata-python-client) or the official Google Cloud CLI

Step 4: Have some coffee and check if the video conversion is finished

The tools above can be used to check if the video is available

Step 5: Download the result

Simply download the end result using Youtube-DL. It allows you to pick from various formats, so there’s little chance you’ll need to do further processing yourself.

Enjoy :)

Stay up to date and subscribe to my Tech & Innovation newsletter! Click here to subscribe now!

--

--

Ivor.Pro

Techy, foody, coder, traveller, luxury animal, gadget geek, digital transformation expert and occasional digital nomad. https://ivor.pro