How To Install Ffmpeg On Debian, Ubuntu, Alpine, Arch, Kali, Raspbian And MacOS?

How To Install Ffmpeg On Debian, Ubuntu, Alpine, Arch, Kali, Raspbian And MacOS?

ffmpeg

Video conversion tool.

Maintainer: Debian Multimedia Maintainers



Section: video

Install ffmpeg

  • Debian apt-get install ffmpeg Click to copy
  • Ubuntu apt-get install ffmpeg Click to copy
  • Alpine OS apk add ffmpeg Click to copy
  • Arch Linux pacman -S ffmpeg Click to copy
  • Kali Linux apt-get install ffmpeg Click to copy
  • Raspbian apt-get install ffmpeg Click to copy
  • macOS brew install ffmpeg Click to copy

Video conversion tool.

How to use ffmpeg?

Below are few example commands for ffmpeg that you can use in the terminal.

Extract the sound from a video and save it as MP3:
ffmpeg -i video.mp4 -vn sound.mp3Click to copy
Convert frames from a video or GIF into individual numbered images:
ffmpeg -i video.mpg|video.gif frame_%d.pngClick to copy
Combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i frame_%d.jpg -f image2 video.mpg|video.gifClick to copy
Quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
ffmpeg -ss mm:ss -i video.mp4 -frames 1 -s 128x128 -f image2 image.pngClick to copy
Trim a video from a given start time mm:ss to an end time mm2:ss2 (omit the -to flag to trim till the end):
ffmpeg -ss mm:ss -to mm2:ss2 -i video.mp4 -codec copy output.mp4Click to copy
Convert AVI video to MP4. AAC Audio @ 128kbit, h264 Video @ CRF 23:
ffmpeg -i input_video.avi -codec:audio aac -b:audio 128k -codec:video libx264 -crf 23 output_video.mp4Click to copy
Remux MKV video to MP4 without re-encoding audio or video streams:
ffmpeg -i input_video.mkv -codec copy output_video.mp4Click to copy
Convert MP4 video to VP9 codec. For the best quality, use a CRF value (recommended range 15-35) and -b:video MUST be 0:
ffmpeg -i input_video.mp4 -codec:video libvpx-vp9 -crf 30 -b:video 0 -codec:audio libopus -vbr on -threads number_of_threads output_video.webmClick to copy
Installation of latest ffmpeg command is available for Debian, Ubuntu, Alpine, Arch, Kali, Raspbian and macOS. You can copy the command for your OS from above and paste it into your terminal. Once you run the command it will download the 2026 latest package from the repository and install it in your computer/server.