ffmpeg - compiling an example file

last updated: Sep 23, 2024

I wanted to compile a file from the ffmpeg examples directory, since I'm considering writing golang that links directly to ffmpeg via cgo.

I don't use C often enough to remember how everything works, so I have to re-figure-out how to compile stuff every time. Here's what I ended up with:

clang \ -I/opt/homebrew/Cellar/ffmpeg/7.0.2/include \ -L/opt/homebrew/Cellar/ffmpeg/7.0.2/lib/ \ -lavutil -lavfilter -lavformat \ decode_filter_video.c

clangd

Without any configuration, clangd won't be able to find the header files you need. Here's a config file I created to give it the header directory and add -Wall. Save it to .clangd:

CompileFlags: Add: - "-Wall" - "-I/opt/homebrew/Cellar/ffmpeg/7.0.2/include"
↑ up