14. juli 2001 - 16:17Der er
1 kommentar og 2 løsninger
Film
Jeg har et program hvor jeg har en masse billeder stående efter hinanden som er hentet fra en film fil men hvordan kan jeg når jeg har ændret i billederne gemme de nye billeder ned i en filmfil igen???
//Fill in the header for the video stream With strhdr .fccType = mmioStringToFOURCC(\"vids\", 0&) \'// stream type video .fccHandler = 0& \'// default AVI handler .dwScale = 1 .dwRate = Val(txtFPS) \'// fps .dwSuggestedBufferSize = bmp.SizeImage \'// size of one frame pixels Call SetRect(.rcFrame, 0, 0, bmp.Width, bmp.Height)\'// rectangle for stream End With
//validate user input If strhdr.dwRate < 1 Then strhdr.dwRate = 1 If strhdr.dwRate > 30 Then strhdr.dwRate = 30
//And create the stream res = AVIFileCreateStream(pfile, ps, strhdr) If (res <> AVIERR_OK) Then GoTo error
//get the compression options from the user //Careful! this API requires a pointer to a pointer to a UDT pOpts = VarPtr(opts) res = AVISaveOptions(Me.hWnd, _ ICMF_CHOOSE_KEYFRAME Or ICMF_CHOOSE_DATARATE, _ 1, _ ps, _ pOpts) //returns TRUE if User presses OK, FALSE if Cancel If res <> 1 Then \'In C TRUE = 1 Call AVISaveOptionsFree(1, pOpts) GoTo error End If
//make compressed stream res = AVIMakeCompressedStream(psCompressed, ps, opts, 0&) If res <> AVIERR_OK Then GoTo error
//Get the first bmp in the list for setting format Set bmp = New cDIB lstDIBList.ListIndex = 0 If bmp.CreateFromFile(lstDIBList.Text) <> True Then MsgBox \"Could not load first bitmap file in list!\", vbExclamation, App.title GoTo error End If
//set format of stream according to the bitmap With BI .biBitCount = bmp.BitCount .biClrImportant = bmp.ClrImportant .biClrUsed = bmp.ClrUsed .biCompression = bmp.Compression .biHeight = bmp.Height .biWidth = bmp.Width .biPlanes = bmp.Planes .biSize = bmp.SizeInfoHeader .biSizeImage = bmp.SizeImage .biXPelsPerMeter = bmp.XPPM .biYPelsPerMeter = bmp.YPPM End With
//set the format of the compressed stream res = AVIStreamSetFormat(psCompressed, 0, ByVal bmp.PointerToBitmapInfo, bmp.SizeBitmapInfo) If (res <> AVIERR_OK) Then GoTo error
//Now write out each video frame For i = 0 To lstDIBList.ListCount - 1 lstDIBList.ListIndex = i bmp.CreateFromFile (lstDIBList.Text) //load the bitmap (ignore errors) res = AVIStreamWrite(psCompressed, _ i, _ 1, _ bmp.PointerToBits, _ bmp.SizeImage, _ AVIIF_KEYFRAME, _ ByVal 0&, _ ByVal 0&) If res <> AVIERR_OK Then GoTo error \'Show user feedback imgPreview.Picture = LoadPicture(lstDIBList.Text) imgPreview.Refresh lblStatus = \"Frame number \" & i & \" saved\" lblStatus.Refresh Next lblStatus = \"Finished!\"
Håber du kan bruge det...
ZeroHero
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.