title: sws_scale generates malformed video
body: <p>I have to encode a series of frames from CAIRO_FORMAT_ARGB32 to AV_PIX_FMT_YUV420P with sws_scale. From the ffmpeg docs I came to know the AV equivalent of the source format is AV_PIX_FMT_ARGB so here is my code:</p>
  <pre><code> // Set up conversion context
      img-&gt;sws_ctx = sws_getCachedContext(
          img-&gt;sws_ctx,
          img-&gt;video_size[0],
          img-&gt;video_size[1],
          AV_PIX_FMT_ARGB,
          img-&gt;video_size[0],
          img-&gt;video_size[1],
          AV_PIX_FMT_YUV420P,
          SWS_BILINEAR,
          NULL,
          NULL,
          NULL);
  
      width  = cairo_image_surface_get_width( surface );
      height = cairo_image_surface_get_height( surface );
      stride = cairo_image_surface_get_stride( surface );
      pix    = cairo_image_surface_get_data( surface );
      const int in_linesize[1] = { stride };
      
      sws_scale(  img-&gt;sws_ctx, (const uint8_t * const *) &amp;pix, in_linesize, 0,
                  img-&gt;video_size[1], img-&gt;video_frame-&gt;data, img-&gt;video_frame-&gt;linesize);
      img-&gt;video_frame-&gt;pts++;
  </code></pre>
  <p>Sadly the video doesn't play and VLC shows a bunch of these useless messages:</p>
  <pre><code>[h264 @ 0x7f6ce0cbc1c0] mmco: unref short failure
  [h264 @ 0x7f6ce0c39a80] co located POCs unavailable
  [h264 @ 0x7f6ce0c82800] co located POCs unavailable
  [h264 @ 0x7f6ce0c9f400] mmco: unref short failure
  </code></pre>
  <p>The encoding process runs just fine. I also tried with const int in_linesize[1] = { 3 * width }; Where am I wrong?</p>