Hallo, es kennen einige von euch doch bestimmt Fraps,
nur leider is des ja net freeware,
also würde ich sowas gerne mal selbst proggen, das problem ist,
dass man möglichst viele screenshots, also immer in einer bestimmten
framezahl speichert und dann direkt in eine avi schreibt, wie mache ich das
am besten?
Fraps erkennt ja fenster in denen sich etwas abspielt und captured diese dann, es ist ja ein screenshot aus diesem fenster oder fullscreen.
Bei Fraps ist ja auch ein FPS counter integriert und sounds werden auch gleich mit aufgenommen.
Das wäre natürlich auch net schlecht, aber wie mache ich das ?
wie bekomme ich das sofort in eine AVI, also bild für bild ... ?
es gibt da was von microsoft, das heißt VCM (video compression manager),
aber wie benutzt ich den, ich glaube, damit kann man auch codecs benutzen.
und wie greife ich die sound direkt bei der soundkarte ab ? (oder geht das anders?)
Bisheriger Code:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TWMHotkey = record Msg: Cardinal; idHotKey: Word; Modifiers: Integer; VirtKey: Integer; end;
type TForm1 = class(TForm) Timer1: TTimer; Edit1: TEdit; Label1: TLabel; Label2: TLabel; procedure FormCreate(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure Timer1Timer(Sender: TObject); private procedure WMHotKey(var Msg: TWMHotKey); Message WM_HOTKEY; public end;
const ID = $FF;
var Form1: TForm1; count, fps: integer; rec: boolean;
implementation
{$R *.dfm}
function GetCursorInfo2: TCursorInfo; var hWindow: HWND; pt: TPoint; pIconInfo: TIconInfo; dwThreadID, dwCurrentThreadID: DWORD; begin Result.hCursor := 0; ZeroMemory(@Result, SizeOf(Result)); if GetCursorPos(pt) then begin Result.ptScreenPos := pt; hWindow := WindowFromPoint(pt); if IsWindow(hWindow) then begin dwThreadID := GetWindowThreadProcessId(hWindow, nil); dwCurrentThreadID := GetCurrentThreadId; if (dwCurrentThreadID <> dwThreadID) then begin if AttachThreadInput(dwCurrentThreadID, dwThreadID, True) then begin Result.hCursor := GetCursor; AttachThreadInput(dwCurrentThreadID, dwThreadID, False); end; end else begin Result.hCursor := GetCursor; end; end; end; end;
function CaptureScreen: TBitmap; var DC: HDC; ABitmap: TBitmap; MyCursor: TIcon; CursorInfo: TCursorInfo; IconInfo: TIconInfo; begin DC := GetDC(GetDesktopWindow); ABitmap := TBitmap.Create; try ABitmap.Width := GetDeviceCaps(DC, HORZRES); ABitmap.Height := GetDeviceCaps(DC, VERTRES); BitBlt(ABitmap.Canvas.Handle, 0, 0, ABitmap.Width, ABitmap.Height, DC, 0, 0, SRCCOPY); MyCursor := TIcon.Create; try CursorInfo := GetCursorInfo2; if CursorInfo.hCursor <> 0 then begin MyCursor.Handle := CursorInfo.hCursor; GetIconInfo(CursorInfo.hCursor, IconInfo); ABitmap.Canvas.Draw(CursorInfo.ptScreenPos.X - IconInfo.xHotspot, CursorInfo.ptScreenPos.Y - IconInfo.yHotspot, MyCursor); end; finally MyCursor.ReleaseHandle; MyCursor.Free; end; finally ReleaseDC(GetDesktopWindow, DC); end; Result := ABitmap; end;
procedure TForm1.FormCreate(Sender: TObject); begin RegisterHotKey(Form1.Handle, ID, 0, vk_f9); rec:= false; count:= 0; end;
procedure TForm1.WMHotKey(Var Msg: TWMHotkey); var B: TBitmap; i, j: integer; c: string; begin if Msg.IdHotKey = id then begin rec:= not rec; fps:= round(1000/strtoint(edit1.text)); while rec = true do begin B:= TBitmap.Create; try B.Width:= screen.width; B.Height:= screen.height; B:= CaptureScreen; inc(count); c:= inttostr(count); if length(c) < 5 then for i:= length(c) to 4 do c:= '0' + c; B.SaveToFile('C:\capt\'+ c +'.bmp'); finally B.free; end; for j:= 0 to fps do application.processmessages; end; end; inherited; end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (Key in ['0'..'9', Char(VK_BACK)]) then Key := #0; end;
procedure TForm1.Timer1Timer(Sender: TObject); var B: TBitmap; i: integer; c: string; begin B:= TBitmap.Create; try B.Width:= screen.width; B.Height:= screen.height; B:= CaptureScreen; inc(count); c:= inttostr(count); if length(c) < 5 then for i:= length(c) to 4 do c:= '0' + c; B.SaveToFile('C:\capt\'+ c +'.bmp'); finally B.free; end; end;
end. |
habs erst mit nem timer, dann mit sleep und dann mit application.processmessages probiert, jedoch erhalte ich net die korrekte fps zahl, irgendwie muss man doch eine art globales processmessages machen können, damit jedes einzelbild auf seinen screenshot wartet, bevor das nächste gezeichnet wird, die performance muss dann aber noch ausreichen um F9 abzufangen.
*amrandederverzweiflung*
ich habe mir mal das tool gamecam angeschaut, es scheint hooks zu benutzen und die dateien die es schreibt sind sehr klein, und die performance leiden ganz wenig, also dieses tool ist der hammer !