“The way to learn to do things is to do things. The way to learn a trade is to work at it. Success teaches how to succeed. Begin with the determination to succeed, and the work is half done already.” – Henry Ford

How To: Setup and Use ffmpeg on Windows

I am not going to bore you with explanations of what ffmpeg is or it’s history. We’re going to jump right in.

How to Get ffmpeg for Windows.

There maybe several places to get the Windows Binary (Program) Files but I have had great success with the builds from FFmpeg at Zeranoe.com. If you haven’t already; open a new window or tab using this link:

  • http://ffmpeg.zeranoe.com/builds/

You can choose between either 32-bit or 64-bit Static or Shared Builds. I am using Windows 7 64-bit Ultimate so I chose the 64-bit Static build. I went with the Static build because everything is included in the executable file. I don’t have to worry about external dll files. (just my personal preference.) Which ever version you decide to download, make sure you know where the downloaded files are placed. I suggest to right-click on the link to the file you want to download and from the context menu choose “Save Link As…” or “Save target as…” depending on which browser you are using. That way you can specify the download location.

Note: If you are using a 64-bit version of Windows, I suggest you get both the 32-bit and 64-bit versions. I personally use both versions on my Windows 7 64-bit Ultimate desktop machine.

The files are zipped using 7-Zip which you will need to use to extract the files. You can download it for free here if you don’t already have it. (This is a great utility, I highly recommend it. I use it quite frequently.)

Setting up ffmpeg.

If you are using a version of Windows that has UAC (User Access Control) (i.e. Vista or Windows 7), before extracting any files or opening the archive, you may want to perform the following action: Right-click on the downloaded file and click on ‘Properties’. Click the ‘Unblock’ button located near the bottom right of the dialog box then click ‘OK’. (You should only have to do this once per downloaded file and only if you know and trust the source of the file you downloaded.)

There is no Windows installer included in the builds so we need to decide where to put the program files. I chose to use the Windows standard location of “C:\Program Files\”. You may choose your own location. Just make sure to use the location you have chosen in the following steps. Before you begin, make sure you have 7-Zip installed and you have the 7-Zip options available on the context menu by right clicking a file in Windows Explorer.

  1. In Windows Explorer, right-click on the 7z file you downloaded and choose ‘Open archive’ under 7-Zip.
  2. From the 7-Zip dialog box, Choose ‘File’->‘Rename’ or just press the F2 key on your keyboard.
  3. Type “ffmpeg” and press ‘Enter’. Do Not Close the archive. There should only be one item showing now and the name should only be “ffmpeg”.
  4. Click on the ‘Extract’ icon (second on the left)
  5. Click on the ‘ … ’ button at the far right.
  6. Choose “C:\Program Files\” and click ‘OK’.
  7. If the ‘Copy to:’ box has the correct path, “C:\Program Files\”, click ‘OK’.
  8. Close the 7-Zip archive.
    • If you are using a 64-bit version of Windows and you want to use both the 32-bit and 64-bit versions, use the same steps above. Pay close attention to the archive file name. The 64-bit version should go to “C:\Program Files\” and the 32-bit version to “C:\Program Files (x86)\”

If all went well, you should now have a “ffmpeg” directory under “C:\Program Files\” with the following sub-directories: “bin”, “doc”, “licenses”, and “presets”. There should also be a “README.txt” file. We are going to add a batch file to the “ffmpeg” directory.

  1. In Windows Explorer, navigate to the “C:\Program Files\ffmpeg” directory.
  2. In a blank area away from any file or directory, right-click in the details (right-hand) pane and click ‘New’ -> ‘Text Document’
  3. Type “ffmpeg32”. DO NOT PRESS ‘ENTER’ YET!
  4. Replace the ‘.txt” extension with “.bat”. The file name should look like this: “ffmpeg32.bat”. Now press ‘Enter’ and answer ‘Yes’ to the ‘Rename’ dialog box confirming you want to rename the file.
    • If you are setting up both the 64-bit and 32-bit versions, name the batch files as follows:
      64-bit:
      “C:\Program Files\ffmpeg\ffmpeg64.bat”
      32-bit:
      “C:\Program Files (x86)\ffmpeg\ffmpeg32.bat”

