So I've been trying to go through the following tutorial on ffmpeg: http://dranger.com/ffmpeg/tutorial02.html
However, when I try to compile using gcc, I get the following output:
root:/Users/mbrodeur/Downloads/HACKATHON CONTENT/Tutorials-> gcc -o tutorial02 tutorial02.c -lavutil -lavformat -lavcodec -lz -lavutil -lm -lswscale -D_THREAD_SAFE -lSDL2
tutorial02.c: In function ‘main’:
tutorial02.c:41: error: ‘SDL_Overlay’ undeclared (first use in this function)
tutorial02.c:41: error: (Each undeclared identifier is reported only once
tutorial02.c:41: error: for each function it appears in.)
tutorial02.c:41: error: ‘bmp’ undeclared (first use in this function)
tutorial02.c:98: warning: assignment makes pointer from integer without a cast
tutorial02.c:110: error: ‘SDL_YV12_OVERLAY’ undeclared (first use in this function)
Now, I read that SDL_Overlay is no longer used in SDL2, so therein lies the problem. I've been poking around, but can't seem to find anything helpful. Is there a replacement for SDL_Overlay? Is it necessary?
SDL_Overlay is used in the following context:
SDL_Overlay *bmp;
bmp = SDL_CreateYUVOverlay(pCodecCtx->width, pCodecCtx->height,
SDL_YV12_OVERLAY, screen);
Try SDL_CreateTexture()
with a YUV pixel format that matches the layout and planar-ity of your decoded frames.
Or use libswscale
to convert ffmpeg
's YUV buffers to RGB.
EDIT: SDL2 >= 2.0.1 has SDL_UpdateYUVTexture()
for updating planar YUV textures so you don't have to manually coalesce libav
's buffers any more.