wakillon

XvidCapture Demo capturing made easy, into avi video file with stereo sound

20 posts in this topic

#1 ·  Posted (edited)

XvidCapture, demo capturing made easy, into avi video file with stereo sound.

20150126144353.jpg

 

Script use XvidCapture.dll made for freebasic by D.J.Peters
 
Major defects :
 
       The frame rate need to be limited due to the time for write datas (80-130 ms by frame with a 1920x1080 screen size and a 640x480 video size).
       The dll support only uncompressed wav audio format (do not work with mp3)
       The quality setting doesn't seem to change anything.

 

Tested with AutoIt 3.3.8.1 on WinXP SP3 and AutoIt 3.3.12.0 on Win7/Win8.1

On my netbook using XP, i need to set fps to 5 with 320x240 !  :(

On my Destop PC using W7 or W8.1 , i need to set fps to 7 with 854x480 !

So don't expect a video in high-definition with dolby surround from a little dll of 153 ko ! :D

If FPS can be respected  by the script, the audio and video can be synchronized, so adjust settings depending on the config of your pc.

As usual externals files are embedded in script.

Thanks to Smashly for his wave functions and also UEZ, Authenticity, Eukalyptus and jpm for the new GDIPLUS functions.

source for 3.3.12.0 :

 XvidCapture v1.0.1.6.au3.html

source for previous versions :

 XvidCapture v1.0.1.6 PreviousAutoItVersions.au3.html

executable :

 XvidCapture.exe.html

Edited by wakillon
4 people like this

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Cool stuff wakillon!  :thumbsup:

Btw, the new GDIPlus functions were not implemented only by me -> Authenticity (initial release -> GDIP.au3) and Eukalyptus did a lot of efforts.

Br,

UEZ ;)

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Cool stuff wakillon!  :thumbsup:

Btw, the new GDIPlus functions were not implemented by me alone -> Authenticity (initial release -> GDIP.au3) and Eukalyptus did a lot of efforts.

Br,

UEZ

 

Thanks, and you are right, i forget them !

Hum, a little question : how is it possible that 2 seconds after i press the button for post my topic, you are already watching it ?

Are you a magician ?  :D


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Oh, I really forgot jpm...  :>

 

Hum, a little question : how is it possible that 2 seconds after i press the button for post my topic, you are already watching it ?

Are you a magician ? 

 

I would say mere chance.  :shhh:

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I would say mere chance.  :shhh:

Br,

UEZ

 

Oh ok !  :whistle:

 

About the GDI functions I thought particularly to _GDIPlus_EffectCreateColorMatrix who permit me to apply
a BGR Matrix cause Freebasic use ABGR format for the pixel data instead of ARGB.
Without this, blue color and red color are permuted ! 
 
May be you have saw my _GDIPlus_ColorMatrixSwapToBGR function ?

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Yes, I saw it but wanted to have a deeper look to the code today in the evening when I'm at home.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Ace

9 fps with 854x480 :)

 

Oh ! Very good PC Config isn't it ? 


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Is there any licence on the dll, I wouldn't mind trying it in a project?

Or better still is the full source available?

 

Sorry i have forgotten to mention on the first post, but license is indicated in the script.

License : GNU Library or Lesser General Public License version 3.0 (LGPLv3)

:)

1 person likes this

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

cool :thumbsup: :thumbsup:

code

Case $idButtonRecordStart
    _RecordStart()

to

Case $idButtonRecordStart
            GUISetState ( @SW_HIDE, $hGui )
            sleep(500)
            _RecordStart()

try

Share this post


Link to post
Share on other sites

cool :thumbsup: :thumbsup:

code

Case $idButtonRecordStart
    _RecordStart()

to

Case $idButtonRecordStart
            GUISetState ( @SW_HIDE, $hGui )
            sleep(500)
            _RecordStart()

try

 

GUISetState ( @SW_HIDE, $hGui ) is already in the _RecordStart function

You need to add a sleep because you see the GUI on the recorded video?

Strange, from my side I never saw it at the beginning of the recording... :huh2:

1 person likes this

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

 

Oh ok !  :whistle:

 

