FFmpeg easy guide and examples to downloading media

FFmpeg is a very simple way to download, convert and stream media (video and audio).  You can download FFmpeg from here. I find it very good at downloading streams (m3u8 and ts files).

I am going to cater this guide towards windows users, once you have downloaded the FFmpeg.zip open it and drag the 3 files from the bin folder into C:\Users\YOURUSERNAME\

And make sure the files are unblocked by right clicking and going to properties and ticking UNBLOCK at the bottom of the details tab.

Next create a new text file and rename it something like fetch.bat so it’s now the bat extension rather than text. RIght click it and click edit

Now comes the fun, the basics of FFmpeg is as follows

ffmpeg -i "https://videofile.mp4"

Will return all kinds of information about the media file such as bitrate, fps, encoded type, subtitles info, audio info, channels and more.

ffmpeg -i "https://videofile.mp4" -c copy downloadedfile.mp4

Here you can see we are fetching/downloading the videolink.mp4 file and saving (copying) it as downloadedfile.mp4

ffmpeg -i "https://videofile.mp4" -c:v libx264 -preset fast -crf 18 downloadedfile.mp4

This will download videofile.mp4 and will use a fast encoding to compression speed, so the file will be quiet large but it will encode it quickly. A slow -preset will take longer but compress the file better.

The -preset values are:


  • ultrafast
  • superfast
  • veryfast
  • faster
  • fast
  • medium
  • slow
  • slower
  • veryslow


The -crf is constant rate factor or quality control on the video. 0 is lossless meaning it wont encode it or change its quality, FFmpeg say an output that is roughly “visually lossless” but not technically lossless is -crf 17 or -crf 18

The range of the CRF scale is 0–51, 0 is lossless, 23 is the default, and 51 is the worst quality possible. A -crf of around 18-21 is the sweet spot i have found.

A good solid combination i find to make the file slightly smaller, keep quality and do it quickly is the values used here

ffmpeg -i "https://videofile.mp4" -c:v libx264 -preset fast -crf 19 downloadedfile.mp4


ffmpeg encoding time crf
Encoding graph Credit:FFmpeg

Here is a nice graph to see roughly what the time to quality would be like at different values.

Two more examples are:

The quickest encode

ffmpeg -i "https://videofile.mp4" -c:v libx264 -preset ultrafast -crf 22 downloadedfile.mp4

The slowest but best compression rate

ffmpeg -i "https://videofile.mp4" -c:v libx264 -preset veryslow -crf 21 downloadedfile.mp4

Once you have edited your fetch.bat file save it and now double-click it, you will now see the command line and FFmpeg go through the process of downloading and encoding your media file.