Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#9

AW: Mediaplayer Pause Screen erstellen fehlt das Bild

  Alt 15. Nov 2012, 09:31
Das DSPack ist recht handlich, wenn es darum geht Einzelbilder aus einem Video zu bekommen, dass einen beliebigen installierten Codec verwendet. (Die Codecs selber alle zu implementieren dürfte Mannjahre dauern.)
Bei AVI handhabe ich das so wobei ich direkt auf das Bitmap aus dem Stream zurückgreifen kann.
Siehe ..
BMP := AVIStreamGetFrame(GetFramePointer, frame);
Delphi-Quellcode:
procedure GetAVIFrame;
var
  Frame : Integer;
  AVIElapsedTime : DWord;
  BMP : ^TBITMAPINFOHEADER;

begin
  // Get the elapsed time. If the elapsed time is longer than the
  // video clip, then reset the elapsed time and video start
  AVIElapsedTime :=GetTickCount() - AVIStart;
  if AVIElapsedTime > AVILength then
  begin
    AVIStart :=GetTickCount();
    AVIElapsedTime :=0;
  end;

  // Get the next frame based on the elaped time
  Frame :=AVIStreamTimeToSample(AVIStream, AVIElapsedTime);
  if Frame <> ActiveFrame then
  begin
    ActiveFrame :=Frame;
{    // use this for uncompressed video ONLY
    AVIStreamRead(AviStream, Frame, 1, FrameData, AviInfo.dwWidth*AviInfo.dwHeight*3, nil, nil);
}

    // use this for compressed video
    BMP := AVIStreamGetFrame(GetFramePointer, frame);
    FrameData := Pointer(Cardinal(BMP) + BMP.biSize + BMP.biClrUsed*sizeof(RGBQUAD));
    // the drawdib function will uncompress the framedata as it tries to copy the BMP
    DrawDibDraw(0, H_DC, 0, 0, AviInfo.dwWidth, AviInfo.dwHeight, @BMP, FrameData, 0, 0, AVIInfo.dwWidth, AVIInfo.dwHeight, 0);

    SwapRGB(FrameData, AviInfo.dwWidth * AviInfo.dwHeight); // Swap the BGR image to a RGB image

    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, AviInfo.dwWidth, AviInfo.dwHeight, GL_RGB, GL_UNSIGNED_BYTE, FrameData);

  end;
end;
Zitat:
Die Codecs selber alle zu implementieren dürfte Mannjahre dauern.)
Das ist wohl war.

gruss
  Mit Zitat antworten Zitat