zergon321 / reisen

A simple library to extract video and audio frames from media containers (based on libav).
MIT License
137 stars 21 forks source link

error: 'libavcodec/avcodec.h' file not found #11

Open dht-hedaihua opened 2 years ago

dht-hedaihua commented 2 years ago

Hi,i wonder to use reisen on my Mac,but unfortunately i encountered some problems :

image image

Looking forward to your reply, thank you!

zergon321 commented 2 years ago

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.

daniel-orlov commented 1 year ago

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

zergon321 commented 1 year ago

@daniel-orlov is that the correct instruction now? (You could do your own PR with this fix if you'd like to).

kibab commented 1 year ago

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"
kibab commented 1 year ago

that being said, with these CPPFLAGS and LDFLAGS the project compiled on Mac (OS X Monterey on M1 Mac) and works like a charm :-)

kibab commented 1 year ago

Actually, even easier would be to use a CGO pkg-config directive: // #cgo pkg-config: libavutil libavformat libavformat libswscale

Sending a PR soon.

zergon321 commented 1 year ago

@dht-hedaihua please check if v0.1.6 resolves your issue.