Imports System.IO
Imports System.Diagnostics
Imports System
Public Class VideoEditorForm
Private ffmpegPath As String = "C:\ffmpeg-master-latest-win64-gpl-shared\bin\ffmpeg.exe" '将此路径更改为您的 FFmpeg 实际安装路径
'储选中的视频文件路径
Private selectedVideoPath As String
'剪的起始时间(以秒为单位)
Private cropStartTime As Integer
'剪的结束时间(以秒为单位)
Private cropEndTime As Integer
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim openFileDialog As New OpenFileDialog()
openFileDialog.Filter = "Video Files (*.mp4;*.avi;*.mkv; *.wmv)|*.mp4;*.avi;*.mkv; *.wmv"
If openFileDialog.ShowDialog() = DialogResult.OK Then
selectedVideoPath = openFileDialog.FileName
End If
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
If String.IsNullOrEmpty(selectedVideoPath) Then
MessageBox.Show("请先选择要保存的视频文件!")
Exit Sub
End If
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "MP4 Video (*.mp4)|*.mp4|AVI Video (*.avi)|*.avi|MKV Video (*.mkv)|*.mkv"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
Dim outputPath As String = saveFileDialog.FileName
Dim fileExtension As String = Path.GetExtension(outputPath)
Dim process As New Process()
process.StartInfo.FileName = ffmpegPath
Select Case fileExtension.ToLower()
Case ".mp4"
process.StartInfo.Arguments = "-i " & Chr(34) & selectedVideoPath & Chr(34) & " -c:v libx264 -c:a aac " & Chr(34) & outputPath & Chr(34)
Case ".avi"
process.StartInfo.Arguments = "-i " & Chr(34) & selectedVideoPath & Chr(34) & " -c:v mpeg4 -c:a mp3 " & Chr(34) & outputPath & Chr(34)
Case ".mkv"
process.StartInfo.Arguments = "-i " & Chr(34) & selectedVideoPath & Chr(34) & " -c:v copy -c:a copy " & Chr(34) & outputPath & Chr(34)
End Select
process.StartInfo.UseShellExecute = False
process.StartInfo.RedirectStandardOutput = True
process.Start()
While Not process.HasExited
Dim output As String = process.StandardOutput.ReadLine()
'以在此处理进程的输出信息
End While
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim openFileDialog As New OpenFileDialog()
openFileDialog.Filter = "Video Files (*.mp4;*.avi;*.mkv; *.wmv)|*.mp4;*.avi;*.mkv; *.wmv"
If openFileDialog.ShowDialog() = DialogResult.OK Then
selectedVideoPath = openFileDialog.FileName
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim openFileDialog As New OpenFileDialog()
openFileDialog.Multiselect = True
openFileDialog.Filter = "视频文件|*.mp4;*.avi;*.mkv;*.flv;*.wmv"
If openFileDialog.ShowDialog() = DialogResult.OK Then
Dim filePaths() As String = openFileDialog.FileNames
Dim concatListFile As String = Path.GetTempFileName()
Using sw As New StreamWriter(concatListFile)
For Each filePath As String In filePaths
sw.WriteLine("file '" & filePath & "'")
Next
End Using
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "MP4 Video (*.mp4)|*.mp4|AVI Video (*.avi)|*.avi|MKV Video (*.mkv)|*.mkv"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
Dim outputPath As String = saveFileDialog.FileName
Dim fileExtension As String = Path.GetExtension(outputPath)
Dim process As New Process()
process.StartInfo.FileName = ffmpegPath
Select Case fileExtension.ToLower()
Case ".mp4"
process.StartInfo.Arguments = "-f concat -safe 0 -i " & Chr(34) & concatListFile & Chr(34) & " -c:v libx264 -c:a aac " & Chr(34) & outputPath & Chr(34)
Case ".avi"
process.StartInfo.Arguments = "-f concat -safe 0 -i " & Chr(34) & concatListFile & Chr(34) & " -c:v mpeg4 -c:a mp3 " & Chr(34) & outputPath & Chr(34)
Case ".mkv"
process.StartInfo.Arguments = "-f concat -safe 0 -i " & Chr(34) & concatListFile & Chr(34) & " -c:v copy -c:a copy " & Chr(34) & outputPath & Chr(34)
End Select
process.StartInfo.UseShellExecute = False
process.StartInfo.RedirectStandardOutput = True
process.Start()
While Not process.HasExited
Dim output As String = process.StandardOutput.ReadLine()
'以在此处理进程的输出信息
End While
End If
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
'择导出保存的路径和格式
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "MP4 文件|*.mp4|AVI 文件|*.avi|MKV 文件|*.mkv|FLV 文件|*.flv|WMV 文件|*.wmv"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
Dim exportPath As String = saveFileDialog.FileName
'此处进行导出保存的后续处理
Console.WriteLine("导出保存的路径: " & exportPath)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If String.IsNullOrEmpty(selectedVideoPath) Then
MessageBox.Show("请先选择要裁剪的视频文件!")
Exit Sub
End If
'取用户输入的裁剪起始时间和结束时间
If Not Integer.TryParse(TextBoxCropStart.Text, cropStartTime) OrElse Not Integer.TryParse(TextBoxCropEnd.Text, cropEndTime) Then
MessageBox.Show("请输入有效的裁剪时间(整数,以秒为单位)!")
Exit Sub
End If
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "MP4 Video (*.mp4)|*.mp4|AVI Video (*.avi)|*.avi|MKV Video (*.mkv)|*.mkv"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
Dim outputPath As String = saveFileDialog.FileName
Dim fileExtension As String = Path.GetExtension(outputPath)
Dim process As New Process()
process.StartInfo.FileName = ffmpegPath
Select Case fileExtension.ToLower()
Case ".mp4"
process.StartInfo.Arguments = "-i " & Chr(34) & selectedVideoPath & Chr(34) & " -ss " & cropStartTime & " -to " & cropEndTime & " -c:v libx264 -c:a aac " & Chr(34) & outputPath & Chr(34)
Case ".avi"
process.StartInfo.Arguments = "-i " & Chr(34) & selectedVideoPath & Chr(34) & " -ss " & cropStartTime & " -to " & cropEndTime & " -c:v mpeg4 -c:a mp3 " & Chr(34) & outputPath & Chr(34)
Case ".mkv"
process.StartInfo.Arguments = "-i " & Chr(34) & selectedVideoPath & Chr(34) & " -ss " & cropStartTime & " -to " & cropEndTime & " -c:v copy -c:a copy " & Chr(34) & outputPath & Chr(34)
End Select
process.StartInfo.UseShellExecute = False
process.StartInfo.RedirectStandardOutput = True
没有合适的资源?快使用搜索试试~ 我知道了~
VS2010旗舰版VB.NET版本视频剪辑源代码QZQ-2024-8-11.zip