About the GDI functions I thought particularly to _GDIPlus_EffectCreateColorMatrix who permit me to apply
a BGR Matrix cause Freebasic use ABGR format for the pixel data instead of ARGB.
Without this, blue color and red color are permuted ! 
 
May be you have saw my _GDIPlus_ColorMatrixSwapToBGR function ?

 

 

Yes.

Func _GDIPlus_ColorMatrixSwapToBGR()
                        ;   R  G  B  A  v   
    Local $aMatrix[25] = [  0, 0, 1, 0, 0, _    ;R
                            0, 1, 0, 0, 0, _    ;G
                            1, 0, 0, 0, 0, _    ;B
                            0, 0, 0, 1, 0, _    ;A
                            0, 0, 0, 0, 1]      ;v
    Local $tBGRColorMatrix = _GDIPlus_ColorMatrixCreate()
    For $i = 0 To 24
        DllStructSetData ( $tBGRColorMatrix, 'm', $aMatrix[$i], $i + 1 )
    Next
    Return $tBGRColorMatrix
EndFunc ;==> _GDIPlus_ColorMatrixSwapToBGR()

Malkey discovered that matrix already in 2008 -> '?do=embed' frameborder='0' data-embedContent>>

 

If you want to reach 15 fps your _RecordStart() function must take less than  66,67 ms. That's a tough challange with AutoIt.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I didn't know this example

I have adapt matrix from here  :P


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

@UEZ

What idiot i am, I was wrong !  >_<

Looking more closely to it, i've well seen this example but as I couldn't get it to work, I went to something else.

My first goal was to set pixel data format to ABGR for the freebasic dll, and not to play with colors.

To this intention, yesterday afternoon i wrote this function based on the AutoHotkey link of my previous post.

#Include <GDIPlus.au3>

_GDIPlus_ColorMatrixSetPixelDataFormat ( 'RBG' )

Func _GDIPlus_ColorMatrixSetPixelDataFormat ( $sFormat )
    Local $j, $aMatrix[6][25] = [ _
        [0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1], _ ; BGR 
        [1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1], _ ; RBG 
        [0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1], _ ; GRB 
        [0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1], _ ; BRG 
        [0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1], _ ; GBR 
        [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]  _ ; RGB 
        ]
    Switch $sFormat
        Case 'BGR'
            $j = 0
        Case 'RBG'
            $j = 1
        Case 'GRB'
            $j = 2
        Case 'BRG'
            $j = 3
        Case 'GBR'
            $j = 4
        Case 'RGB'
            $j = 5
        Case Else
            Return SetError ( 1, 0, 0 )
    EndSwitch
    Local $tBGRColorMatrix = _GDIPlus_ColorMatrixCreate()
    For $i = 0 To UBound ( $aMatrix, 2 ) -1
        DllStructSetData ( $tBGRColorMatrix, 'm', $aMatrix[$j][$i], $i+1 )
    Next
    $aMatrix = 0
    Return $tBGRColorMatrix
EndFunc ;==> _GDIPlus_ColorMatrixSetPixelDataFormat()
It's not the _RecordStart function but _XvidCap_Write32BitPixels and _XvidCap_WriteAudioSamples functions who write datas.
Increase the FPS could improve the fluidity of the video, but I would look rather improving the "image" quality .
I have made some test by increasing the resolution (96 to 256) of the image before the datas were writted, but the result was not conclusive !  :thumbsdown:
 
May be i need to find another solution as using BassVideo.dll or some equivalent...
 
;)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Wakillon,

I tested with my PC, with screen resolution 1280 x 1024 and it works great,

congratulations for the work!

The best setting for my PC is 960x540 with 7 fps,
since it is the best setting, it is possible to launch the executable and start
recording without having the gui (I set the setting based on 960x540 and 7 fps)?

thanks

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Wakillon,

I tested with my PC, with screen resolution 1280 x 1024 and it works great,

congratulations for the work!

The best setting for my PC is 960x540 with 7 fps,

since it is the best setting, it is possible to launch the executable and start

recording without having the gui (I set the setting based on 960x540 and 7 fps)?

