How to transcode a video using FFmpeg?

Video transcoding is a process of transforming video from one format to other.

There are several steps involved in transcoding a video.

The first step is to make sure that FFmpeg is installed on your system.

  1. Install FFmpeg on Windows
  2. Install FFmpeg on Ubuntu
  3. Install FFmpeg on Mac

Follow the below-given steps to transcode a video using FFmpeg:

  1. On your PC, open a terminal window or command prompt.

  2. Use the ‘cd’ command to move to the directory containing the input video file.

  3. For your video to be transcoded, type the FFmpeg command.

  4. ffmpeg -i input_file -c:v codec -b:v bitrate -c:a audio_codec -b:a audio_bitrate output_file


  • ‘input_file’ is the name and path of your input video file.
  • ‘codec’ is the video codec you wish to use for transcoding (e.g. H.264, VP9, etc.)
  • ‘bitrate’ is the target bitrate for the video (e.g. 1M for 1 megabit per second)
  • ‘audio_codec’ is the audio codec you can use for transcoding (e.g. AAC, MP3, etc.)
  • ‘audio_bitrate’ is the target bitrate for the audio (e.g. 128k for 128 kilobits per second)
  • output_file’ is the name and path of the output transcoded video file.

For example, we are transcoding an input video file named ‘input.mp4’ to an output file called ‘output.webm’ and using the VP9 video codec and the Opus audio codec, along with a video bitrate of 1M and an audio bitrate of 128k, then, the command will be:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 1M -c:a libopus -b:a 128k output.webm

  1. Once you’ve entered the command, FFmpeg will begin transcoding your video. You may check the status of the process in the terminal or command prompt window.

  2. Your output file can be found in the same directory as your input file once the transcoding is finished.

1 Like