title: Cannot display YUV Overlay on SDL_Surface
body: <p>I want to modify <code>ffplay</code> by hiding its SDL video player window. Rather, I want to grab the overlay as pixel-by-pixel bitmaps to be used elsewhere in my program.</p>
  <p>Now <code>ffplay</code> can be simplified as below:</p>
  <ol>
  <li><p>Create <code>SDL_Surface *screen</code> from <code>SDL_SetVideoMode()</code></p>
  </li>
  <li><p>Create <code>SDL_Overlay *bmp</code> from <code>SDL_CreateYUVOverlay()</code> and associate it with <code>screen</code></p>
  <p>repeat until video ends</p>
  </li>
  <li><p>Decode movie frames and populate bmp</p>
  </li>
  <li><p>Render bmp onto screen using <code>SDL_DisplayYUVOverlay()</code></p>
  </li>
  </ol>
  <p>Following hints from <a href="http://www.libsdl.org/cgi/docwiki.cgi/FAQ_GUI" rel="nofollow noreferrer">this article</a>, I have replaced Step 1 as below:</p>
  <pre><code>/* Don't want video player window showing on screen
  * int flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
  * screen = SDL_SetVideoMode(w, h, 24, flags);
  */
  Uint32 rmask, gmask, bmask, amask;
  #if SDL_BYTEORDER == SDL_BIG_ENDIAN
  rmask = 0xff000000;
  gmask = 0x00ff0000;
  bmask = 0x0000ff00;
  amask = 0x00000000;
  #else
  rmask = 0x000000ff;
  gmask = 0x0000ff00;
  bmask = 0x00ff0000;
  amask = 0x00000000;
  #endif
  screen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 24, rmask, gmask, bmask, amask);
  </code></pre>
  <p>and Step 4 as</p>
  <pre><code>SDL_DisplayYUVOverlay(bmp, &amp;rect);
  SDL_SaveBMP(screen, filenameN); N++;
  </code></pre>
  <p>Issue:
  If I modify only Step 4, the bitmap files are getting saved properly which is what I want, except that the video playing window is visible. On the other hand, if I modify Step 2 as well, the window gets successfully hidden the bitmaps are all blacked out.</p>
  <p>I am new to SDL, so apart from just the solution, an explanation on why my approach does not work will be helpful.</p>