Konverter der Bilder zu einem Video umwandelt
- VB.NET
Sie verwenden einen veralteten Browser (%browser%) mit Sicherheitsschwachstellen und können nicht alle Funktionen dieser Webseite nutzen.
Hier erfahren Sie, wie einfach Sie Ihren Browser aktualisieren können.
Hier erfahren Sie, wie einfach Sie Ihren Browser aktualisieren können.
Es gibt 13 Antworten in diesem Thema. Der letzte Beitrag () ist von StarGate01.
-
-
-
-
Oh sorry hab ich gar nicht gelesen, in welchen Unterforum usw, sry:)
Aber ich hab nicht mal 1 Minute gegoogelt:
[Beta] Video-Creator (altes Projekt)
[VB 2010] Bilder zu .avi -
-
-
-
-
-
-
Natürlich geht das ohne dll. Entweder du liest dir ewig lange Formatspezifikationen durch haust dich auf lowlevel Ebene durch was bei AVI recht müßselig werden dürfte oder du verwendest WinAPI oder eventuell sogar ComInterfaces von Windows um dir selbst die Funktionalität zu erstellen die du brauchst. Such mal hier nen bisschen rum: msdn.microsoft.com/de-de/libra…op/dd756860(v=vs.85).aspx
Das ist eine von mehreren API's.
Jedoch wird auch das deine Kompetenz bei weitem übersteigen und somit Dll oder lass es. Es geht nunmal nicht immer alles so einfach. Gerade Multimedia ist oft sehr kompliziert.
Ach ja ich würde mich an deiner Stelle mal an den Google Support wenden. Irgendwas scheint bei dir kaput zu sein:
google.at/search?q=vb.net+crea…&sourceid=chrome&ie=UTF-8
google.at/search?q=c%23+create…&sourceid=chrome&ie=UTF-8 -
Ich hatte mich mal damit auseinandergesetzt.
Der folgende Code stammt nicht von mir.
AVI.vb
Spoiler anzeigen
VB.NET-Quellcode
- Imports System.Drawing.Imaging
- Imports System.Runtime.InteropServices
- Public Class Avi
- Public Const StreamtypeVIDEO As Integer = 1935960438
- Public Const OF_SHARE_DENY_WRITE As Integer = 32
- Public Const BMP_MAGIC_COOKIE As Integer = 19778
- <StructLayout(LayoutKind.Sequential, Pack:=1)> _
- Public Structure RECTstruc
- Public left As UInt32
- Public top As UInt32
- Public right As UInt32
- Public bottom As UInt32
- End Structure
- <StructLayout(LayoutKind.Sequential, Pack:=1)> _
- Public Structure BITMAPINFOHEADERstruc
- Public biSize As UInt32
- Public biWidth As Int32
- Public biHeight As Int32
- Public biPlanes As Int16
- Public biBitCount As Int16
- Public biCompression As UInt32
- Public biSizeImage As UInt32
- Public biXPelsPerMeter As Int32
- Public biYPelsPerMeter As Int32
- Public biClrUsed As UInt32
- Public biClrImportant As UInt32
- End Structure
- <StructLayout(LayoutKind.Sequential, Pack:=1)> _
- Public Structure AVISTREAMINFOstruc
- Public fccType As UInt32
- Public fccHandler As UInt32
- Public dwFlags As UInt32
- Public dwCaps As UInt32
- Public wPriority As UInt16
- Public wLanguage As UInt16
- Public dwScale As UInt32
- Public dwRate As UInt32
- Public dwStart As UInt32
- Public dwLength As UInt32
- Public dwInitialFrames As UInt32
- Public dwSuggestedBufferSize As UInt32
- Public dwQuality As UInt32
- Public dwSampleSize As UInt32
- Public rcFrame As RECTstruc
- Public dwEditCount As UInt32
- Public dwFormatChangeCount As UInt32
- <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> _
- Public szName As UInt16()
- End Structure
- 'Initialize the AVI library
- <DllImport("avifil32.dll")> _
- Public Shared Sub AVIFileInit()
- End Sub
- 'Open an AVI file
- <DllImport("avifil32.dll", PreserveSig:=True)> _
- Public Shared Function AVIFileOpen(ByRef ppfile As Integer, ByVal szFile As [String], ByVal uMode As Integer, ByVal pclsidHandler As Integer) As Integer
- End Function
- 'Create a new stream in an open AVI file
- <DllImport("avifil32.dll")> _
- Public Shared Function AVIFileCreateStream(ByVal pfile As Integer, ByRef ppavi As IntPtr, ByRef ptr_streaminfo As AVISTREAMINFOstruc) As Integer
- End Function
- 'Set the format for a new stream
- <DllImport("avifil32.dll")> _
- Public Shared Function AVIStreamSetFormat(ByVal aviStream As IntPtr, ByVal lPos As Int32, ByRef lpFormat As BITMAPINFOHEADERstruc, ByVal cbFormat As Int32) As Integer
- End Function
- 'Write a sample to a stream
- <DllImport("avifil32.dll")> _
- Public Shared Function AVIStreamWrite(ByVal aviStream As IntPtr, ByVal lStart As Int32, ByVal lSamples As Int32, ByVal lpBuffer As IntPtr, ByVal cbBuffer As Int32, ByVal dwFlags As Int32, _
- ByVal dummy1 As Int32, ByVal dummy2 As Int32) As Integer
- End Function
- 'Release an open AVI stream
- <DllImport("avifil32.dll")> _
- Public Shared Function AVIStreamRelease(ByVal aviStream As IntPtr) As Integer
- End Function
- 'Release an open AVI file
- <DllImport("avifil32.dll")> _
- Public Shared Function AVIFileRelease(ByVal pfile As Integer) As Integer
- End Function
- 'Close the AVI library
- <DllImport("avifil32.dll")> _
- Public Shared Sub AVIFileExit()
- End Sub
- End Class
AVIWriter.vb
Spoiler anzeigen
VB.NET-Quellcode
- Imports System.Drawing.Imaging
- Imports System.Runtime.InteropServices
- Public Class AviWriter
- Private aviFile As Integer = 0
- Private aviStream As IntPtr = IntPtr.Zero
- Private frameRate As UInt32 = 0
- Private countFrames As Integer = 0
- Private width As Integer = 0
- Private height As Integer = 0
- Private stride As UInt32 = 0
- Private fccType As UInt32 = Avi.StreamtypeVIDEO
- Private fccHandler As UInt32 = 1668707181
- Private strideInt As Integer
- Private strideU As UInteger
- Private heightU As UInteger
- Private widthU As UInteger
- Public Sub OpenAVI(ByVal fileName As String, ByVal frameRate As UInt32)
- Me.frameRate = frameRate
- Avi.AVIFileInit()
- Dim OpeningError As Integer = Avi.AVIFileOpen(aviFile, fileName, 4097, 0)
- If OpeningError <> 0 Then
- Throw New Exception("Error in AVIFileOpen: " + OpeningError.ToString())
- End If
- End Sub
- Public Sub AddFrame(ByVal bmp As Bitmap)
- bmp.RotateFlip(RotateFlipType.RotateNoneFlipY)
- Dim bmpData As BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.[ReadOnly], PixelFormat.Format24bppRgb)
- If countFrames = 0 Then
- Dim bmpDatStride As UInteger = bmpData.Stride
- Me.stride = DirectCast(bmpDatStride, UInt32)
- Me.width = bmp.Width
- Me.height = bmp.Height
- CreateStream()
- End If
- strideInt = stride
- Dim writeResult As Integer = Avi.AVIStreamWrite(aviStream, countFrames, 1, bmpData.Scan0, DirectCast((strideInt * height), Int32), 0, 0, 0)
- If writeResult <> 0 Then
- Throw New Exception("Error in AVIStreamWrite: " + writeResult.ToString())
- End If
- bmp.UnlockBits(bmpData)
- System.Math.Max(System.Threading.Interlocked.Increment(countFrames), countFrames - 1)
- End Sub
- Private Sub CreateStream()
- Dim strhdr As New Avi.AVISTREAMINFOstruc()
- strhdr.fccType = fccType
- strhdr.fccHandler = fccHandler
- strhdr.dwScale = 1
- strhdr.dwRate = frameRate
- strideU = stride
- heightU = height
- strhdr.dwSuggestedBufferSize = DirectCast((stride * strideU), UInt32)
- strhdr.dwQuality = 10000
- heightU = height
- widthU = width
- strhdr.rcFrame.bottom = DirectCast(heightU, UInt32)
- strhdr.rcFrame.right = DirectCast(widthU, UInt32)
- strhdr.szName = New UInt16(64) {}
- Dim createResult As Integer = Avi.AVIFileCreateStream(aviFile, aviStream, strhdr)
- If createResult <> 0 Then
- Throw New Exception("Error in AVIFileCreateStream: " + createResult.ToString())
- End If
- Dim bi As New Avi.BITMAPINFOHEADERstruc()
- Dim bisize As UInteger = Marshal.SizeOf(bi)
- bi.biSize = DirectCast(bisize, UInt32)
- bi.biWidth = DirectCast(width, Int32)
- bi.biHeight = DirectCast(height, Int32)
- bi.biPlanes = 1
- bi.biBitCount = 24
- strideU = stride
- heightU = height
- bi.biSizeImage = DirectCast((strideU * heightU), UInt32)
- Dim formatResult As Integer = Avi.AVIStreamSetFormat(aviStream, 0, bi, Marshal.SizeOf(bi))
- If formatResult <> 0 Then
- Throw New Exception("Error in AVIStreamSetFormat: " + formatResult.ToString())
- End If
- End Sub
- Public Sub Close()
- If aviStream <> IntPtr.Zero Then
- Avi.AVIStreamRelease(aviStream)
- aviStream = IntPtr.Zero
- End If
- If aviFile <> 0 Then
- Avi.AVIFileRelease(aviFile)
- aviFile = 0
- End If
- Avi.AVIFileExit()
- End Sub
- End Class
Verwendung:
Quelle: Codeproject
Viel Erfolg noch,SᴛᴀʀGᴀᴛᴇ01Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „StarGate01“ ()
-
-
Sound geht auch siehe codeproject.com/Articles/7388/…r-for-the-AviFile-Library
Bei codeproject.com/script/Articles/ViewDownloads.aspx?aid=7388 sollte es möglich sein die AVIManager.AddAudioStream-Methode zu extrahieren.SᴛᴀʀGᴀᴛᴇ01
-
Ähnliche Themen
-
5 Benutzer haben hier geschrieben
- Gast (6)
- n1nja (3)
- thefiloe (2)
- StarGate01 (2)
- Nikx (1)