[FFmpeg-devel] Garbled video when using ffmpeg.
Niklas Nummelin
nummelin
Thu Jun 12 20:51:54 CEST 2008
I've started to develop a direct show source plugin using ffmpeg. The code
interfacing with ffmpeg looks more or less like the general examples on the
page (http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html). I've
tested both the old and new way of doing it (i.e. with av_read_packet or
with av_read_frame) The problem is that my decoded frames seems to be
garbled with a lot of weird artifacts, similar to those you get when seeking
in a media player. Most likely because of some missed key frames in the
coded data. I have tried both old mpegs and divx:es, with the same result.
This is the one based on the old way of doing it (where GetNextFrame is
exactly as on the tutorial page):
AVFrame* VideoDecodeGetFrame()
{
bool res = GetNextFrame(pFormatCtx, pCodecCtx, videoStream, pFrame);
if(!res) return NULL;
//Convert YUV->RGB
sws_scale(pSWSCtx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height,
pFrameRGB->data, pFrameRGB->linesize);
return pFrameRGB;
}
If you need to know anything more in order to come up with a solution, don't
hesitate to ask :)
More information about the ffmpeg-devel
mailing list