Pour l'enregistrement de avi à partir d'une webcam, mais il y a pas de sources exemples pour la gestion du nom du fichier et sa destination, mais aussi que les sources avec le type "capparametre" incompletement defini pose problème. Et comme j'ai bp mais bp galérer pour trouver la solution je poste pour aider les autres :D
GL à tous
Source / Exemple :
Private Type TCAPTUREPARMS
dwRequestMicroSecPerFrame As Long '// Requested capture rate
fMakeUserHitOKToCapture As Long '// Show "Hit OK to cap" dlg?
wPercentDropForError As Long '// Give error msg if > (10% default)
fYield As Long '// Capture via background task?
dwIndexSize As Long '// Max index size in frames (32K default)
wChunkGranularity As Long '// Junk chunk granularity (2K default)
fUsingDOSMemory As Long '// Use DOS buffers? (obsolete)
wNumVideoRequested As Long '// # video buffers, If 0, autocalc
fCaptureAudio As Long '// Capture audio?
wNumAudioRequested As Long '// # audio buffers, If 0, autocalc
vKeyAbort As Long '// Virtual key causing abort
fAbortLeftMouse As Long '// Abort on left mouse?
fAbortRightMouse As Long '// Abort on right mouse?
fLimitEnabled As Long '// Use wTimeLimit?
wTimeLimit As Long '// Seconds to capture
fMCIControl As Long '// Use MCI video source?
fStepMCIDevice As Long '// Step MCI device?
dwMCIStartTime As Long '// Time to start in MS
dwMCIStopTime As Long '// Time to stop in MS
fStepCaptureAt2x As Long '// Perform spatial averaging 2x
wStepCaptureAverageFrames As Long '// Temporal average n Frames
dwAudioBufferSize As Long '// Size of audio bufs (0 = default)
fDisableWriteCache As Long '// Attempt to disable write cache
AVStreamMaster As Long '// Which stream controls length?
End Type
Public Sub Enregistrement()
Dim FileName As String
Dim heureStr As String
Dim dateStr As String
frmMain.Shape1.BorderColor = vbRed
With CapParms
' voir le message de confirmation
.fMakeUserHitOKToCapture = False ' - converts VB Boolean to C BOOL
' pour gestion si trop d image rejeter
.wPercentDropForError = 10
' fUsingDOSMemory est obselette
.fUsingDOSMemory = False
' The number of video buffers should be enough to get through
' disk seeks and thermal recalibrations
.wNumVideoRequested = 32
' abandon sur click gauche
.fAbortLeftMouse = -(True)
' abandon sur click droit
.fAbortRightMouse = -(True) '- converts VB boolean to C BOOL
' If wChunkGranularity is zero, the granularity will be set to the
' disk sector size.
.wChunkGranularity = 0
' default
.dwAudioBufferSize = 0
' le caching
.fDisableWriteCache = -(True)
' utilisation du MCI
.fMCIControl = False
.fStepCaptureAt2x = False
' multi-threading
.fYield = True
' audio buffers
.wNumAudioRequested = 4 '10 est la limit max
' parametre charger a partir du registre
.AVStreamMaster = AVSTREAMMASTER_AUDIO
' fixe la taille max de AVI en frames
.dwIndexSize = 32000
' les parametre de la video fps,son,timelimit
.dwRequestMicroSecPerFrame = 66667
.fCaptureAudio = True
.fLimitEnabled = True
.wTimeLimit = 10
End With
heureStr = Format(Now, "hh-mm-ss")
dateStr = Format(Date, "yyyy-mm-dd")
FileName = Module_base.Get_dossier_avi & "BV_" & dateStr & "_" & heureStr & "_1.avi"
'Change le nom par default (c:\capture)
SendMessageToRecord hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, ByVal FileName
'Envoie les param de la video
SendMessageToRecord hwnd, WM_CAP_SET_SEQUENCE_SETUP, Len(CapParms), CapParms
'Commence la capture
SendMessageToRecord hwnd, WM_CAP_SEQUENCE, Len(CapParms), CapParms
End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.