Jul 03, 2019 How to Install FFmpeg on Windows 10 & Add FFmpeg to Windows Path July 3, 2019 Bashkarla 21 Comments FFmpeg is one of the most popular, free, and open-source software that supports converting almost any multimedia format to any multimedia format.
FFmpeg is a popular software for processing, converting or manipulating video and audio files. The program is used for endless things like rotating videos, scaling videos, extracting information about videos and many others. It is an open source program that is simply awesome for video scaling, format transcoding, decoding, encoding, demuxing, streaming, filtering, converting audio files, recording live audio/video, handling video and other multimedia files. This multimedia framework is designed for command line based processing of multimedia files, and you can make basic edits with a single line commands.
While the program is simple to use, accessing FFmpeg to execute commands is a little confusing. Installing and using FFmpeg can take a lot of time as you need to manually open FFmpeg folder within command prompt or Power Shell terminal to access FFmpeg executive file to execute relevant commands for basic editing. If you are stuck with installing and using FFmpeg on your machine, you are in the right place.
To make things simple, all you have to do is install FFmpeg and add FFmpeg program to Windows 10 path using Environment variables. This way you can directly access FFmpeg from a Command prompt or Power Shell in any directory. In this article, we explain how to install FFmpeg on Windows 10 in order to access FFmpeg directly from Command Prompt or PowerShell
Install FFmpeg on Windows 10
Get the latest FFmpeg build from the official website here. You can either Download the 32-bit version or 64-bit version that suits your system. Click the Download Build button to start downloading.
The program doesn’t work directly on Windows 10. You need to add a program to system path using Environment Variables.
So navigate to the downloaded folder where the FFmpeg zip file is a store. Right click on the Zip folder and click extract from the drop-down menu.
Select the folder or drive where you want to extract.
Next, rename the extracted folder. To rename the folder, right click on a folder and click Rename from the drop-down menu with title FFmpeg-20180424-d9706f7-win64-static to FFmpeg.
Copy the FFmpeg folder and navigate to C drive. Paste the folder to the root of C drive.
Once done, the next step is to enable FFmpeg using Command Prompt.
Add FFmpeg to Windows path using Environment variables
To use FFmpeg in Command Prompt, you need first to add the bin folder containing the FFmpeg executable file to your Windows path
In the Windows search menu, type Edit the system environment variables and click Enter. This will open the system properties window.
Navigate to Advanced button and click Environment Variables at the bottom of the window.
In the Environment Variables window, Select the variable Path and click Edit to change the Path variable.
Click New and type the path of FFmpeg folder “C:ffmpegbin” and click OK.
Type the path directory according to the drive or folder where you have placed FFmpeg folder.
Once done, the path gets added to the Environment variables. Click OK to apply changes.
Verify FFmpeg path in Command Prompt
Launch Command Prompt and type the command FFmpeg in the command prompt terminal and hit Enter.
If the FFmpeg is added properly to Windows Path, the command prompt will display the details about FFmpeg like its version number, configuration, etc.
If you weren’t successful, it only means that your command prompt did not recognize the commands. Cross check to see if you have added the FFmpeg folder to the system path properly.
That’s all!
Related Posts:
It's generally accepted that, due to licensing reasons, the pre-compiled Windows executables of FFmpeg come out of the box with lower-quality encoders - particularly when it comes to the default AAC encoder and the default resampler.
According to these sources, the solution is to compile the program from source:
FFmpeg supports two AAC-LC encoders (aac and libfdk_aac) and one HE-AAC (v1/2) encoder (libfdk_aac). The license of libfdk_aac is not compatible with GPL, so the GPL does not permit distribution of binaries containing incompatible code when GPL-licensed code is also included. Therefore this encoder have been designated as 'non-free', and you cannot download a pre-built ffmpeg that supports it. This can be resolved by compiling ffmpeg yourself...
The Fraunhofer FDK AAC codec library. This is currently the highest-quality AAC encoder available with ffmpeg. Requires ffmpeg to be configured with --enable-libfdk-aac (and additionally --enable-nonfree if you're also using --enable-gpl).
...
If you want FDK-AAC you have to compile handbrake yourself. I did it and the audio sounds great now.
I already have Cygwin available on my machine, and I'd rather use that to compile the program rather than setup another software ecosystem or burn a whole Linux distribution.
How can I use Cygwin to compile FFmpeg with better external libraries?
1 Answer
This is easier said than done, and has taken me over a month to figure out how to do without any issues, but I've spent enough time on it that I decided I'd document the process well enough to be completed virtually seamlessly by anyone following me.
Unfortunately, Cygwin's default toolchain (i.e. the gcc-core
package included with the Cygwin installer) is inherently broken for cross-compiling purposes, and there doesn't seem to be any intent from the Cygwin maintainers to fix this, so currently, the only way to compile software for Windows with Cygwin is to set up a MinGW-w64 toolchain under it. Thankfully, this is as easy as installing a few packages. After this, we'll be compiling the remaining packages, before using a combination of both to compile FFmpeg itself.
Ffmpeg Install Windows 64
Following this guide in its entirety will build a static FFmpeg installation roughly 200MB in size, with external libraries such as fdk-aac
, libopus
, x265
and the SOX resampler enabled. I may consider adding instructions for compiling specific external libraries to the guide if I get enough requests to do so for a particular library.
The dependencies used by this guide - made up of the MinGW-w64 cross-compile toolchain itself, all packages installed by apt-cyg
and all packages compiled from source - will consume up to 2.8GB of disk space, although the guide also includes commands to clean up everything but the FFmpeg installation once done. The installation itself, made up of the binaries and documentation, occupies just over 200MB of disk space.
This guide will create a folder in your Home directory called ffmpeg_sources
, where it will download and compile all of the packages being built from source. FFmpeg will be installed to /usr/local
, where the FHS standard recommends that software compiled by the user is installed to. This location also has the secondary advantage of being on the system PATH
by default in Cygwin, and so doesn't require the $PATH
variable to be updated.
To begin with, download the latest version of the Cygwin installer to install the wget
, tar
, gawk
and git
packages. The good news is that these packages are dependencies for a tool that can prevent you from ever needing to use the Cygwin installer again.
Next, install kou1okada's fork of the apt-cyg package manager. If you don't currently use a package manager for Cygwin, this step will not only make the rest of the guide a breeze, but will also make your Cygwin experience rival that of any Linux distribution.
Even if you already use a package manager for Cygwin, such as a different fork of the original apt-cyg
, I highly recommend you replace it with this one, which is a much more fully-fledged piece of software compared to the original, as well as the only package manager for Cygwin that is currently in active development.
To install kou1okada's apt-cyg
:
Each section below compiles an external library that will allow you to compile FFmpeg with support for that library enabled. Copy and paste the whole of each command into your shell.
If you decide you don't require your build of FFmpeg to support a given library, skip its section and remove the corresponding --enable-package
line when compiling FFmpeg in the final stage of this guide.
Firstly, create a directory at the root of your Cygwin installation with the following:
This is the directory we'll be downloading our source code to, and compiling it from.
libmp3lame
To compile the LAME audio codec for MP3:
libx264
To compile the x264 video codec:
libx265
To compile the x265 video codec:
libogg/libvorbis
The Ogg format is a dependency for the Vorbis audio codec, so will need to be compiled before it:
Then compile Vorbis as normal:
libaom
To compile the AV1 video encoder:
libopus
To compile the Opus audio encoder:
libfdk-aac
To compile the Fraunhofer FDK encoder for AAC:
libsoxr
To compile the SOX resampler library, you'll first need to create a CMAKE toolchain file for the MinGW-w64 toolchain as the project doesn't include one by default.
Create a new file in the Cygwin root directory, and call it toolchain-x86_64-mingw32.cmake
(make sure Windows is showing extensions, and that the extension is .cmake
).
Copy and paste the following into the file:
Now you can compile the SOX resampler as normal:
The only thing that's left to is compile FFmpeg itself, using the libraries downloaded or compiled above:
Remember to remove --enable-*package*
lines for each package in the list above that you didn't download or compile a library for.
Compiling FFmpeg will take much longer than compilation of the external libraries, but once it's done, you should have a fully working binary enabled with all of the libraries you compiled it with. To run it, simply run ffmpeg
in the Cygwin terminal.
By this point in the guide, you will have taken up around 2.8 GB of disk space with downloading, installing and compiling. The majority of this is now redundant, and should be cleaned up. More than 2.6 GB of it can be safely purged, which brings the total footprint of our FFmpeg installation down to as little as 200MB.
Post-install clean up
Running the following will free up more than 2.3GB of disk space:
As well as removing the ffmpeg_sources
directory and unneeded static libraries, this will also remove any packages installed earlier that are no longer needed, except for those that are commonly needed for building tools on Cygwin/Linux.
Remove the cross-compiler
If you no longer intend to compile any other programs using the MinGW-w64 cross-compiling toolchain built earlier in this guide, you can safely uninstall it, as well as all the remaining packages installed earlier:
Install Ffmpeg Windows 7 32 Bit
This will free up an additional ~450 MB of space.
Uninstalling FFmpeg
If you ever need to reverse all of the steps in this guide and purge the FFmpeg binaries from your system, simply run the following:
This will remove everything installed during the process of this guide, and revert your system to exactly how it was before starting it.
DavidPostill♦