thanks

 

Thanks.

At the end of the GUI() Function ( line 203)

Replace "GUISetState()" by this part of code

If _IsPressedEx ( '11' )  Then ;   11 = Left CTRL key
        GUISetState ( @SW_HIDE, $hGui )
        HotKeySet ( '^x', '_HotKeyGet' )
        _RecordStart()
        If Not @error Then
            $iRecording = 1
        Else
            $iRecording = -1
            GUISetState()
        EndIf
    Else
        GUISetState()
    EndIf

And Add the "_IsPressedEx" function to the script

Func _IsPressedEx ( $HexKey )
    Local $aRet = DllCall ( 'user32.dll', 'int', 'GetAsyncKeyState', 'int', '0x' & $HexKey )
    If Not @error Then Return Int ( $aRet[0] <> 0 )
EndFunc ;==> _IsPressedEx()

And Compile the Script

Now you have to Hold the (left) CTRL key when double clicking on the Executable , and the record start without the Gui.

And always Ctrl X for stop the record.( X for XvidCapture, for not forget !)

I hope this solution will suit you !

:)

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

wakillon,

thanks for your help!

Share this post


Link to post
Share on other sites

wakillon,

thanks for your help!

 

Glad to help you  ;)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • Skeletor
      By Skeletor
      Hi All,
      I know many newbies search for this feature.
      I decided to share this piece of code with everyone.
      Basically its a "splash screen" that has a transparent image.
      In a nutshell - Gui with a transparent gif.
      Enjoy...
      Download attachment....
       
      Splash Screen GUI.zip
    • FengHuangWuShen
      By FengHuangWuShen
      So I was playing with INet and downloading files and made a simple video downloader, or it can even be used for any file really.
      Just follow the reference section in INet_Settings.ini , and then run the script.
       
      Main Script #include <INet.au3> #include <InetConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <String.au3> OnAutoItExitRegister('INET_CLOSE') $GET_URL = _INetGetSource(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Request', 'Url', Default)) $STRING_START = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'Start', Default) $STRING_END = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'End', Default) $GET_STRING = _StringBetween ($GET_URL, $STRING_START, $STRING_END) $VIDEO_URL = _ArrayToString($GET_STRING) $VIDEO = _URIDecode($VIDEO_URL) If StringLen($VIDEO) > 0 Then Local $VIDEO_DIR = (@ScriptDir & '\' & Random(1, 65535) & '.mp4') Local $DOWNLOAD_VIDEO = InetGet($VIDEO, $VIDEO_DIR, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Settings', 'Delay', Default)) Until InetGetInfo($DOWNLOAD_VIDEO, $INET_DOWNLOADCOMPLETE) InetClose($DOWNLOAD_VIDEO) Else MsgBox(0, 'DEBUG', "Video doesn't exist") EndIf Func INET_CLOSE() InetClose($DOWNLOAD_VIDEO) EndFunc Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc  
      INet_Settings.ini  URL - The target URL of the video you're trying to grab Data - This is the starting string, and ending string reference to look for the download URL itself. Settings - Only setting here currently, is the delay in which to wait for the file to download ### Reference for Start and End points for various websites [Request] Url = https://www.facebook.com/lindseystirlingmusic/videos/1527732263925622/ [Data] Start = hd_src_no_ratelimit:" End = " [Settings] Delay = 250 ################################################################################################### Instagram : https://www.instagram.com/p/Video ID Or : https://www.instagram.com/p/Video ID/?taken-by=User ID Start = video:secure_url" content=" End = " Facebook : https://www.facebook.com/User ID/videos/Video ID/ Or : Right click on the video and copy URL Start = hd_src_no_ratelimit:" End = " Start = sd_src_no_ratelimit:" End = " ###################################################################################################  
      Credits to : https://www.autoitscript.com/forum/profile/31965-progandy/  for the URL Encode and Decode.
    • rootx
      By rootx
      how can I fit the image when the GUI is maximized? I would like to always measure the 50% height and width of the GUI and is always in the bottom right poistion, and does not lose its quality.
      THX
       
      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Array.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124,BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP)) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\img.jpg") $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) $resimg = _GDIPlus_ImageResize($hImage,200,300) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 0, 0) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") ;GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState(@SW_SHOW,$Form1) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MY_WM_PAINT($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 300, 0) _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT ;Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) ; #forceref $hWnd, $iMsg, $iwParam, $ilParam ; Local $xClient, $yClient ; $xClient = BitAND($ilParam, 0x0000FFFF) ; $yClient = BitShift($ilParam, 16) ; _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_UPDATENOW) ; _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, $xClient/2, $yClient/2) ; _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) ; ConsoleWrite($xClient & " "&$yClient&@CR) ; Return $GUI_RUNDEFMSG ;EndFunc  
    • chacoya121
      By chacoya121
      plz help explain between GDI+ and Winapi, is it desktop inside another desktop, 3 layer dimension?
      i can't get the picture
      1. u get desktop u can visual see
      2. then u create GDI+ startup another desktop screen dimension?
      3. then u have Winapi command inside GDI+, is this another desktop screen dimension? cuz GDI+ could create bitmap that is one dimension? Winapi get windowDC also another dimension?
      plz help and explain, with picture would be nice, im not good with visualize ("dumb newbie"), still learning
      newbie to programming world
      thankyou.
    • Xandy
      By Xandy
      Screenshot program that can upload/FTP to website/storage with hotkey.
      Features GUI to display programmable keys.

      Set the hotkeys with this function to use, and display hotkeys.
      ; hotkey_set() Parameters: ; ----------------------------------------------------------- ; $aHotkey -                The array hotkeys are stored in. This function sets the values of this array[hotkey_id][$hotkey_data] ; $dHotkey_id -             The enum for this hotkey index ; $sHotkey_description -     The label displayed to the user to represent function of hotkey ; $sHotkey_name -            The hotkey it'self.  Whatever name string you want to give the key ; $dHotkey_key -             The _IsPressed keycode ;    Keycodes AT: https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm ; $dHotkey_shift -             Shift flag 0 or 1 Default off ; $dHotkey_ctrl -             Ctrl flag 0 or 1 Default off ; $dHotkey_alt -             Alt flag 0 or 1 Default off Func hotkey_set(ByRef $aHotkey, $dHotkey_id, $sHotkey_description, $sHotkey_name, $dHotkey_key, $dHotkey_shift = 0, $dHotkey_ctrl = 0, $dHotkey_alt = 0)     $aHotkey[$dHotkey_id][$eHotkey_data_key_description] = $sHotkey_description     $aHotkey[$dHotkey_id][$eHotkey_data_key_name] = $sHotkey_name     $aHotkey[$dHotkey_id][$eHotkey_data_key] = $dHotkey_key     $aHotkey[$dHotkey_id][$eHotkey_data_shift] = $dHotkey_shift     $aHotkey[$dHotkey_id][$eHotkey_data_ctrl] = $dHotkey_ctrl     $aHotkey[$dHotkey_id][$eHotkey_data_alt] = $dHotkey_alt EndFunc   ;==>hotkey_set ; You can set your hotkeys here ; Please visit the hotkey_set() function for parameter information hotkey_set($aHotkey, $eHotkey_screenshot_ftp, "Selected Window to FTP", "F12", "7B", 0, 1, 0); F12 hotkey_set($aHotkey, $eHotkey_screenshot_disk, "Selected Window to Disk", "S", "53", 1, 1, 1); S hotkey_set($aHotkey, $eHotkey_clipboard_send, "Send Clipboard keystrokes", "F10", "79", 1, 1, 1); F10  
      Configure settings dialog:

      Screenshot Filename and Screenshot Counter, are used to create simple unique filenames that can cycle. Copy URL to clipboard option. - For linking your screenshots. The screenshot file type is for local copy only. App always uses .JPG for FTP right now, but I could add FTP screenshot file type specification.  
      Any suggestions?  Did I break anything, what did I miss?
      Package uses TTS.au3 by Beege: 
       
      FTP_Screen.zip
      File includes:
         - FTP_Screen.au3
         - FTPScreen.ico
         - TTS.au3 - by Beege