Jump to content

Recommended Posts

Posted

You are right, no need to convert data in hex format.

I have take a look to your AscII Art Video and recognized parts of "Le Cinquième Élément" of Luc Besson.

Do you used some batch converter ?

For sure it would take more time, but may be if you convert image by image (with each his own appropriate settings), quality will be improved.

Nice try ! 

A quand la sortie en salle ? ;)

 

​Yes, it's the fifth element trailer.

Video is converted on the fly when watched. Much like when normal video is watched, when codec is used to decode the video. Only the output are ASCII frames here, pushed thru WebSocket then, frame by frame. Quality is set a bit lower deliberately, because currently every parallel connection adds about 10% to my CPU because of complex calculations decoding algo does. It can be set to whatever, but considering it's ASCII art, it doesn't have to be too good, right? I could work on contrast though.

It was just a challenge. I wanted to see if I could make something new in 5-6 hours of free time I had. I could publish the code somewhere maybe, IDK will see. I don't think people want to watch films in ASCII.

Keep up the good work :).

♡♡♡

.

eMyvnE

Posted (edited)

Maybe a short Animgif could be converted frame by frame using Autoit.

Kind of related (maybe) in terms of video processing?

 

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Posted

@trancexx: I'm searching for a way to decode movie files using installed codecs frame by frame to convert it to a GIF animation. Any idea how to do it?

monoceres wrote something (DLL) but he lost the source code to make some modification.

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

Posted

Maybe a short Animgif could be converted frame by frame using Autoit.

Kind of related (maybe) in terms of video processing?

 

​Aha! I just changed my video to that. Check it out.

Yes, GIF is super simple with gdip. I'm sure wakillon is on it.

♡♡♡

.

eMyvnE

Posted (edited)
​    

@trancexx: I'm searching for a way to decode movie files using installed codecs frame by frame to convert it to a GIF animation. Any idea how to do it?

monoceres wrote something (DLL) but he lost the source code to make some modification.

 

Do you try with GifCamEx ?

Edited by wakillon

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

Posted

Do you try with GifCamEx ?

​That's not what I'm searching for (capturing the screen). Something like AU3_FrameGrabber.dll made by monoceres but I need the documentation how to call the DLL. Unfortunately he lost the source code.

The DLL was designed as an AutoIt plug-in which doesn't work anymore.

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

Posted

​That's not what I'm searching for (capturing the screen). Something like AU3_FrameGrabber.dll made by monoceres but I need the documentation how to call the DLL. Unfortunately he lost the source code.

The DLL was designed as an AutoIt plug-in which doesn't work anymore.

AU3_FrameGrabber.dll have only 4 Exported Functions :

_o0_    
AU3_FreeVar        
AU3_GetPluginDetails        
GetVideoFrame        

; #FUNCTION# ;===============================================================================
;
; Name...........: GetVideoFrame
; Description ...: Gets the frame of specified video file. Using systems available DirectShow filters.
; Syntax.........: GetVideoFrame($sFileName,$dTime,[$iWidth,$iHeight])
; Parameters ....:  $sFilename   - Filename of video file.
;                   $dTime       - Time in video to grab the frame (can be decimal)
;                   $iWidth      - Requested width of the HBITMAP (if this is ommited the standard video size is used.)
;                   $iHeight     - Specifies Height, same as above.
; Return values .: Success - A handle to a bitmap (HBITMAP)
;                  Failure - Returns 0 and Sets @Error:
;                  |0 - No error.
;                  |1 - Invalid amount of parameters
;                  |2 - Unable to open the video
; Author ........: Andreas Karlsson (monoceres)
; Modified.......:
; Remarks .......: It's your responsibility to clean up the HBITMAP!!!
; Related .......:
; Link ..........;
; Example .......; Yes
;
; ;==========================================================================================
#AutoIt3Wrapper_Plugin_Funcs= GetVideoFrame
$phandle = PluginOpen("AU3_FrameGrabber.dll")

#include <GDIPlus.au3>

$sFile = FileOpenDialog("Video file", "", "All video files: (*.avi;*.mpeg;*.mpg;*.mp2;*.mp4;*.mov;*.wmv;*.asf;)")
If $sFile <> "" Then

    ; Grabs the frame 5 seconds into the video
    $hbitmap = GetVideoFrame($sFile, 5)

    If $hbitmap = 0 Then
        MsgBox(16, "Error", "Unable to open the file!")
    Else
        $sFile=FileSaveDialog("Saving frame","","Jpeg file(*.jpg;)")
        IF StringRight($sFile,4)<>".jpg" THen $sFile&=".jpg"
        _GDIPlus_Startup()
        $bmp=_GDIPlus_BitmapCreateFromHBITMAP($hbitmap)
        _GDIPlus_ImageSaveToFile($bmp,$sFile)
        ShellExecute($sFile)
        _GDIPlus_BitmapDispose($bmp)
        _WinAPI_DeleteObject($hbitmap)

    EndIf
EndIf

PluginClose($phandle)

 

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

Posted

@trancexx: I'm searching for a way to decode movie files using installed codecs frame by frame to convert it to a GIF animation. Any idea how to do it?

monoceres wrote something (DLL) but he lost the source code to make some modification.

​By using dll or without?

I've written some code for extracting frame/s from video files. It's packed in super small dll. If you are interested here's the dll:  FrameGrabber.zip

Calling it for for one frame would be for example:

$sVideo = FileOpenDialog("Choose Video File", "", "All Files (*)")

$sOutFolder = @ScriptDir & "\GrabbedFrame\"
DirCreate($sOutFolder)

$sBMP = $sOutFolder & "\0.bmp"
$nFrameTime = 22 ; in seconds

$bExtracted = ExtractFrame($sVideo, $sBMP, $nFrameTime)
ConsoleWrite("@error = " & @error & ", @extended = 0x" & Hex(@extended) & @CRLF)
ConsoleWrite("Extracted = " & $bExtracted & @CRLF)




Func ExtractFrame($sVideo, $sBMP, $nFrameTime)
    Local $aCall = DllCall(@ScriptDir & "\FrameGrabber.dll", "long", "ExtractFrame", _
            "wstr", $sVideo, _
            "wstr*", $sBMP, _
            "int64*", $nFrameTime * 10000000, _
            "int", 1)

    If @error Then Return SetError(1, @error, False)
    If $aCall[0] Then Return SetExtended($aCall[0], False)
    Return $aCall[0] = 0
EndFunc

... and for more frames:

$sVideo = FileOpenDialog("Choose Video File", "", "All Files (*)")

$sOutFolder = @ScriptDir & "\GrabbedFrames\"
DirCreate($sOutFolder)

;~ $sBMP0 = $sOutFolder & "\90.bmp"
;~ $sBMP1 = $sOutFolder & "\91.bmp"
;~ $sBMP2 = $sOutFolder & "\92.bmp"
;~ $sBMP3 = $sOutFolder & "\93.bmp"
;~ $sBMP4 = $sOutFolder & "\94.bmp"
;~ $sBMP5 = $sOutFolder & "\95.bmp"

;~ Local $aBmps = [$sBMP0, $sBMP1, $sBMP2, $sBMP3, $sBMP4, $sBMP5]
;~ Local $aTimes = [17.77, 17.87, 17.97, 18.07, 18.17, 18.27]

; Or maybe like this:
$iNumFrames = 50
Local $aBmps[$iNumFrames]
Local $aTimes[$iNumFrames]

For $i = 0 To $iNumFrames - 1
    $aBmps[$i] = $sOutFolder & $i & ".bmp"
    $aTimes[$i] = 22 + $i / 4 ; in seconds
Next


$bExtracted = ExtractFrames($sVideo, $aBmps, $aTimes)
ConsoleWrite("@error = " & @error & ", @extended = 0x" & Hex(@extended) & @CRLF)
ConsoleWrite("Extracted = " & $bExtracted & @CRLF)




Func ExtractFrames($sVideo, $vBMP, $vFrameTime)
    Local $tBMPS = DllStructCreate("ptr[" & UBound($vBMP) & "]")
    Local $tBMP[UBound($vBMP)]
    For $i = 0 To UBound($vBMP) - 1
        $tBMP[$i] = DllStructCreate("wchar[" & StringLen($vBMP[$i]) + 1 & "]")
        DllStructSetData($tBMP[$i], 1, $vBMP[$i])
        DllStructSetData($tBMPS, 1, DllStructGetPtr($tBMP[$i]), $i + 1)
    Next

    ReDim $vFrameTime[UBound($vBMP)]
    Local $tTimes = DllStructCreate("int64[" & UBound($vFrameTime) & "]")
    For $i = 0 To UBound($vFrameTime) - 1
        DllStructSetData($tTimes, 1, $vFrameTime[$i] * 10000000, $i + 1)
    Next

    Local $aCall = DllCall(@ScriptDir & "\FrameGrabber.dll", "long", "ExtractFrame", _
            "wstr", $sVideo, _
            "struct*", $tBMPS, _
            "struct*", $tTimes, _
            "int", UBound($vBMP))

    If @error Then Return SetError(1, @error, False)
    If $aCall[0] Then Return SetExtended($aCall[0], False)
    Return $aCall[0] = 0
EndFunc

Does it work for you?

♡♡♡

.

eMyvnE

Posted (edited)

Yes it works. Thank you very much! :thumbsup: 

If I can use frame grabbing without DLL and it is fast enough then I would prefer no DLL version. A DLL is also ok for me.

Is it possible to return a bitmap handle or the bitmap as binary data rather than to save to disk? If the frame count isn't too high it is much faster to operate in the memory instead of HDD i/o.

Further can I provide the frame I want to grab rather than the time? In this case it would be nice to have a function that provides some information about the loaded video (dimension, length, frames count, fps, etc).

Last but not least did you write this with C++? Any source code to have a look into would also be good. :>

THANK YOU VERY MUCH.

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

Posted

It's written in VScript. That's my version of AutoIt. It has pretty much the same syntax as AutoIt, but has true compiler. It's what I wanted to do with AutoIt while being active in development. Anyway, not to repeat myself, some limited fuckers had different ideas.
Oh, and Jon doesn't want me to talk about my work on AutoIt on the forums, so that's about all the info I'm willing to share.

Not all codecs support frame count format, particularly those that handle streaming video formats, because streaming is done in time intervals, and not in frames. I can explain the algo if you want, the code can obviously be written in AutoIt.
We are going off-topic here, so create new thread somewhere if you want to go further. No PMs please.

♡♡♡

.

eMyvnE

Posted

I've that DLL but not in %sysdir% (I wanted to mention it) and also the codec pack is installed. I will have a deeper look later when I've some more time.

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

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
×
×
  • Create New...