Now we need to edit the batch file we just created. You can use your favorite text editor for this. I recommend just using Notepad.

  1. In Windows Explorer, right-click on “ffmpeg32.bat” and click ‘Edit’.
  2. Type “@ECHO OFF” (without the quote marks) and press ‘Enter’.
  3. Type “C:\Program Files\ffmpeg\bin\ffmpeg.exe” (include the quote marks) DO NOT PRESS ‘Enter’ yet.
  4. Press your space bar once to add a space after the quote mark.
  5. Type a percent sign (%) located above the number 5 on US keyboards.
  6. Type a asterisk (*) located above the number 8 on US keyboards.
    You should have two lines of text as shown below:

    1. @ECHO OFF
    2. "C:\Program Files\ffmpeg\bin\ffmpeg.exe" %*
  7. Save the file and exit Notepad.
    • If you are setting up both the 64-bit and 32-bit versions, the batch files should look like this:
      64-bit: “C:\Program Files\ffmpeg\ffmpeg64.bat”
      1. @ECHO OFF
      2. "C:\Program Files\ffmpeg\bin\ffmpeg.exe" %*
      32-bit: “C:\Program Files (x86)\ffmpeg\ffmpeg32.bat”
      1. @ECHO OFF
      2. "C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe" %*

There is just one more step to this setup. We need to set the system path to include the new directory we added. This will make it more convenient to use ffmpeg.

Windows Vista and Windows 7 users:

  1. If you have a ‘My Computer’ icon on the Desktop, right-click on it and click ‘Properties’. If you do not have a ‘My Computer’ icon, open the start menu and right-click on ‘Computer’ and click ‘Properties’.
    – Or –
    Press the Windows Key + R to open the Run dialog box and type the following command:

    1. control sysdm.cpl,,3

    go to step 3.

  2. Click the ‘Advanced System Settings’ link in the left column.
  3. In the System Properties window click the ‘Environment Variables’ button.
  4. In the ‘Environment Variables’ window, highlight the ‘Path’ variable in the ‘Systems Variable’ section and click the ‘Edit’ button. Move the cursor to the end of the existing entries and type a semicolon (;). Use caution here so you do not remove or replace anything that already exists. Add the path or paths to “ffmpeg”. Make sure that each directory is separated by a semicolon as shown below.”…;C:\Program Files\ffmpeg;C:\Program Files (x86)\ffmpeg”Use the path or paths appropriate for your system and chosen setup.

Windows 2000 and Windows XP users:

  1. If you have a ‘My Computer’ icon on the Desktop, right-click on it and click ‘Properties’. If you do not have a ‘My Computer’ icon, open the start menu and right-click on ‘Computer’ and click ‘Properties’.
  2. In the ‘System Properties’ window, click on the ‘Advanced’ tab.
  3. In the ‘Advanced’ section, click the ‘Environment Variables’ button.
  4. In the ‘Environment Variables’ window, highlight the ‘Path’ variable in the ‘Systems Variable’ section and click the ‘Edit’ button. Move the cursor to the end of the existing entries and type a semicolon (;). Use caution here so you do not remove or replace anything that already exists. Add the path or paths to “ffmpeg”. Make sure that each directory is separated by a semicolon as shown below.”…;C:\Program Files\ffmpeg;C:\Program Files (x86)\ffmpeg”Use the path or paths appropriate for your system and chosen setup.

Basic use of ffmpeg.

Since ffmpeg is a CLI (Command-Line Interface) Program, we need to open a command prompt and type the command line we want to use. Now that we have set the path and created our batch file we can easily use ffmpeg like this (make sure to use the correct batch file for the version you want to run, ffmpeg64 or ffmpeg32):Windows Vista and Windows 7 users:

  1. Open an Elevated Command Prompt Window by pressing the Windows Key + R and typing “cmd” (without quotes) in the ‘Open:’ box. DO NOT press ‘Enter’ or click ‘OK’. Instead, press CTRL + Shift + Enter. Answer affirmatively to any User Access Control (UAC) prompts.
  2. In the Command Prompt Window, type ffmpeg32 -version and press ‘Enter’

Windows 2000 and Windows XP users:

  1. Open a Command Prompt Window by pressing the Windows Key + R and typing “cmd” (without quotes) in the ‘Open:’ box and press ‘Enter’ or click ‘OK’.
  2. In the Command Prompt Window, type ffmpeg32 -version and press ‘Enter’

This should display the version of ffmpeg along with information related to the build. The next thing I would suggest you do is create a text file of the help output for your reference.

  1. Open a Command Prompt Window (same as above).
  2. In the Command Prompt Window, type c: and press Enter.
  3. Type cd\ and press Enter.
  4. Type cd C:\Program Files\ffmpeg and press Enter. Your command prompt should now display like C:\Program Files\ffmpeg>_ with the underscore blinking on and off.
  5. Type ffmpeg32 -? > ffmpeg_help.txt and press Enter. The greater-than character redirects the standard output of the Command Window to the file named ffmpeg_help.txt. The file is created in the current directory (‘C:\Program Files\ffmpeg\’). That is why we made sure we were on the C drive with step 2 and changed the directory (cd) to our ffmpeg directory in steps 3 and 4.

ffmpeg has many features and options, too numerous to cover here. I will try to cover more functionality in future articles coming soon.