我正在编写一个简单的基于 Windows 的应用程序,显示分割视频并在 listview 中显示缩略图。
我找到了这段代码,但从这里我需要缩略图而不是图标
Dim strFileSize As String = " "
Dim di As New IO.DirectoryInfo(SPath & "\" & FolderName)
Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")
Dim fi As IO.FileInfo
For Each fi In aryFi
Dim ico As Icon = Icon.ExtractAssociatedIcon(fi.FullName)
ImageList1.Images.Add(ico)
ListView1.Items.Add(fi.ToString, ImageList1.Images.Count - 1)
Next
最佳答案
您必须从 ffmpeg 中的每个视频中获取缩略图并启动该过程。我的选择是
proc.StartInfo.FileName = System.IO.Path.Combine(Application.StartupPath, "ffmpeg.exe")
proc.StartInfo.UseShellExecute = False
proc.StartInfo.CreateNoWindow = True
proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal
proc.StartInfo.RedirectStandardInput = True
proc.EnableRaisingEvents = True
For Each fi In aryFi
proc.StartInfo.Arguments = " -i " + fi.FullName + " -vframes 1 " & (SPath & "\" & FolderName1 & "\") & fi.Name & "%d.jpg"
proc.Start()
Next
将图像添加到图像列表中并显示
For Each files In filesList
ImageList1.Images.Add(Bitmap.FromFile(files))
Next
关于vb.net - 我如何在VB中的 ListView 控件中显示视频的图像缩略图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30705986/