Garbled video when decoding with ffmpeg.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Garbled video when decoding with 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 :)
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Garbled video when decoding with ffmpeg.

Michel Bardiaux-2
Niklas Nummelin wrote:
> 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.

If there are missing key-frames in the data, there is not much you can
do. If you can find a way to 'guess' when a key frame is missing, you
might try a copy of the previous one; that would not suppress all
defectuosities, but might reduce them Though if your DIVX have GOP size
300, that is unlikely.

You should take this issue to ffmpeg-user until you *can* decode all
your input files using ffmpeg.

> 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 :)
/lists.mplayerhq.hu/mailman/listinfo/libav-user


--
Michel Bardiaux
http://www.mediaxim.com/
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user