Jump to content

Recommended Posts

Posted (edited)

This Records/plays screen activity

simple, and the player is slightly(extreamly) glitches xD

YOU MUST put both files in the same dir and create a folder named SC

todo:

save all output screen shot files to a video file

recorder:

#Include <ScreenCapture.au3>
HotKeySet("{ESC}", "_esc")
_ScreenCapture_SetJPGQuality(100)
$x=0
while 1
    _ScreenCapture_Capture("sc\"&$x&".jpg")
    $x = $x + 1
WEnd

func _esc()
    Exit
EndFuncoÝ÷ ÚZÉêè¦Ø¦7o'[Íö§jØjëh×6#Include <File.au3>
#Include <Array.au3>
GUICreate("Screen Record BETA",700,600,-1,-1,0x40000)
$y=0
$FileList=_FileListToArray(@ScriptDir&"/sc")
$frames = UBound($FileList)
$frames = $frames - 1
$vid = GUICtrlCreatePic("sc/"&$y&".jpg", 0, 0, 700, 600)
GUICtrlSetResizing(-1,102)
GUISetState()
For $y = 0 To $frames
sleep(0)
GUICtrlSetImage($vid,"sc/" & $y & ".jpg")
Next

While GUIGetMsg() <> -3
WEnd
Edited by emoyasha
  Reveal hidden contents

 

Posted (edited)

Redid your player a bit, it works better now, looks like a real video ;).

#Include <File.au3>
#Include <Array.au3>
GUICreate("Screen Record BETA",700,600,-1,-1,0x40000)
$y=0
$FileList=_FileListToArray(@ScriptDir&"/sc")
$frames = UBound($FileList)
$frames = $frames - 1
$vid = GUICtrlCreatePic("sc/"&$y&".jpg", 0, 0, 700, 600)
GUICtrlSetResizing(-1,102)
GUISetState()
For $y = 0 To $frames
sleep(0)
GUICtrlSetImage($vid,"sc/" & $y & ".jpg")
Next

While GUIGetMsg() <> -3
WEnd

Left the sleep in there so people can adjust the speed if they like.

Edited by dbzfanatic
Posted

thanks for re-doing my player =]

i had the files -4 because i do believe as in php this count the following files

1)thumbs.db

2)

3).

4)..

this way it wouldnt play more files than existed, but good work.

and as how to add themm all in to a video file... idk

i suppose even a GIF would be nice, just we need a way to compress them all in to one animated file.

  Reveal hidden contents

 

Posted

Here's an *cough* update example that can capture to 1 file and playback at the desired speed, but the size of the capture file is huge.

The output from my update is still smaller and better image quality then jpg @ 100% quality.

My example would create a 300 mb file for 1 min of capture @ 1024x768 @ 15fps.

@ 1024x768:

1 frame capture in jpg @ 100% quality is around 450kb ..

1 frame in tif is around 150kb (24bit, LZW compression)

The quality of the tif frame is clear and crisp

The quality of the jpg is lossy and discolored

Mind you my example @ the above settings chews 80~90% cpu usage on my old single core centrino 1.73Ghz, 512mb laptop.

Sorry the codes not optimized, commented or error proof.

But if you'd like to play with the code then feel free to optimize it for your needs.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#include <GDIPlus.au3>

Global $MultiFrameTif = @ScriptDir & "\TestMultiPage.tif", $FPS = 15, $Seconds = 60 ;1 Minute
Global $i = 0, $FC = 0

_MakeMyMultiPageTif($MultiFrameTif, $FPS, $Seconds) ; Start capture to tif file

MsgBox(0, "Capture Finished", "Going to display capture now @ Fullscreen")

