[Libav-user] Regarding pixellated video in ffmpeg decoding

Geek.Song ffmpeg at gmail.com
Sat Nov 19 03:28:39 CET 2011


Please remove the setting of CODEC_CAP_TRUNCATED

在 Nov 17, 2011,9:59 PM,Shiju Sasi <sasishiju at gmail.com> 写道:

> Hi,
>  
> I have created a sample windows application using ffmpeg and x264 and attached it's screenshot. In the application, I capture video and encode it using x264, then decode it using ffmpeg and render it. My problem is large amount of pixellation. I eliminated the possibility of rendering issues and concluded that decoded and scaled output became pixellated.
>  
> Request your 2 minutes to review my working approach to see if I have missed out anything obvious. I have copied only the relevant parts due to formatting issues in gmail. If you can review to check if I have missed out any obvious methods/settings as part of decoding, it will be really helpful.
>  
> FYI, I have allocated pCodecCtx in the below code using avcodec_alloc_context3 and I have set only the coded_height, coded_width and pix_fmt fields. I also use
> if(pDecoder->capabilities & CODEC_CAP_TRUNCATED)
> 
> pCodecCtx->flags|=CODEC_FLAG_TRUNCATED;
> 
> In the scale context, I use SWS_POINT flag for maximum quality.
> 
>  
> 
>  
> void decode_h264(const uint8_t* in_buf, int in_buf_size, uint8_t** out_buf, int* out_buf_size)
> {
>    int got_picture = 0;
>    AVPacket avpkt;
>    av_init_packet(&avpkt);
>    while(in_buf_size > 0)
>    {
>       int len = 0;
>       len = av_parser_parse2(pDecoderParserContext,pCodecCtx, &avpkt.data, &avpkt.size, in_buf, in_buf_size, 0, 0, 0);
>       in_buf += len;
>       in_buf_size -= len;
>       if(avpkt.size > 0)
>       {
>         avcodec_decode_video2(pCodecCtx, pFrame,&got_picture,&avpkt);
>        if(got_picture > 0)
>        {
>          sws_scale(decoderConvertCtx, pFrame->data, pFrame->linesize , 0, pFrame->height, pOutFrame->data, pOutFrame->linesize);
>        }
>        *out_buf_size = userpOutFrame->linesize[0];
>        *out_buf = pOutFrame->data[0];
>       }
>    }
>  
> }
>  
> Thanks in advance,
> Shiju
>  
> 
> <pixellated.jpg>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111119/296b68bc/attachment.html>


More information about the Libav-user mailing list