Reputation: 77
I try to work with video using this example: 'An ffmpeg and SDL Tutorial'. But the compiler tells me: undefined reference to `avcodec_decode_video'.
I had changed avcodec_decode_video to avcodec_decode_audio3 (I find this function in ffmpeg/avcodec.h). But it doesn't work and I don't understand why. Maybe you know how fix this problem?
Upvotes: 2
Views: 5607
Reputation: 313
You need to link the libraries:
gcc -o main.o main.c `pkg-config --cflags --libs libavformat libavutil`
Upvotes: 0
Reputation: 13216
The linked tutorial stipulates that it is out of date. Indeed, FFmpeg's APIs have evolved since that was written. In FFmpeg's git HEAD as of this writing, the public functions for decoding video and audio are avcodec_decode_video2() and avcodec_decode_audio4(), respectively.
You wrote that you attempted to substitute avcodec_decode_audio3() for avcodec_decode_video(). That won't work because one function is for decoding audio and the other does video. Assuming you're using a recent version of FFmpeg, try using avcodec_decode_video2() for video decoding. Also, look under doc/examples in the FFmpeg source tree for examples which ought to be more up to date.
Upvotes: 3