简体   繁体   中英

Ffmpeg: undefined reference to `avcodec_decode_video'

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?

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.

您需要链接库:

gcc -o main.o main.c `pkg-config --cflags --libs libavformat libavutil`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM