Bonsoir phgir

Dans ce cas je ne vois pas l'utilité du centre de traitement.
Il est vrai qu’avec un nombre de fichiers aussi important que celui que tu indiques, cela devient un véritable marathon mais ce pauvre centre de gestion des opérations n’y est pour rien ^^ lol.
Ce qui serait bien, mais je crois avoir compris que ça ne marchait pas comme ça.
- un script unique sans nom de fichier
- les fichiers à traiter sont pris dans le centre de traitement.
C’est possible. Je te montre :
1 – Télécharge
ce script en
Visual Basic (click droit +
Enregistrer sous...). Je l’ai modifié pour qu’il accepte les fichiers
*.avs et j’en ai profité pour le traduire. L’original se trouve
>>ICI<<.
2 – Enregistre tes paramètres de filtrage et de compression en fichier
*.vcf (
Fichier > Enregistrer les paramètres de traitement…) et place-le dans le même dossier que le script.
3 – A partir de l’explorateur Windows, prends le fichier de configuration
*.vcf et dépose-le sur le fichier script
VirtualDub.vbs. Laisse-toi ensuite guider par les différentes fenêtres qui vont s’afficher.
A l’issue, un fichier
VirtualDub.jobs est créé. Il ne reste plus qu’à le copier dans le dossier d’installation de VirtualDub.
4 – Lance enfin VirtualDub et appelle la
joblist en pressant
<F4> ou en faisant
Fichier > Centre de gestion des opérations… ; tous les fichiers spécifiés dans le dossier source sont prêts à être traités.
Alors deux remarques : la contrainte, c’est que tous les fichiers se verront appliquer les mêmes paramètres de traitement mais on ne peut pas faire autrement.
L’ennui avec ce script, c’est que les fichiers générés après traitement de la
joblist créée portent leur extension originale. Si ce sont des
*.avi, pas de pb mais quand il s’agit de fichiers
*.mpeg ou
*.avs, c’est gênant dans la mesure où il faudra leur redonner l’extension
*.avi. C’est curieux que l’auteur n’ait pas réglé ceci mais je pense que c’est modifiable dans le script. Je verrais si je peux changer ça mais je suis loin de maîtriser
Visual Basic.
A défaut, peut-être un
batch peut-il s’en charger mais ça fait une manipulation supplémentaire.
Cette méthode reste néanmoins très intéressante pour faire du traitement de masse. J’espère avoir pu t’aider. @+++ Room |312| :wink:
P.S. : les fichiers étant parfois volatiles et susceptibles de disparaître du Net, je reproduis ci-dessous l’intégralité du script (désolée, c’est un peu long ^^). Il suffit de le copier dans n’importe quel éditeur de texte et de l’enregistrer avec l’extension
.vbs. Remerciements à Eric Phelps.
'Drop a saved VirtualDub configuration file (VCF file)
'on this script and it will create a ".jobs" file for
'all video files in a directory of your choosing. You
'can also pass VCF file, source directory, and
'destination directory on the command line (in that
'order).
'
'The ".jobs" file created by this script will always
'be in the script's directory and will have the same
'base name as the script.
'
'VirtualDub should NOT be running while it's jobs file
'is being modified.
'
'Eric Phelps
'June 2003
'http://www.ericphelps.com/
'Public Domain. No restrictions. No warranty.
Option Explicit
Main
Sub Main
Dim strVcfFile, strVcfData
Dim strInputDirectory, strOutputDirectory
Dim strMessage, strExtensions, strExtension
Dim fs, fil, fils, fols, fol
Dim dtCreated
Dim intCounter
Set fs = CreateObject("Scripting.FileSystemObject")
'Get the VCF data
If WScript.Arguments.Count > 0 Then
strVcfFile = WScript.Arguments(0)
Else
strVcfFile = BrowseForFile("Selectionnez un fichier de configuration ""VCF"" pour VirtualDub à utiliser :")
End If
If strVcfFile = "" Then Exit Sub 'User hit Cancel on file selection dialog
If Not fs.FileExists(strVcfFile) Then
MsgBox "Erreur de fichier : " & strVcfFile
Exit Sub
End If
If Lcase(Right(strVcfFile, 4)) <> ".vcf" Then
MsgBox "Un fichier VCF doit avoir une extension VCF ! Le fichier que vous avez choisi n'en a pas."
Exit Sub
End If
strVcfData = File2String(strVcfFile)
If InStr(strVcfData, "VirtualDub.") = 0 Then
MsgBox "Ce n'est pas un fichier VCF valide !"
Exit Sub
End If
'Process what kind of files?
strExtensions = InputBox("Quel type de fichier voulez-vous traiter ?",,"avi, mpg, mpeg, avs")
'Get the input directory
If WScript.Arguments.Count > 1 Then
strInputDirectory = WScript.Arguments(1)
Else
strInputDirectory = fs.GetParentFolderName(strVcfFile)
strInputDirectory = BrowseForFolder("Répertoire source : " & vbCrLf & "(Annuler=""" & strInputDirectory & """)")
If strInputDirectory = "" Then strInputDirectory = fs.GetParentFolderName(strVcfFile)
End If
If Not fs.FolderExists(strInputDirectory) Then
MsgBox "Le répertoire sélectionné n'existe pas."
Exit Sub
End If
'Count the source files
Set fils = fs.GetFolder(strInputDirectory).Files
intCounter = 0
For Each fil In fils
For Each strExtension In Split(strExtensions, ",")
If Lcase(Mid(fil.Name, InStrRev(fil.Name, ".") + 1)) = Lcase(Trim(strExtension)) Then
intCounter = intCounter + 1
Exit For
End If
Next
Next
If intCounter = 0 Then
MsgBox "Pas de fichiers " & strExtensions & " trouvés"
Exit Sub
End If
'Get the output directory
If WScript.Arguments.Count > 2 Then
strOutputDirectory = WScript.Arguments(2)
Else
'Try to guess the output directory to save drill-down time
Set fols = fs.GetFolder(strInputDirectory).SubFolders
If fols.Count <> 0 Then
'Pick the most recently accessed sub-folder as the default
dtCreated = Now() - 100000
For Each fol In fols
If fol.DateCreated > dtCreated Then
strOutPutDirectory = fol.Path
dtCreated = fol.DateCreated
End If
Next
Else
'pick the parent folder
If Len(strInputDirectory) > 3 Then
strOutputDirectory = fs.GetFolder(strInputDirectory).ParentFolder.Path
Else
strOutPutDirectory = fs.GetFolder(".").Path
End If
End If
'Remember our choice
Set fol = fs.GetFolder(strOutputDirectory)
strOutputDirectory = BrowseForFolder("Répertoire de destination : " & vbCrLf & "(Annuler=""" & strOutputDirectory & """)")
If strOutputDirectory = "" Then strOutputDirectory = fol.Path
End If
If Not fs.FolderExists(strOutputDirectory) Then
MsgBox "Le répertoire sélectionné n'existe pas."
Exit Sub
End If
If strOutputDirectory = strInputDirectory Then
MsgBox "Le répertoire de destination doit être différent du répertoire source car les fichiers de sortie auront les mêmes noms que les fichiers d'entrée !"
Exit Sub
End If
'Start the job file with the count
String2File "//" & vbCrLf & "// $numjobs " & intCounter & vbCrLf & "//" & vbCrLf, FileNameLikeMine("jobs")
'Process all AVI files
For Each fil In fils
For Each strExtension In Split(strExtensions, ",")
If Lcase(Mid(fil.Name, InStrRev(fil.Name, ".") + 1)) = Lcase(Trim(strExtension)) Then
AddJob fil.Name, strInputDirectory, strOutputDirectory, strVcfData
Exit For
End If
Next
Next
'Display the "finished" message
MsgBox "Fichier Jobs """ & FileNameLikeMine("jobs") & """ créé." & vbCrLf & "Rappel : si le fichier ""jobs"" n'est pas dans le dossier d'installation de VirtualDub, vous devrez l'y copier. Si VirtualDub est en cours d'exécution, vous devrez le redémarrez au préalable pour qu'il prenne en compte votre nouveau fichier ""jobs""."
End Sub
Sub AddJob(strFile, strInDir, strOutDir, strVcf)
'Adds a job to the jobs file
Dim fs, ts
Const ForAppending = 8
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(FileNameLikeMine("jobs"), ForAppending, True)
ts.WriteLine "// $job """ & strFile & """"
ts.Write "// $input """
ts.Write fs.BuildPath(strInDir, strFile)
ts.WriteLine """"
ts.Write "// $output """
ts.Write fs.BuildPath(strOutDir, strFile)
ts.WriteLine """"
ts.WriteLine "// $state 0"
ts.WriteLine "// $start_time 0 0"
ts.WriteLine "// $end_time 0 0"
ts.WriteLine "// $script"
ts.WriteLine ""
ts.Write "VirtualDub.Open("""
ts.Write Replace(fs.BuildPath(strInDir, strFile), "\", "\\")
ts.WriteLine """,0,0);"
ts.WriteLine strVcf
ts.Write "VirtualDub.SaveAVI("""
ts.Write Replace(fs.BuildPath(strOutDir, strFile), "\", "\\")
ts.WriteLine """);"
ts.WriteLine "VirtualDub.Close();"
ts.WriteLine ""
ts.WriteLine "// $endjob"
ts.WriteLine "//"
ts.WriteLine "//--------------------------------------------------"
ts.Close
End Sub
Function BrowseForFolder(strPrompt)
'Uses the "Shell.Application" (only present in Win98 and newer)
'to bring up a file/folder selection window. Falls back to an
'ugly input box under Win95.
'Shell32.ShellSpecialFolderConstants
Const ssfPERSONAL = 5 'My Documents
Const ssfDRIVES = 17 'My Computer
Const SFVVO_SHOWALLOBJECTS = 1
Const SFVVO_SHOWEXTENSIONS = 2
Dim sh, fol, fs, lngView, strPath
Set sh = CreateObject("Shell.Application")
If Instr(TypeName(sh), "Shell") = 0 Then
BrowseForFolder = InputBox(strPrompt, "Sélectionnez un dossier.", CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName))
Exit Function
End If
Set fs = CreateObject("Scripting.FileSystemObject")
lngView = SFVVO_SHOWALLOBJECTS Or SFVVO_SHOWEXTENSIONS
strPath = ""
Set fol = sh.BrowseForFolder(&0, strPrompt, lngView, ssfDRIVES)
Err.Clear
On Error Resume Next
strPath = fol.ParentFolder.ParseName(fol.Title).Path
'An error occurs if the user selects a drive instead of a folder
If Err.Number <> 0 Then
BrowseForFolder = Left(Right(fol.Title, 3), 2) & "\"
Else
BrowseForFolder = strPath
End If
End Function
Function BrowseForFile(strPrompt)
'Uses the "Shell.Application" (only present in Win98 and newer)
'to bring up a file/folder selection window. Falls back to an
'ugly input box under Win95.
'Shell32.ShellSpecialFolderConstants
Const ssfPERSONAL = 5 'My Documents
Const ssfDRIVES = 17 'My Computer
Const SFVVO_SHOWALLOBJECTS = 1
Const SFVVO_SHOWEXTENSIONS = 2
Const SFVVO_SHOWFILES = 16384
Dim sh, fol, fs, lngView, strPath
Set sh = CreateObject("Shell.Application")
If Instr(TypeName(sh), "Shell") = 0 Then
BrowseForFile = InputBox(strPrompt, "Sélectionnez un dossier.", CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\foo.vcf")
Exit Function
End If
Set fs = CreateObject("Scripting.FileSystemObject")
lngView = SFVVO_SHOWALLOBJECTS Or SFVVO_SHOWEXTENSIONS Or SFVVO_SHOWFILES
strPath = ""
On Error Resume Next
Err.Clear
Set fol = sh.BrowseForFolder(&0, strPrompt, lngView, ssfDRIVES)
If Err.Number <> 0 Then
BrowseForFile = "Désolé, je ne peux pas manipuler des fichiers dans le répertoire source !" 'Will throw an error
Exit Function
End If
strPath = fol.ParentFolder.ParseName(fol.Title).Path
If strPath = "" Then
strPath = fol.Title
Set fol = fol.ParentFolder
strPath = fs.BuildPath(fol.ParentFolder.ParseName(fol.Title).Path, strPath)
End If
BrowseForFile = strPath
End Function
Function File2String(strFile) 'As String
'Reads a file and returns the contents as a string
Dim fs 'As Scripting.FileSystemObject
Dim ts 'As Scripting.TextStream
Const ForReading = 1
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(strFile) Then
Set ts = fs.OpenTextFile(strFile, ForReading, True)
If ts.AtEndOfStream Then
File2String =""
Else
File2String = ts.ReadAll
End If
ts.Close
Else
File2String = ""
End If
End Function
Sub String2File(strData, strFileName)
'Writes a string to a file
Dim fs 'As Scripting.FileSystemObject
Dim ts 'As Scripting.TextStream
Const ForWriting = 2
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(strFileName, ForWriting, True)
ts.Write(strData)
ts.Close
End Sub
Sub AppendLineToFile(strText, strFile)
Dim fs 'As Scripting.FileSystemObject
Dim ts 'As Scripting.TextStream
Const ForAppending = 8
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(strFile, ForAppending, True)
ts.WriteLine strText
ts.Close
End Sub
Function FileNameLikeMine(strFileExtension) 'As String
'Returns a file name the same as the script name except
'for the file extension.
Dim fs 'As Object
Dim strExtension 'As String
Set fs = CreateObject("Scripting.FileSystemObject")
strExtension = strFileExtension
If Len(strExtension) < 1 Then strExtension = "txt"
If strExtension = "." Then strExtension = "txt"
If Left(strExtension,1) = "." Then strExtension = Mid(strExtension, 2)
FileNameLikeMine = Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) & strExtension
End Function
En complément, ceux qui le veulent peuvent s’intéresser à
DubMan, un générateur de scripts pour VirtualDub. Nécessite
Java Runtime Environment pour fonctionner. A l’air ancien et pas testé.