[R] Utilisation d'un shell
Posté : jeu. 21 mars 2013 10:15
Bonjour à tous,
Pour un petit programme j'utilise la commande shell pour lancer ffmpeg avec des paramètres. Ca marche convenablement mais j'ai un petit souci. Tout d'abord voici le code:
Comment faire pour éviter que la fenêtre shell se ferme toute seul? Parce que pour débugger c'est un peu chiant je n'ai pas le résultat du terminal. Y a une option pour laisser le terminal ouvert ou alors je dois passer par un batch?
Pour un petit programme j'utilise la commande shell pour lancer ffmpeg avec des paramètres. Ca marche convenablement mais j'ai un petit souci. Tout d'abord voici le code:
Code : Tout sélectionner
#include <GDIPlus.au3>
;Variables
$repetition = 5
$attente = 1 * 1000 * 20
$nom_video = @HOUR & "h" & @MIN & "_" & @MDAY & "_" & @MON & "_" & @YEAR" & "mp4"
For $i = 001 To $repetition
;Télécharge en arrière plan
Local $hDownload = InetGet("http://toto/map.jpg?0.314970187144354", "map-" & StringFormat("%03i", $i) & ".jpg", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$img1 = "map-" & StringFormat("%03i", $i) & ".jpg" ; départ
$img2 = "cmap-" & StringFormat("%03i", $i) & ".jpg" ; arrivée
_RognerImage($img1, $img2, 5, 24, 992, 938)
FileDelete($img1)
Sleep($attente)
Next
;Création de la vidéo avec FFmpeg
ShellExecute("ffmpeg.exe", "-f image2 -r 1 -i cmap-%03d.jpg -c:v libx264 -r 30 " & $nom_video)
ShellExecuteWait("ffmpeg.exe")
MsgBox(0, "", "Fin du script")
Func _RognerImage($imga, $imgb, $X, $Y, $W, $H)
Local $hImage, $hClone
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ($imga)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, $X, $Y, $W, $H, $GDIP_PXF32RGB)
_GDIPlus_ImageSaveToFile($hClone, $imgb)
_GDIPlus_ImageDispose($hClone)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()
EndFunc