我正在编写一个简单的基于Windows的应用程序节目分割视频并在列表视图中显示缩略图。
我找到了这段代码,但是从这里我需要缩略图而不是图标
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
答案 0 :(得分:2)
你必须从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