FFmpeg is a robust, open-source multimedia framework that can manipulate audio, video, and other multimedia files in various ways. This guide will help you install and use FFmpeg on Windows.
This guide will also cover the basics of encoding, transcoding, and streaming and more advanced features like applying filters and subtitles.
Note: please go here if you want to read more comprehensive FFmpeg tutorials.
Table of Contents
Introduction to FFmpeg
FFmpeg is a powerful command-line tool for working with multimedia files. It supports various codecs, formats, and protocols, making it a versatile and flexible choice for media processing tasks. Some everyday use cases include:
- Encoding and decoding multimedia files
- Converting between different file formats
- Resizing and cropping videos
- Extracting audio from video files
- Adding subtitles to videos
- Streaming live video and audio
Install and Use FFmpeg on Windows
To install and use FFmpeg on Windows, follow these steps:
- Download FFmpeg: Visit the official FFmpeg website and download the latest version of FFmpeg for Windows.
- At this stage, you have two options – you can either download the source code and compile FFMpeg yourself, or you can download a static build (.exe files).
- For the exe files, you can go here and download the Windows zip file (https://github.com/BtbN/FFmpeg-Builds/releases)
- Extract the files: Once the download is complete, extract the zip file’s contents to a folder on your computer.
- For example, you might create a folder called
- You’ll find three executables in this folder: ffmpeg, ffprobe, and ffplay.
- For example, you might create a folder called
- Add FFmpeg to your system’s PATH: To use FFmpeg from the command prompt, add the bin folder within the extracted FFmpeg folder to your system’s PATH environment variable. Follow these steps:
- a. Press Windows + X and select “System” from the menu.
- b. Click on “Advanced system settings” on the right side of the window.
- c. In the “System Properties” window, click the “Environment Variables” button.
- d. Under “System variables,” scroll down and find the “Path” variable, then click “Edit.”
- e. Click “New” and add the path to the
binfolder inside the FFmpeg folder (e.g.,
- f. Click “OK” to save your changes and close the open windows.
- Verify the installation: Open a new command prompt and type
ffmpeg -version. If the installation was successful, you should see information about your installed version of FFmpeg.
Basic Encoding and Transcoding
To convert a multimedia file from one format to another, use the following command:
ffmpeg -i input.ext -c:v codec -c:a codec output.ext
input.ext with the name of the source file and
output.ext with the desired output file name. Replace
codec with the desired video and audio codecs.
For example, to convert a
video.mp4 file to
video.avi format, run:
ffmpeg -i video.mp4 -c:v libxvid -c:a libmp3lame video.avi
FFmpeg can also be used for streaming live video and audio. To stream a video file over HTTP, use the following command:
ffmpeg -re -i input.ext -c copy -f format http://localhost:port/stream_name
input.ext with the name of the source file,
format with the desired streaming format,
port with the desired port number, and
stream_name with a name for your stream.
For example, to stream a
video.mp4 file over HTTP in the MPEG-TS format on port 8080, run:
ffmpeg -re -i video.mp4 -c copy -f mpegts http://localhost:8080/stream
To watch the stream, open a media player that supports network streams, such as VLC, and enter the streaming URL (e.g.,
FFmpeg can also be used for advanced video and image processing, manipulation, and compression cases. Let’s look at a few of these in this section, and as always, you can check our FFmpeg tutorial section for more use cases.
FFmpeg provides a wide range of filters for video and audio manipulation. Filters can be applied using the
-vf (video filter) or
-af (audio filter) options. Here’s an example of how to apply a video filter to resize a video:
ffmpeg -i input.ext -vf "scale=1280:720" output.ext
This command resizes the input video to a resolution of 1280×720 pixels.
To add subtitles to a video, use the following command:
ffmpeg -i input.ext -vf "subtitles=subtitles.srt" output.ext
subtitles.srt with the name of the subtitle file.
This guide covers the process to install and use FFmpeg on Windows, including encoding, transcoding, streaming, and advanced features such as filters and subtitles. With FFmpeg, you can easily manipulate multimedia files to suit your needs.
On OTTVerse, we have comprehensive tutorials on FFmpeg use cases. Please go here to explore our collection of comprehensive FFmpeg tutorials.
Krishna Rao Vijayanagar
Krishna Rao Vijayanagar, Ph.D., is the Editor-in-Chief of OTTVerse, a news portal covering tech and business news in the OTT industry.
With extensive experience in video encoding, streaming, analytics, monetization, end-to-end streaming, and more, Krishna has held multiple leadership roles in R&D, Engineering, and Product at companies such as Harmonic Inc., MediaMelon, and Airtel Digital. Krishna has published numerous articles and research papers and speaks at industry events to share his insights and perspectives on the fundamentals and the future of OTT streaming.