user3369375
user3369375

Reputation: 21

avformat.h and avcode.h NOT FOUND

I am using MAC OSx and OpenCv 2.4.8. I am trying to compile a program which includes:

avformat.h and avcodec.h

I have looked for those files in my computer and they exist (in OpenCv folder).

When I compile like this:

g++ track.cpp -o track -I /Desktop/opencv-2.4.8/include/opencv -L /Desktop/opencv-2.4.8/3rdparty/include/ffmpeg_/libavcodec /Desktop/opencv-2.4.8/3rdparty/include/ffmpeg_/libavformat -lopencv_highgui -lopencv_core -lavcodec -lavformat

I get the following error:

fatal error: 'avformat.h' file not found fatal error: 'avcodec.h' file not found

What's wrong??

THANKS A LOT!!

Upvotes: 0

Views: 3173

Answers (2)

Manoj Mohan
Manoj Mohan

Reputation: 6044

These headers are part of ffmpeg package. Get the path to ffmpeg installation by running 'brew info' command.

   brew info ffmpeg

ffmpeg: stable 5.0.1 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/opt/homebrew/Cellar/ffmpeg/5.0.1_2 (272 files, 48.4MB) *


"/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include" should have the required headers.

Upvotes: 0

aquagremlin
aquagremlin

Reputation: 3549

I fixed it by building ffmpeg from source.

brew uninstall ffmpeg
brew install ffmpeg --build-from-source

Upvotes: 2

Related Questions