问题描述
我正在尝试从源代码编译ffmpeg,但是当我尝试编译依赖于它的程序时(从一个教程)中,我收到了错误消息:
I'm trying to compile ffmpeg from source, but when I try to compile a program dependent on it (from a tutorial), I get the error:
fatal error: ffmpeg/swscale.h: No such file or directory
我已经克隆了 github存储库,并遵循了安装说明,但仍然出现相同的错误.
I have cloned the github repository and followed the install instructions, but still get the same error.
我也尝试过 make install-libs
和 make config.h
,但是我有点儿不在意,因为我并不是一个真正的C程序员.
I have also tried make install-libs
and make config.h
, but I'm kind of out of my depth here, because I'm not really a C programmer.
推荐答案
如果正确安装了ffmpeg(使用sudo make install)和makefile,则可以使用 #include< libswscale/swscale.h>
这些内容如下:
you can use #include <libswscale/swscale.h>
if ffmpeg installed correctly (with sudo make install) and your makefile has these below:
注意:我也正在使用/使用ffmpeg API,这已经过测试.哦,对于c ++项目,您可能需要在包含之前使用 extern"C"
.
Note: I'm using/used ffmpeg API's too, this is tested. Oh and for c++ projects you may want to use extern "C"
before include.
Makefile(对于c ++):
Makefile (for c++):
LIBAV_PATH = /set_correct_pathto/ffmpeg/lib/pkgconfig/
PKG_DEPS = libavcodec libavformat libswscale libswresample libavutil
CXXFLAGS += `PKG_CONFIG_PATH=$(LIBAV_PATH) pkg-config --cflags $(PKG_DEPS)`
LDFLAGS += `PKG_CONFIG_PATH=$(LIBAV_PATH) pkg-config --libs $(PKG_DEPS)`
对于C,将 CXXFLAGS
更改为 CFLAGS
.
希望有帮助.
For C, change CXXFLAGS
to CFLAGS
.
Hope that helps.
这篇关于如何在ffmpeg中包含swscale.h?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!