安装SDL和FFmpeg
1、先记录SDL
这玩意还是有一点讲究的
具体步骤:
下载 SDL包:
链接:https://www.libsdl.org/release/SDL2-2.0.14.tar.gz
可以用迅雷,下载完之后,
解压:
tar -zxvf SDL2-2.0.14.tar.gz
进入安装目录
cd SDL2-2.0.14
这里推荐先安装几个包
sudo apt install libsdl2-dev
sudo apt install libwayland-dev wayland-protocols
# 如果存在安装失败的情况
# 判断依据
pkg-config --cflags --libs wayland-client
# 如果返回的值是
-I/usr/include -L/usr/lib/x86_64-linux-gnu -lwayland-client
# 那就没啥问题
# 否则 执行 reinstall
sudo apt install --reinstall libwayland-dev wayland-protocols# 安装完了记得看看是不是在
find /usr -name "libwayland-client.so*" 2>/dev/null
#返回这些 就ok
/usr/lib/x86_64-linux-gnu/libwayland-client.so
/usr/lib/x86_64-linux-gnu/libwayland-client.so.0.22.0
/usr/lib/x86_64-linux-gnu/libwayland-client.so.0
开始编译
./configure --prefix=$PWD/_install
如果存在wayland找不到,那就手动指定wayland的位置
./configure --prefix=$PWD/_install LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lwayland-client"
编译完成后 安装
make && make install
然后就可以看见,没有报错,最多输出一些警告
./configure --prefix=$PWD/_install LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lwayland-client"checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
……/bin/bash build-scripts/mkinstalldirs /home/ctt/Desktop/SDL2-2.0.14/_install/lib
mkdir -p -- /home/ctt/Desktop/SDL2-2.0.14/_install/lib
/bin/bash ./libtool --quiet --mode=install /usr/bin/install -c build/libSDL2.la /home/ctt/Desktop/SDL2-2.0.14/_install/lib/libSDL2.la
/bin/bash ./libtool --quiet --mode=install /usr/bin/install -c build/libSDL2main.la /home/ctt/Desktop/SDL2-2.0.14/_install/lib/libSDL2main.la
/bin/bash ./libtool --quiet --mode=install /usr/bin/install -c build/libSDL2_test.la /home/ctt/Desktop/SDL2-2.0.14/_install/lib/libSDL2_test.la
/bin/bash build-scripts/mkinstalldirs /home/ctt/Desktop/SDL2-2.0.14/_install/share/aclocal
mkdir -p -- /home/ctt/Desktop/SDL2-2.0.14/_install/share/aclocal
/usr/bin/install -c -m 644 /home/ctt/Desktop/SDL2-2.0.14/sdl2.m4 /home/ctt/Desktop/SDL2-2.0.14/_install/share/aclocal/sdl2.m4
/bin/bash build-scripts/mkinstalldirs /home/ctt/Desktop/SDL2-2.0.14/_install/lib/pkgconfig
mkdir -p -- /home/ctt/Desktop/SDL2-2.0.14/_install/lib/pkgconfig
/usr/bin/install -c -m 644 sdl2.pc /home/ctt/Desktop/SDL2-2.0.14/_install/lib/pkgconfig
/bin/bash build-scripts/mkinstalldirs /home/ctt/Desktop/SDL2-2.0.14/_install/lib/cmake/SDL2
mkdir -p -- /home/ctt/Desktop/SDL2-2.0.14/_install/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config.cmake /home/ctt/Desktop/SDL2-2.0.14/_install/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config-version.cmake /home/ctt/Desktop/SDL2-2.0.14/_install/lib/cmake/SDL2
打开安装目录
cd _install
# 查看:~/Desktop/SDL2-2.0.14/_install$ ls
bin include lib share
可以下载一个 tree 看一下里面的结构,比较清晰
:~/Desktop/SDL2-2.0.14/_install$ sudo apt install tree
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
:~/Desktop/SDL2-2.0.14/_install$ tree
.
├── bin
│ └── sdl2-config
├── include
│ └── SDL2
│ ├── begin_code.h
│ ├── close_code.h
│ ├── SDL_assert.h
│ ├── SDL_atomic.h
│ ├── SDL_audio.h
│ ├── SDL_bits.h
│ ├── SDL_blendmode.h
│ ├── SDL_clipboard.h
│ ├── SDL_config.h
│ ├── SDL_cpuinfo.h
│ ├── SDL_egl.h
│ ├── SDL_endian.h
│ ├── SDL_error.h
│ ├── SDL_events.h
│ ├── SDL_filesystem.h
│ ├── SDL_gamecontroller.h
│ ├── SDL_gesture.h
│ ├── SDL.h
│ ├── SDL_haptic.h
│ ├── SDL_hints.h
│ ├── SDL_joystick.h
│ ├── SDL_keyboard.h
│ ├── SDL_keycode.h
│ ├── SDL_loadso.h
│ ├── SDL_locale.h
│ ├── SDL_log.h
│ ├── SDL_main.h
│ ├── SDL_messagebox.h
│ ├── SDL_metal.h
│ ├── SDL_misc.h
│ ├── SDL_mouse.h
│ ├── SDL_mutex.h
│ ├── SDL_name.h
│ ├── SDL_opengles2_gl2ext.h
│ ├── SDL_opengles2_gl2.h
│ ├── SDL_opengles2_gl2platform.h
│ ├── SDL_opengles2.h
│ ├── SDL_opengles2_khrplatform.h
│ ├── SDL_opengles.h
│ ├── SDL_opengl_glext.h
│ ├── SDL_opengl.h
│ ├── SDL_pixels.h
│ ├── SDL_platform.h
│ ├── SDL_power.h
│ ├── SDL_quit.h
│ ├── SDL_rect.h
│ ├── SDL_render.h
│ ├── SDL_revision.h
│ ├── SDL_rwops.h
│ ├── SDL_scancode.h
│ ├── SDL_sensor.h
│ ├── SDL_shape.h
│ ├── SDL_stdinc.h
│ ├── SDL_surface.h
│ ├── SDL_system.h
│ ├── SDL_syswm.h
│ ├── SDL_test_assert.h
│ ├── SDL_test_common.h
│ ├── SDL_test_compare.h
│ ├── SDL_test_crc32.h
│ ├── SDL_test_font.h
│ ├── SDL_test_fuzzer.h
│ ├── SDL_test.h
│ ├── SDL_test_harness.h
│ ├── SDL_test_images.h
│ ├── SDL_test_log.h
│ ├── SDL_test_md5.h
│ ├── SDL_test_memory.h
│ ├── SDL_test_random.h
│ ├── SDL_thread.h
│ ├── SDL_timer.h
│ ├── SDL_touch.h
│ ├── SDL_types.h
│ ├── SDL_version.h
│ ├── SDL_video.h
│ └── SDL_vulkan.h
├── lib
│ ├── cmake
│ │ └── SDL2
│ │ ├── sdl2-config.cmake
│ │ └── sdl2-config-version.cmake
│ ├── libSDL2-2.0.so.0 -> libSDL2-2.0.so.0.14.0
│ ├── libSDL2-2.0.so.0.14.0
│ ├── libSDL2.a
│ ├── libSDL2.la
│ ├── libSDL2main.a
│ ├── libSDL2main.la
│ ├── libSDL2.so -> libSDL2-2.0.so.0.14.0
│ ├── libSDL2_test.a
│ ├── libSDL2_test.la
│ └── pkgconfig
│ └── sdl2.pc
└── share└── aclocal└── sdl2.m4
10 directories, 90 files
:~/Desktop/SDL2-2.0
这就安装好了,剩下的就交由 FFmpeg 和 SDL进行串联开发了。
FFmpeg 的安装比较简单,我选择的是在conda中,直接用
pip install FFmpeg
然后测试
ffmpeg
ffmpeg version 4.4.2 Copyright (c) 2000-2021 the FFmpeg developersbuilt with gcc 12.3.0 (conda-forge gcc 12.3.0-2)configuration: --prefix=/home/ctt/anaconda3/envs/skyeye --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1697113881276/_build_env/bin/x86_64-conda-linux-gnu-cc --cxx=/home/conda/feedstock_root/build_artifacts/ffmpeg_1697113881276/_build_env/bin/x86_64-conda-linux-gnu-c++ --nm=/home/conda/feedstock_root/build_artifacts/ffmpeg_1697113881276/_build_env/bin/x86_64-conda-linux-gnu-nm --ar=/home/conda/feedstock_root/build_artifacts/ffmpeg_1697113881276/_build_env/bin/x86_64-conda-linux-gnu-ar --disable-doc --disable-openssl --enable-avresample --enable-demuxer=dash --enable-hardcoded-tables --enable-libfreetype --enable-libfontconfig --enable-libopenh264 --enable-gnutls --enable-libmp3lame --enable-libvpx --enable-pthreads --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-pic --enable-shared --disable-static --enable-version3 --enable-zlib --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1697113881276/_build_env/bin/pkg-configlibavutil 56. 70.100 / 56. 70.100libavcodec 58.134.100 / 58.134.100libavformat 58. 76.100 / 58. 76.100libavdevice 58. 13.100 / 58. 13.100libavfilter 7.110.100 / 7.110.100libavresample 4. 0. 0 / 4. 0. 0libswscale 5. 9.100 / 5. 9.100libswresample 3. 9.100 / 3. 9.100libpostproc 55. 9.100 / 55. 9.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...Use -h to get full help or, even better, run 'man ffmpeg'
未完待续