Sign in to follow this  
Followers 0
CedricGanges

mencoder script

2 posts in this topic

#1 ·  Posted (edited)

Salut

petit script pour faire du stopmotion

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\res\xine.ico
#AutoIt3Wrapper_Outfile=stop.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <File.au3>
#Include <GDIPlus.au3>
#include <EditConstants.au3>
Local $image, $x, $y, $select
$test = 0

GUICreate("Stop", 400,260)
GUICtrlCreateLabel("Réaliser un film à partir d'images", 5, 5, 390, 30, $SS_CENTER)
GUICtrlSetFont(-1, 10, 600)
GUICtrlCreateLabel("Nécessite que les images soient déjà ordonnées (ex : img001.jpg,",5, 40, 390, 20, $SS_CENTER)
GUICtrlSetFont(-1, -1, -1, 2)
GUICtrlCreateLabel(" img002.jpg...) et quelle soient dans le même dossier et de même taille.", 5, 60, 390, 20, $SS_CENTER)
GUICtrlSetFont(-1, -1, -1, 2)

$source = GUICtrlCreateButton("Dossier Source", 5, 90, 100, 25)
$nbrItem = GUICtrlCreateLabel("", 5, 120, 90, 20, $SS_CENTER)
$liste = GUICtrlCreateList("", 110, 90, 120, 140)
$pics = GUICtrlCreatePic("", 240, 90, 150, 135)
GUICtrlCreateLabel("Images / sec :", 5, 140, 95, 20, $SS_CENTER)
GUICtrlSetFont(-1, 9, 600)
$fpsChoose = GUICtrlCreateInput("", 10, 160, 90, 20, $ES_NUMBER)
GUICtrlCreateLabel("Taille Sortie :", 5, 190, 95, 20)
GUICtrlSetFont(-1, 9, 600)
$slider = GUICtrlCreateSlider(5, 210, 95, 20)
GUICtrlSetLimit(-1, 100, 1)
GUICtrlSetData(-1, 100)
$labelTaille = GUICtrlCreateLabel("", 5, 230, 95, 20, $SS_CENTER)
$go = GUICtrlCreateButton("GO !", 125, 230, 90, 25)
GUISetState()

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If FileExists($select&"\mencoder.exe") Then FileDelete($select&"\mencoder.exe")
            If FileExists($select&"\encode.bat") Then FileDelete($select&"\encode.bat")
            Exit
        Case $source
            $select = FileSelectFolder("Sélection du dossier", @HomePath)
            $remp = remplissage($select)
            If $remp = 1 Then $test = 1
            width_height()
        Case $liste
            GUICtrlSetImage($pics, $select&"\"&GUICtrlRead($liste))
        Case $go
            If $test = 1 And GUICtrlRead($fpsChoose) <> "" Then
                $name = InputBox("Nom", "Nom du fichier de sortie", "out")
                FileCopy(@ScriptDir&"\mencoder.exe", $select)
                FileCopy(@ScriptDir&"\encode.bat", $select)
                RunWait(@ComSpec & " /c" &$select&"\encode.bat "&$select&" "&GUICtrlRead($fpsChoose)& " " &$x &" " &$y&" "&$name)
                FileDelete($select&"\encode.bat")
                ShellExecute($select&"\"&$name&".avi")
            EndIf
        Case $slider
            width_height()
    EndSwitch
WEnd

Func remplissage($path)
        GUICtrlSetData($liste, "")
        $a = 1
        Local $read = _FileListToArray($path, "*.jpg")
        If @error Then
            GUICtrlSetData($liste, "")
        Else
            For $i = 1 to $read[0]
                $a = $a + 1
                GUICtrlSetData($liste, $read[$i]&"|")
            Next
            GUICtrlSetData($nbrItem, $a&" Items")
            Return 1
        EndIf
EndFunc

Func width_height()
    $file = _FileListToArray($select)
    If Not @error Then
        For $i = 1 to $file[0]
            If StringInStr($file[$i], ".jpg") Then
                _GDIPlus_Startup()
                Local $hImage = _GDIPlus_ImageLoadFromFile($select&"\"&$file[$i])
                    If @error Then
                        MsgBox(16, "Error", "Erreur")
                        Exit 1
                    EndIf
                    $x =  Round((_GDIPlus_ImageGetWidth($hImage) * GUICtrlRead($slider)) /100, 0)
                    $y =  Round((_GDIPlus_ImageGetHeight($hImage) * GUICtrlRead($slider)) /100, 0)
                    GUICtrlSetData($labelTaille, "("&$x &" x " &$y&")")
                    _GDIPlus_ImageDispose ($hImage)
                    _GDIPlus_ShutDown ()
                    GUICtrlSetData($labelTaille, "("&$x  &" x " &$y &")")
                    ExitLoop
                EndIf
        Next
    EndIf
EndFunc

bon c'est peut etre pas très propre mais ça fonctionnne:

dans le dossier du script, il faut rajouter mencoder : https://mplayer-for-windows.googlecode.com/files/mplayer-svn-36349.7z

ainsi qu'un encode.bat pour mencoder :

http://sebsauvage.net/paste/?c1827f33a81bfcb7#635SoH8XlqZdef9GvEFwMZeDBYToJ12JjYYfVWoX4a4=

Edited by CedricGanges

Share this post


Link to post
Share on other sites



CedricGanges,

Bienvenu au forum AutoIt. :)

Nous sommes anglophone ici - je comprends parfaitement mais le plupart de nos membres ne sont pas francophones. Si tu veux poster quelquechose en francais, adjoute un traduction en anglais s'il te plait. ;)

M23

Trans: Welcome. We speak English here - I can understand but most will not. So if you post in French please add an English translation.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
Sign in to follow this  
Followers 0