Garbled images when decoding video using ffmpeg.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Garbled images when decoding video using ffmpeg.

Niklas Nummelin
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<http://www.inb.uni-luebeck.de/%7Eboehme/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
through a divx/xvid-clip 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 :)

// Niklas
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user