$hGUI = GUICreate("Display Multi-Page tif", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetState()

_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

Do
    Local $hImage = _GDIPlus_ImageGetFrame($MultiFrameTif, $i)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
    _GDIPlus_ImageDispose($hImage)
    Sleep(1000/$FPS)
    $i += 1

Until $i = $FC

_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()


Func _MakeMyMultiPageTif($sOutTif, $iFPS = 15, $iSeconds = 60)
    Local $sCLSID, $tData, $tParams, $hImage0, $hBitmap0, $hBitmapN, $hImageN
    _GDIPlus_Startup()
    $sCLSID = _GDIPlus_EncodersGetCLSID("TIF")
    $tParams = _GDIPlus_ParamInit(3)
    $tData = DllStructCreate("int Data;int ColorDepth;int Compression")
    DllStructSetData($tData, "Data", $GDIP_EVTMULTIFRAME)
    DllStructSetData($tData, "ColorDepth", 24)
    DllStructSetData($tData, "Compression", $GDIP_EVTCOMPRESSIONLZW)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))
    $hBitmap0 = _ScreenCapture_Capture("", 0, 0, @DesktopWidth, @DesktopHeight)
    $hImage0 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap0)
    _GDIPlus_ImageSaveToFileEx($hImage0, $sOutTif, $sCLSID, DllStructGetPtr($tParams))
    $tParams = _GDIPlus_ParamInit(3)
    DllStructSetData($tData, "Data", $GDIP_EVTFRAMEDIMENSIONPAGE)
    DllStructSetData($tData, "ColorDepth", 24)
    DllStructSetData($tData, "Compression", $GDIP_EVTCOMPRESSIONLZW)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))    
    Do 
        $hBitmapN = _ScreenCapture_Capture("", 0, 0, @DesktopWidth, @DesktopHeight)
        $hImageN = _GDIPlus_BitmapCreateFromHBITMAP($hBitmapN)
        _GDIPlus_ImageSaveAddImage($hImage0, $hImageN, DllStructGetPtr($tParams))
        _GDIPlus_ImageDispose($hImageN)
        _WinAPI_DeleteObject($hBitmapN)
        $FC += 1
        Sleep(1000/$iFPS)
    Until ($FC = ($iFPS * $iSeconds))
    $tParams = _GDIPlus_ParamInit(3)
    DllStructSetData($tData, "Data", $GDIP_EVTFLUSH)
    DllStructSetData($tData, "ColorDepth", 24)
    DllStructSetData($tData, "Compression", $GDIP_EVTCOMPRESSIONLZW)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))
    _GDIPlus_ImageSaveAdd($hImage0, DllStructGetPtr($tParams))
    _GDIPlus_ImageDispose($hImage0)
    _WinAPI_DeleteObject($hBitmap0)
    _GDIPlus_Shutdown()
EndFunc   ;==>_MakeMyMultiPageTif

Func _GDIPlus_ImageGetFrame($sFile, $iFrame)
    Local $hImage, $tDL, $pDimensionIDs, $GFDC, $GFC
    $hImage = _GDIPlus_ImageLoadFromFile($sFile)
    $tDL = DllStructCreate($tagGUID)
    $pDimensionIDs = DllStructGetPtr($tDL)
    $GFDC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "ptr", $hImage, "int*", 0)
    DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2])
    $GFC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "int", $hImage, "ptr", $pDimensionIDs, "int*", 0)
    DllCall($ghGDIPDll, "int", "GdipImageSelectActiveFrame", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $iFrame)
    Return $hImage
EndFunc   ;==>_GDIPlus_ImageGetFrame

Func _GDIPlus_ImageSaveAddImage($hImage, $hImageNew, $pParams)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSaveAddImage", "hwnd", $hImage, "hwnd", $hImageNew, "ptr", $pParams)
    If @error Then Return SetError(@error, @extended, False)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_ImageSaveAddImage

Func _GDIPlus_ImageSaveAdd($hImage, $pParams)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSaveAdd", "hwnd", $hImage, "ptr", $pParams)
    If @error Then Return SetError(@error, @extended, False)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_ImageSaveAdd

Cheers

Posted (edited)

when you get the time could you please comment your code, it seems a bit complex at first glance, i will further analyze later.

[how is this done?]

this is a static image file.. with many immages all stored in one?

am i correct, maybe close?

Edited by emoyasha
  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...