[Libav-user] Right pixel column is repeated in the left

Drabner drabner at zoobe.com
Wed Nov 2 13:52:03 CET 2011


I have a rather weird problem:

I use ffmpeg to convert frames from a video engine to a video. Now in the
engine, everything looks fine.

And basically, the conversion of the frames into the video also works. But
somehow, the rightmost pixel of each line is repeated in the left. This does
not happen in the engine, so it must be something within the ffmpeg code.

Here is the function that writes the frames:

int out_size, ret;
        AVCodecContext *c;
        static struct SwsContext *img_convert_ctx = NULL;

        c = st->codec;

                        /* as we only generate a YUV420P picture, we must
convert it
                        to the codec pixel format if needed */
                        if (ptr->img_convert_ctx == NULL)
                                ptr->img_convert_ctx = sws_getContext(
ptr->srcWidth, ptr->srcHeight,
                                        c->width, c->height,
                                        SWS_BICUBIC, NULL, NULL, NULL );
                                if (ptr->img_convert_ctx == NULL)
                                        av_log(c, AV_LOG_ERROR, "%s","Cannot
initialize the conversion context\n");
ptr->tmp_picture->data, ptr->tmp_picture->linesize,
                                0, ptr->srcHeight, ptr->picture->data,

                /* encode the image */
                out_size = avcodec_encode_video( c, ptr->video_outbuf,
ptr->video_outbuf_size, ptr->picture );
                /* if zero size, it means the image was buffered */
                if (out_size > 0)
                        AVPacket pkt;
                        if (c->coded_frame->pts != AV_NOPTS_VALUE)
                                pkt.pts = av_rescale_q(c->coded_frame->pts,
c->time_base, st->time_base);
                                pkt.flags |= AV_PKT_FLAG_KEY;
                        pkt.stream_index= st->index;
                        pkt.data= ptr->video_outbuf;
                        pkt.size= out_size;

                        /* write the compressed frame in the media file */
                        ret = av_write_frame(oc, &pkt);
                        ret = 0;

As I said, this generally works, except that glitch.
Any ideas what could cause this? 

View this message in context: http://libav-users.943685.n4.nabble.com/Right-pixel-column-is-repeated-in-the-left-tp3972867p3972867.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list