<div dir="ltr">Hi,<div><br></div><div>I have this piece of code:</div><div>static gboolean img_export_frame_to_avframe(img_window_struct *img, cairo_surface_t *surface)<br>{<br>       gint    width, height, stride, row, col, offset;<br>      uint8_t  *pix;<br><br>     /* Image info and pixel data */<br>       width  = cairo_image_surface_get_width( surface );<br>   height = cairo_image_surface_get_height( surface );<br>   stride = cairo_image_surface_get_stride( surface );<br>   pix    = cairo_image_surface_get_data( surface );<br><br>g_print("Stride: %d\n",stride);</div><div><br>       /* Avlibrary stuff */<br> img->video_frame = av_frame_alloc();<br>       av_frame_make_writable(img->video_frame);<br>  img->video_frame->format = AV_PIX_FMT_RGBA;<br>     img->video_frame->width  = width;<br>      img->video_frame->height = height;<br>      img->video_frame->linesize[0] = stride;<br> <br>      av_frame_get_buffer(img->video_frame, 1);<br>  img->video_packet = av_packet_alloc();<br>     <br>      for( row = 0; row < img->video_frame->height; row++ )<br>        {<br>             for( col = 0; col < img->video_frame->width; col++ )<br>         {<br>                     offset = 3 * col + row * img->video_frame->linesize[0];<br>                 img->video_frame->data[0][offset + 0] = pix[0];<br>                 img->video_frame->data[0][offset + 1] = pix[1];<br>                 img->video_frame->data[0][offset + 2] = pix[2];<br>         }<br>     }<br>     img_export_encode_av_frame(img->video_frame, img->video_format_context, img->codec_context, img->video_packet);<br>   return TRUE;<br>}<br><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div>But avcodec_send_frame() called from img_export_encode_av_frame() always return:<br><br>libx264 @ 0x5582519787c0] Input picture width (640) is greater than stride (0)<br></div><div><br></div><div>The stride is 5120 not 0! Where am I wrong? Also I grepped with the recursive option the whole ffmpeg4 source and I couldn't find the error message above of course without the 640 and 0...</div><div><br></div><div>Thanks</div><div>Giutor</div><div><br></div><div dir="ltr"></div></div></div></div></div></div></div></div>