error: 'libavcodec/avcodec.h' file not found
Opened this issue · 7 comments
I'm sorry, but I really can't solve any problem related to the ffmpeg installation on Mac. A couple of months ago my friend tried to resolve it but didn't succeed even with some alternative methods. I suppose just executing brew install libav
is not enough. Or may be it's required to specify the path to the include files in the -ldflags
option of the go build
command.
I fixed that one - Link to SO
However the problem is that one cannot run brew install libav
anymore - it's unmaintained and therefore disabled
@daniel-orlov is that the correct instruction now? (You could do your own PR with this fix if you'd like to).
Hi, the above PR alone is not sufficient, it allows the project to compile but not link.
You have to specify LDFLAGS as well to make linking pass:
CGO_LDFLAGS="-L/opt/homebrew/Cellar/ffmpeg/5.1.2/lib"
that being said, with these CPPFLAGS and LDFLAGS the project compiled on Mac (OS X Monterey on M1 Mac) and works like a charm :-)
Actually, even easier would be to use a CGO pkg-config directive:
// #cgo pkg-config: libavutil libavformat libavformat libswscale
Sending a PR soon.
@dht-hedaihua please check if v0.1.6 resolves your issue.