File Size

You are strongly encouraged to use a compression algorithm to reduce file sizes before uploading them online. This will significantly save data usage for students, a point that cannot be overemphasized.

We recommend that you use either handbrake or ffmpeg. Both of them are available for Linux, Windows, and Mac. ffmpeg has a command-line interface, whereas handbrake comes with a GUI. See this video for Windows ffmpeg installation. To understand video compression jargon please see this article.

For installing ffmpeg or handbrake on Linux, use your standard package installer. For Mac and Windows, download the .dmg or .exe file and follow the usual installation instructions.

For reducing the file size, significant reduction can be obtained by using the following settings:


Video: 10 fps [fps = frames per second]. In the unlikely event that 10 fps turns out to be inadequate, try 15 fps, and so on. Higher fps values will lead to higher file sizes. Choosing grayscale will also reduce file size, but let this be the last option if further file size reduction is sought.


Audio: Choose either aac or mp3 for the audio coder. The recommended parameters are:

16000 (sampling rate), 32k (audio bitrate), mono


The ffmpeg command that incorporates the above recommended features is as follows (copy-paste the command given below and change input.file and output.mp4 to match your filenames):


ffmpeg -i input.file -vcodec libx264 -crf 24 -acodec mp3 -ar 16000 -ab 32k -ac 1 -vf fps=fps=10 output.mp4


The argument to -crf is typically between 18 and 24 (with the higher value producing more compression, and inevitably poorer quality). ffmpeg will understand the input file format based on the extension (.mov, .avi, etc.). The recommended output format is mp4.


If you also want to convert to black & white, use the following two-step process (1: convert to b&w, 2: other settings):


  1. ffmpeg -i input.file -vf hue=s=0 intermediate_BW.mp4

  2. ffmpeg -i intermediate_BW.mp4 -vcodec libx264 -crf 24 -acodec mp3 -ar 16000 -ab 32k -ac 1 -vf fps=fps=10 output.mp4


One also needs the ability to extract segments from a given video. As an example, the following command can be used for extracting a one-minute segment beginning at 2 min (expressed in the format hh:mm:ss):


ffmpeg -i input.mp4 -ss 00:02:00 -to 00:03:00 -c copy seg1.mp4


The above command can be used for trimming the silence portions at the beginning and the end.


To join multiple segments:


ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4


where files.txt is a text file that has entries of the form


# this is a comment

file 'file1.mp4'

file '/path/to/file2.mp4'

file 'file3.mp4'


Enclosing the file names within the single quotes helps in those cases where there are spaces in the file names. Concatenating files with different FPS values will lead to unexpected results, as will differences in audio parameters. It is safest when all the parameters are the same across the files to be concatenated.


To find the audio and video steam parameters, type ffmpeg -i myfile.mp4 and look for the lines beginning with ‘Stream’:


Stream #0:0 Video: h264 (High) yuv420p, 1280x720, 89 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc

Stream #0:1 Audio: mp3, 16000 Hz, mono, fltp, 32 kb/s

In handbrake, the various menus are as shown here. Use ‘Open Source’ to load your video. The details of the audio and video streams present in the input file that has been loaded is highlighted:


To change the frame rate to 10 fps, go to the Video tab to set it:

To specify audio parameters, go the Audio tab and change them by clicking on the edit menu (at the far right):


If you really want further file size reduction, check the ‘Grayscale’ box in the Filters tab. Once all the needed settings have been entered, press “Start”. The result will be stored in the file under “Save As:” in the directory “Videos” (change this as per your requirements).



Some example file sizes before and after compression:


File1 (55 min, mp4, 1280x720, 30 fps, 32000, 128 kbps, stereo, 123MB): 49MB (ffmpeg), 62MB (handbrake)


File2 (97sec, mov, 2880x1800, 60 fps, 44100, 320 kbps, stereo, 91MB): 2.9MB