文章大概就是源码编译 ffmpeg,支持H265 264 编码和gdb 调试
- 下载ffmpeg 源码
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
- 下载依赖库
sudo apt-get install libx264-dev libx265-dev
- 编译选项
./configure --enable-gpl --enable-libx264 --enable-libx265 --enable-shared --enable-debug --disable-stripping --extra-cflags="-g" --extra-ldflags="-g" --prefix=`pwd`/builddir
make -j8
- 生成文件如下
builddir compat config_components.h configure COPYING.GPLv2 COPYING.LGPLv2.1 CREDITS ffbuild ffmpeg_g ffprobe_g INSTALL.md libavdevice libavformat libpostproc libswscale MAINTAINERS presets RELEASE tools
Changelog config.asm config.h CONTRIBUTING.md COPYING.GPLv3 COPYING.LGPLv3 doc ffmpeg ffprobe fftools libavcodec libavfilter libavutil libswresample LICENSE.md Makefile README.md test
make install
- 在调试之前需要配置ffmpeg库的依赖路径
export LD_LIBRARY_PATH=/home/hdp/Documents/OpenSource/ffmpeg/builddir/lib
hdp@hdp-DHC88:~/Documents/OpenSource/ffmpeg$ gdb ./ffprobe_g
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./ffprobe_g...
(gdb) r
Starting program: /home/hdp/Documents/OpenSource/ffmpeg/ffprobe_g
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffprobe version N-118520-g392aa9daf2 Copyright (c) 2007-2025 the FFmpeg developers
built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
configuration: --enable-gpl --enable-libx264 --enable-libx265 --enable-shared --enable-debug --disable-stripping --extra-cflags=-g --extra-ldflags=-g --prefix=/home/hdp/Documents/OpenSource/ffmpeg/builddir
libavutil 59. 57.100 / 59. 57.100
libavcodec 61. 33.102 / 61. 33.102
libavformat 61. 9.107 / 61. 9.107
libavdevice 61. 4.100 / 61. 4.100
libavfilter 10. 9.100 / 10. 9.100
libswscale 8. 13.100 / 8. 13.100
libswresample 5. 4.100 / 5. 4.100
libpostproc 58. 4.100 / 58. 4.100
Simple multimedia streams analyzer
usage: ffprobe [OPTIONS] INPUT_FILE
You have to specify one input file.
Use -h to get full help or, even better, run 'man ffprobe'.
[Inferior 1 (process 62429) exited with code 01]
(gdb)