1.新建一个项目 在.pro 文件设置include和libs 注意他的 libs 有俩个路径是别搞错了。(不行可以各种试。) 网上说要加 LIBS += -liconv QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11这里没加也可以。 主要是这俩句 LIBS += -L/usr/local/Cellar/ffmpeg/3.4.2/lib -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lswscale INCLUDEPATH += "/usr/local/include" (也有俩这里加了一个也通过了#INCLUDEPATH+=/usr/local/Cellar/ffmpeg/3.4.2/include)

#INCLUDEPATH+=/usr/local/Cellar/ffmpeg/3.4.2/include
INCLUDEPATH += "/usr/local/include"
#QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11

#LIBS += "/usr/local/Cellar/ffmpeg/3.4.2/lib/libavcodec.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libavdevice.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libavfilter.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libavformat.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libavutil.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libpostproc.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libswresample.a" \
#        "/usr/local/Cellar/ffmpeg/3.4.2/lib/libswscale.a"
#LIBS += -liconv



#LIBS+=/usr/local/Cellar/ffmpeg/3.4.2/lib
#LIBS+=/usr/local/lib/libavcodec.a\
#      /usr/local/lib/libavdevice.a\
#      /usr/local/lib/libavfilter.a\
#      /usr/local/lib/libavformat.a\
#      /usr/local/lib/libavutil.a\
#      /usr/local/lib/libpostproc.a\
#      /usr/local/lib/libswresample.a\
#      /usr/local/lib/libswscale.a

LIBS += -L/usr/local/Cellar/ffmpeg/3.4.2/lib -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lswscale