[Libav-user] Regarding pixellated video in ffmpeg decoding
Shiju Sasi
sasishiju at gmail.com
Thu Nov 17 14:59:28 CET 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111117/fe62e88d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixellated.jpg
Type: image/jpeg
Size: 54335 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111117/fe62e88d/attachment.jpg>
More information about the Libav-user
mailing list