参考文章https://phoenixnap.com/kb/install-ffmpeg-ubuntu
依次输入以下三个命令即可
sudo apt update && sudo apt upgrade
sudo apt install ffmpeg
ffmpeg -version
安装好以后可以通过以下命令验证一下:
ffplay 视频文件
看能否正常播放
参考文章复制粘贴如下:
Installing FFmpeg on Ubuntu
October 13, 2022 linuxsnapubuntu
Introduction
FFmpeg is a command-line tool that records, transcodes, mixes, formats, and streams multimedia content. This cross-platform framework is open-source and shares audio and video libraries (libavutil, libavcodec, libavformat, libavdevice, libavfilter, libswscale, and libswresample) with users for free.
In this tutorial, you will learn about installing FFmpeg on Ubuntu using two methods.
Prerequisites
- Ubuntu installed (this guide uses Ubuntu 20.04).
- A user with root or sudo privileges.
- Access to the terminal.
Install FFmpeg on Ubuntu with apt
The FFmpeg package is included in Ubuntu repositories, but the version may not be the latest. Still, apt is frequently used as it is one of the easiest ways to install FFmpeg on Ubuntu.
Step 1: Update the Repository
Update and upgrade the system packages to get the FFmpeg version currently available in the repository. Execute the following command:
sudo apt update && sudo apt upgrade
Hit y to continue when prompted:
Step 2: Install FFmpeg
After upgrading the repository, install FFmpeg by running the following:
sudo apt install ffmpeg
Step 3: Verify the Installation
Confirm that FFmpeg has been installed with:
ffmpeg -version
The command verifies that the 4.2.7 version of FFmpeg is installed. The 4.2.7 is the latest stable FFmpeg version in the Ubuntu 20.04 repositories. However, apps in Ubuntu repositories are not always up-to-date.
To update FFmpeg to the latest version, use snappy.
Install FFmpeg on Ubuntu with snappy
Get the latest version of FFmpeg with the Snap package manager (snappy).
The snap tool packs an app and its dependencies in a snap package, a container that works on any Linux distribution. Moreover, unlike FFmpeg packages in official Ubuntu repositories, snaps are updated automatically and continually, ensuring users get the latest FFmpeg version.
Step 1: Install Snap
Start by checking whether Snap is already installed on the system, as is the case on Ubuntu. Execute the following:
snap version
The output verifies that Snap is running. In case Ubuntu does not have Snap, the command prints the following:
To add Snap to the machine, follow these steps:
1. Update and upgrade the repository with:
sudo apt update && sudo apt upgrade
2. Install Snap by running:
sudo apt install snapd
3. Verify the installation using:
snap version
Step 2: Install FFmpeg
To install FFmpeg, run:
sudo snap install ffmpeg
The terminal displays the progress bar. Once the installation completes, the output looks like this:
Note: If you previously installed ffmpeg using apt, uninstall the tool, restart the system, and then use snap to install ffmpeg again.
Step 3: Verify the Installation
To verify that FFmpeg is installed, run:
ffmpeg -version
The version of FFmpeg installed with Snap is 4.3.1, a more recent version than the one installed via apt (4.2.7).
Conclusion
After going through this tutorial, you now understand how to install FFmpeg on Ubuntu using apt
or snappy. Next, learn about the differences between Snap, Flatpack, and AppImage package formats.
If you are a Windows user, read our tutorial and learn how to install FFmpeg on Windows, and if you are a Mac user, learn how to install FFmpeg on MacOS..
标签:FFmpeg,Ubuntu22.04,sudo,apt,version,install,Ubuntu,安装 From: https://www.cnblogs.com/heweiren-cheng/p/17492937.html