Jump to content

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


wakillon
 Share

Recommended Posts

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

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

Link to comment
Share on other sites

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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

Link to comment
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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

Link to comment
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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)

:)

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

Link to comment
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:

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

Link to comment
Share on other sites

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
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

 

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

Link to comment
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
 Share

×
×
  • Create New...