共44个文件
vb:8个
mp4:6个
txt:6个

需积分: 5 1 下载量 111 浏览量
2024-08-11
20:08:23
上传
评论
收藏 75.15MB ZIP 举报
温馨提示
VS2010旗舰版VB.NET版本视频剪辑源代码QZQ-2024-8-11.zip
资源推荐
资源详情
资源评论
















收起资源包目录
























































共 44 条
- 1
资源评论


EYYLTV
- 粉丝: 5505
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- C#窗体及常用控件、组件PPT课件.ppt
- 2022年通信生产实习报告汇编8篇.docx
- 互联网思维在报业转型中的运用.docx
- 第四章系统安全评价.pptx
- hadoop生态系统.pdf
- 计算机基础知识试题.doc
- 软件工程软件开发模型lyh教学教材.ppt
- 2021年全国中小学教师网络研修培训心得范本.doc
- 常见的网络推广方法有哪些.pdf
- 【税会实务】Excel中隔行插空行技巧.doc
- C语言程序设计教学论文.doc
- 移动互联网第四波浪潮李开复精选备课讲稿.ppt
- ZKTeco考勤软件说明书模板.doc
- 2021-2022年收藏的精品资料系统集成项目管理工程师第2章练习题总结信息系统服务管理.doc
- 浅谈信息化对中职会计教学的影响.docx
- excel-操作技巧培训PPT课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
