Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go


Video Resize

20200806 Videos files can be quite large in size and the size is not always warranted. A screencast of 30 minutes might, for example, result in a 350MB file. This can be reduced to 60MB with little or no apparent loss of quality.

To reduce the size of the video whilst retaining enough quality, try using the h.265 video (libx265) format which compresses a video stream whilst retaining good quality. Here a video is input to ffmpeg with -i, converted to the video codec H.265 using -c:v libx265 (or the alias -vcodec), with a Constant Rate Factor of 28 using -crf with a straight copy of the audio -c:a copy:

$ ffmpeg -i myvideo.webm -c:v libx264 -crf 28 -c:a copy smaller.mp4

This can be abbreviated as

$ ffmpeg -i myvideo.webm -vcodec libx265 -crf 28 smaller.mp4

For the constant rate factor 24–30 is a good range, with lower values giving better quality but larger files. A crf of 0 is lossless processing whilst at the other end of the scale a crf of 51 is quite lossy but a lot smaller files. Experiment by increasing or decreasing the crf to trade off quality against file size.

Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.