I want to learn FFmpeg (1) Compile and install Ubuntu

I want to learn FFmpeg (1) Compile and install Ubuntu

insert image description here

environment

environment value
ubuntu 18.04
ffmpeg 4.3.2

1. Download

The version I prepared is 4.3.2, the latest version is 4.4, the download link or here to view all released versions

2. Unzip

sudo tar -xjf ffmpeg-4.3.2.tar.bz2 -C /opt

3. Install dependent libraries

3.1,yasm

Installation reason: use assembly to improve efficiency, I don’t understand it very well, I will add it when I understand it

Method 1: Install via apt

sudo apt-get install yasm

Method 2: Download the source code and install it. download link

After method 1 was installed, it was found to be the latest version, so I did not use method 2 anymore.

3.2, SDL

Reason for installation: ffplay player depends on SDL. If it is not installed, ffplay will not be generated after compilation and installation, and it is not necessary to install it.

Method 1: Install via apt

sudo apt-get install libsdl2-2.0
sudo apt-get install libsdl2-dev

Method 2: Download the source code to compile and install. download link

sudo tar -zxvf SDL2-2.0.14.tar.gz -C /opt
sudo ./configure
sudo make
sudo make install

I have tried both ways and it works.

4. Run the configuration file

./configure

5. Compile

Depending on the machine configuration, compilation time may be longer

make -j8

6. Install

Remember to add sudo

sudo make install

7. Check version

ffmpeg -version

ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: 
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100

Question 1

Execute ffplay and report an error


ffplay version 4.3.2 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: 
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  84
  Current serial number in output stream:  85

After searching for a long time, I had no clue, and finally found it on stackoverflow.

Link

btw, this specific error (GLX:24 X_GLXCreateNewContext) error will happens when your video driver is updated for a running X server, restart X to resolve it – ThorSummoner Sep 21 '20 at 20:05

Solution: Restart, no surprises! ! !

The problem is that I installed the navida driver update in the morning, and it has not restarted yet.

Question 2:

ffplay test.wav reports an error:

SDL_OpenAudio (2 channels, 44100 Hz): No such audio device
SDL_OpenAudio (1 channels, 44100 Hz): No such audio device
No more combinations to try, audio open failed
Failed to open file 'test.wav' or configure filtergraph

Solution: This is really a detour around the 18th bend of the mountain road, but I can't find a solution. Finally, I keep trying. The solution steps are as follows:

1. Install libasound2-dev

This is seen in this blog , is it because of this, not sure, friends who see it, you can skip it and try it directly from 2

sudo apt-get install libasound2-dev

2. Uninstall SDL2, recompile and install.

3. Recompile ffmpeg.

reference:

[Ubuntu] Compile and install FFmpeg

Ubuntu 16.04 FFPLay has picture but no sound

Guess you like

Origin blog.csdn.net/lucky_tom/article/details/116298527