[Libav-user] Input picture width is greater than stride error in encoding.

daggs daggs at gmx.com
Sun Oct 23 19:53:11 EEST 2016

Greetings all,

I'm trying to see what is the simplest way to grab video from screen, encode it into h264 and save it to file, so I took the decode_encode.c (from http://ffmpeg.org/doxygen/trunk/decoding__encoding_8c-source.html) and added a grabbing part.
when I'm trying to encode the first frame, I get this error: "[libx264 @ 0xafa560] Input picture width (1920) is greater than stride (0)"
the diff from the original code of the encoder when it comes to setup is this:
c->bit_rate = 0;
/* resolution must be a multiple of two */
c->width = 1920;
c->height = 1080;
/* frames per second */
c->time_base = av_d2q(((double) 1) / 60, 1);
c->ticks_per_frame = 2;
c->gop_size = 10; /* emit one intra frame every ten frames */
c->max_b_frames = 1;
c->pix_fmt = AV_PIX_FMT_YUV444P;

any ideas what I'm missing?
the goal is to grab the entire screen at 60 fps.


More information about the Libav-user mailing list